Thea
Public Types | Public Member Functions | Static Public Member Functions | List of all members
LineSegmentN< N, T > Class Template Reference

A straight line in N-dimensional space, where N is any positive (non-zero) integer and T is a field. More...

#include <LineSegmentN.hpp>

Inheritance diagram for LineSegmentN< N, T >:
LineSegmentNBase< N, T >

Public Types

typedef LineSegmentN< N, T > LineSegmentT
 N-dimensional straight line. More...
 

Public Member Functions

template<typename U >
LineSegmentN< N, U > cast () const
 Cast the line segment to a different scalar type. More...
 
VectorT closestPoint (VectorT const &p) const
 Get the point on the line closest to a given point. More...
 
distance (VectorT const &p) const
 Get the distance of the line from a given point. More...
 
distance (LineSegmentT const &other) const
 Get the distance of this segment from another segment. More...
 
distance (LineN< N, T > const &line) const
 Get the distance of this segment from an infinite line. More...
 
distance (RayN< N, T > const &ray) const
 Get the distance of this segment from a ray. More...
 
AxisAlignedBoxN< N, T > getBounds () const
 Get a bounding box for the line segment. More...
 
VectorT const & getDirection () const
 Get the unnormalized direction vector of the segment from the first endpoint to the second. More...
 
VectorT getEndpoint (int i) const
 Get an endpoint of the line segment: 0 returns the first endpoint and 1 returns the second. More...
 
VectorT getPoint (Real t) const
 Get a point on the line segment: t = 0 maps to the first endpoint and t = 1 maps to the second. More...
 
length () const
 Get the length of the line segment. More...
 
 LineSegmentN ()
 Default constructor, does not initialize the segment. More...
 
 LineSegmentN (VectorT const &point1, VectorT const &point2)
 Construct the line segment from its endpoints. More...
 
squaredDistance (VectorT const &p) const
 Get the square of the distance of the line from a given point. More...
 
squaredDistance (LineSegmentT const &other, VectorT *this_pt=nullptr, VectorT *other_pt=nullptr) const
 Get the squared distance between this segment and another segment, and optionally return the closest pair of points. More...
 
squaredDistance (LineN< N, T > const &line, VectorT *this_pt=nullptr, VectorT *line_pt=nullptr) const
 Get the squared distance between this segment and an infinite line, and optionally return the closest pair of points. More...
 
squaredDistance (RayN< N, T > const &ray, VectorT *this_pt=nullptr, VectorT *ray_pt=nullptr) const
 Get the squared distance between this segment and a ray, and optionally return the closest pair of points. More...
 
squaredLength () const
 Get the square of the length of the line segment. More...
 
std::string toString () const
 Get a textual representation of the line segment. More...
 

Static Public Member Functions

static LineSegmentT fromPointAndDirection (VectorT const &point_, VectorT const &direction_)
 Construct the line segment from its first endpoint and its direction vector, with length equal to that of the segment. More...
 

Detailed Description

template<int N, typename T = Real>
class Thea::LineSegmentN< N, T >

A straight line in N-dimensional space, where N is any positive (non-zero) integer and T is a field.

Definition at line 27 of file LineSegmentN.hpp.

Member Typedef Documentation

typedef LineSegmentN<N, T> LineSegmentT
inherited

N-dimensional straight line.

Definition at line 48 of file LineSegmentN.hpp.

Constructor & Destructor Documentation

Default constructor, does not initialize the segment.

Definition at line 243 of file LineSegmentN.hpp.

LineSegmentN ( VectorT const &  point1,
VectorT const &  point2 
)

Construct the line segment from its endpoints.

Definition at line 246 of file LineSegmentN.hpp.

Member Function Documentation

LineSegmentN<N, U> cast ( ) const
inherited

Cast the line segment to a different scalar type.

Definition at line 73 of file LineSegmentN.hpp.

VectorT closestPoint ( VectorT const &  p) const
inherited

Get the point on the line closest to a given point.

Definition at line 106 of file LineSegmentN.hpp.

T distance ( VectorT const &  p) const
inherited

Get the distance of the line from a given point.

Definition at line 94 of file LineSegmentN.hpp.

T distance ( LineSegmentT const &  other) const
inherited

Get the distance of this segment from another segment.

Definition at line 147 of file LineSegmentN.hpp.

T distance ( LineN< N, T > const &  line) const
inherited

Get the distance of this segment from an infinite line.

Definition at line 167 of file LineSegmentN.hpp.

T distance ( RayN< N, T > const &  ray) const
inherited

Get the distance of this segment from a ray.

Definition at line 187 of file LineSegmentN.hpp.

static LineSegmentT fromPointAndDirection ( VectorT const &  point_,
VectorT const &  direction_ 
)
staticinherited

Construct the line segment from its first endpoint and its direction vector, with length equal to that of the segment.

Definition at line 64 of file LineSegmentN.hpp.

AxisAlignedBoxN<N, T> getBounds ( ) const
inherited

Get a bounding box for the line segment.

Definition at line 209 of file LineSegmentN.hpp.

VectorT const& getDirection ( ) const
inherited

Get the unnormalized direction vector of the segment from the first endpoint to the second.

Definition at line 82 of file LineSegmentN.hpp.

VectorT getEndpoint ( int  i) const
inherited

Get an endpoint of the line segment: 0 returns the first endpoint and 1 returns the second.

Definition at line 79 of file LineSegmentN.hpp.

VectorT getPoint ( Real  t) const
inherited

Get a point on the line segment: t = 0 maps to the first endpoint and t = 1 maps to the second.

Definition at line 85 of file LineSegmentN.hpp.

T length ( ) const
inherited

Get the length of the line segment.

Definition at line 88 of file LineSegmentN.hpp.

T squaredDistance ( VectorT const &  p) const
inherited

Get the square of the distance of the line from a given point.

Definition at line 100 of file LineSegmentN.hpp.

T squaredDistance ( LineSegmentT const &  other,
VectorT this_pt = nullptr,
VectorT other_pt = nullptr 
) const
inherited

Get the squared distance between this segment and another segment, and optionally return the closest pair of points.

Definition at line 153 of file LineSegmentN.hpp.

T squaredDistance ( LineN< N, T > const &  line,
VectorT this_pt = nullptr,
VectorT line_pt = nullptr 
) const
inherited

Get the squared distance between this segment and an infinite line, and optionally return the closest pair of points.

Definition at line 173 of file LineSegmentN.hpp.

T squaredDistance ( RayN< N, T > const &  ray,
VectorT this_pt = nullptr,
VectorT ray_pt = nullptr 
) const
inherited

Get the squared distance between this segment and a ray, and optionally return the closest pair of points.

Definition at line 193 of file LineSegmentN.hpp.

T squaredLength ( ) const
inherited

Get the square of the length of the line segment.

Definition at line 91 of file LineSegmentN.hpp.

std::string toString ( ) const
inherited

Get a textual representation of the line segment.

Definition at line 217 of file LineSegmentN.hpp.


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