CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Math::TLineSegment< T > Struct Template Reference

Represents a line segment in three dimensional space defined by a start and an end point. More...

#include <CeresEngine/Math/Geometry.hpp>

Public Member Functions

 TLineSegment ()=default
 
 TLineSegment (const TVector3< T > &start, const TVector3< T > &end)
 
Pair< Array< TVector3< T >, 2 >, T > getNearestPoint (const TRay< T > &ray) const
 Find the nearest point on the line segment and the provided ray.
 
getLength () const
 Returns the length of the line segment.
 
TVector3< T > getCenter () const
 Returns the center point along the line segment.
 

Public Attributes

TVector3< T > start = TVector3<T>(0.0)
 
TVector3< T > end = TVector3<T>(0.0)
 

Detailed Description

template<typename T>
struct Math::TLineSegment< T >

Represents a line segment in three dimensional space defined by a start and an end point.

Constructor & Destructor Documentation

◆ TLineSegment() [1/2]

template<typename T >
Math::TLineSegment< T >::TLineSegment ( )
default

◆ TLineSegment() [2/2]

template<typename T >
Math::TLineSegment< T >::TLineSegment ( const TVector3< T > &  start,
const TVector3< T > &  end 
)
inline

Member Function Documentation

◆ getCenter()

template<typename T >
TVector3< T > Math::TLineSegment< T >::getCenter ( ) const
inline

Returns the center point along the line segment.

◆ getLength()

template<typename T >
T Math::TLineSegment< T >::getLength ( ) const
inline

Returns the length of the line segment.

◆ getNearestPoint()

template<typename T >
Pair< Array< TVector3< T >, 2 >, T > Math::TLineSegment< T >::getNearestPoint ( const TRay< T > &  ray) const

Find the nearest point on the line segment and the provided ray.

Returns
Set of nearest points and distance from the points. First nearest point is a point along the ray, while the second is along the line segment.
Note
If segment and ray are parallel the set of points at the segment origin are returned.

Member Data Documentation

◆ end

template<typename T >
TVector3<T> Math::TLineSegment< T >::end = TVector3<T>(0.0)

◆ start

template<typename T >
TVector3<T> Math::TLineSegment< T >::start = TVector3<T>(0.0)

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