Antkeeper  0.0.1
Public Types | Public Member Functions | Public Attributes | List of all members
geom::primitives::line_segment< T, N > Struct Template Reference

n-dimensional line segment. More...

#include <line-segment.hpp>

Public Types

using vector_type = math::vector< T, N >
 Vector type. More...
 

Public Member Functions

sqr_length () const noexcept
 Calculates the square length of the line segment. More...
 
length () const noexcept
 Calculates the length of the line segment. More...
 
sqr_distance (const vector_type &point) const noexcept
 Calculates the square distance from the line segment to a point. More...
 
distance (const vector_type &point) const
 Calculates the distance from the line segment to a point. More...
 

Public Attributes

vector_type a
 First endpoint. More...
 
vector_type b
 Second endpoint. More...
 

Detailed Description

template<class T, std::size_t N>
struct geom::primitives::line_segment< T, N >

n-dimensional line segment.

Template Parameters
TReal type.
NNumber of dimensions.

Definition at line 35 of file line-segment.hpp.

Member Typedef Documentation

◆ vector_type

template<class T , std::size_t N>
using geom::primitives::line_segment< T, N >::vector_type = math::vector<T, N>

Vector type.

Definition at line 38 of file line-segment.hpp.

Member Function Documentation

◆ distance()

template<class T , std::size_t N>
T geom::primitives::line_segment< T, N >::distance ( const vector_type point) const
inline

Calculates the distance from the line segment to a point.

Parameters
pointInput point.
Returns
Distance from the line segment to point.

Definition at line 101 of file line-segment.hpp.

◆ length()

template<class T , std::size_t N>
T geom::primitives::line_segment< T, N >::length ( ) const
inlinenoexcept

Calculates the length of the line segment.

Returns
Length of the line segment.

Definition at line 61 of file line-segment.hpp.

◆ sqr_distance()

template<class T , std::size_t N>
T geom::primitives::line_segment< T, N >::sqr_distance ( const vector_type point) const
inlinenoexcept

Calculates the square distance from the line segment to a point.

Parameters
pointInput point.
Returns
Square distance from the line segment to point.

Definition at line 74 of file line-segment.hpp.

◆ sqr_length()

template<class T , std::size_t N>
T geom::primitives::line_segment< T, N >::sqr_length ( ) const
inlinenoexcept

Calculates the square length of the line segment.

Returns
Square length of the line segment.

Definition at line 51 of file line-segment.hpp.

Member Data Documentation

◆ a

template<class T , std::size_t N>
vector_type geom::primitives::line_segment< T, N >::a

First endpoint.

Definition at line 41 of file line-segment.hpp.

◆ b

template<class T , std::size_t N>
vector_type geom::primitives::line_segment< T, N >::b

Second endpoint.

Definition at line 44 of file line-segment.hpp.


The documentation for this struct was generated from the following file: