Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::math::TLineSegment< T > Class Template Referencefinal

Represents a line segment in space. More...

#include <TLineSegment.h>

Public Member Functions

 TLineSegment ()=default
 A line which state is unspecified.
 
 TLineSegment (const TVector3< T > &origin, const TVector3< T > &direction)
 A line extending form origin to the furthest point possible along direction.
 
 TLineSegment (const TVector3< T > &origin, const TVector3< T > &dir, T minT, T maxT)
 A line that covers the parametric range [minT, maxT).
 
TLineSegmentflip ()
 Point the line in opposite direction.
 
void setMinT (T t)
 Set the parametric distance where the segment starts.
 
void setMaxT (T t)
 Set the parametric distance where the segment ends.
 
void setRange (T minT, T maxT)
 Set the parametric range where the segment extends. The range is [minT, maxT). This is equivalent to calling setMinT(T) and setMaxT(T) together.
 
void setRange (const std::pair< T, T > &minMaxT)
 Same as setRange(T,T).
 
void setOrigin (const TVector3< T > &pos)
 Set the origin of the line.
 
void setDir (const TVector3< T > &dir)
 Set the direction vector of the line.
 
Getters

Basic getters for line attributes. See corresponding setters (if present) for more info.

const TVector3< T > & getOrigin () const
 
const TVector3< T > & getDir () const
 
getMinT () const
 
getMaxT () const
 
std::pair< T, T > getRange () const
 
TVector3< T > getTail () const
 Get the coordinates on minimum parametric distance.
 
TVector3< T > getHead () const
 Get the coordinates on maximum parametric distance.
 
TVector3< T > getPoint (T t) const
 Get the coordinates referred to by the parametric distance t.
 
getProjectedT (const TVector3< T > &point) const
 Get the parametric distance of a point when it is projected on the line.
 
getFoldedT (const TVector3< T > &point) const
 Get the parametric distance of a point when it is rotated to the line.
 
getDeltaT () const
 Get the length of line in terms of parametric distance.
 

Detailed Description

template<typename T>
class ph::math::TLineSegment< T >

Represents a line segment in space.

Points \( \overrightarrow{P} \) on a line are modeled using the equation

\[ \overrightarrow{P} = \overrightarrow{O} + t\overrightarrow{D} \]

where \( \overrightarrow{O} \) is the line origin and \( \overrightarrow{D} \) is the line direction, and \( t \) is a parameter in \( [t_{min}, t_{max}) \). Note the direction vector of the line does not need to be normalized.

Constructor & Destructor Documentation

◆ TLineSegment() [1/3]

template<typename T >
ph::math::TLineSegment< T >::TLineSegment ( )
default

A line which state is unspecified.

◆ TLineSegment() [2/3]

template<typename T >
ph::math::TLineSegment< T >::TLineSegment ( const TVector3< T > & origin,
const TVector3< T > & direction )
inline

A line extending form origin to the furthest point possible along direction.

◆ TLineSegment() [3/3]

template<typename T >
ph::math::TLineSegment< T >::TLineSegment ( const TVector3< T > & origin,
const TVector3< T > & dir,
T minT,
T maxT )
inline

A line that covers the parametric range [minT, maxT).

Parameters
dirLine direction. Does not need to be normalized.

Member Function Documentation

◆ flip()

template<typename T >
TLineSegment< T > & ph::math::TLineSegment< T >::flip ( )
inline

Point the line in opposite direction.

This method essentially mirrored the line with respect to its origin, with other attributes remain the same.

◆ getDeltaT()

template<typename T >
T ph::math::TLineSegment< T >::getDeltaT ( ) const
inline

Get the length of line in terms of parametric distance.

◆ getDir()

template<typename T >
const TVector3< T > & ph::math::TLineSegment< T >::getDir ( ) const
inline

◆ getFoldedT()

template<typename T >
T ph::math::TLineSegment< T >::getFoldedT ( const TVector3< T > & point) const
inline

Get the parametric distance of a point when it is rotated to the line.

◆ getHead()

template<typename T >
TVector3< T > ph::math::TLineSegment< T >::getHead ( ) const
inline

Get the coordinates on maximum parametric distance.

◆ getMaxT()

template<typename T >
T ph::math::TLineSegment< T >::getMaxT ( ) const
inline

◆ getMinT()

template<typename T >
T ph::math::TLineSegment< T >::getMinT ( ) const
inline

◆ getOrigin()

template<typename T >
const TVector3< T > & ph::math::TLineSegment< T >::getOrigin ( ) const
inline

◆ getPoint()

template<typename T >
TVector3< T > ph::math::TLineSegment< T >::getPoint ( T t) const
inline

Get the coordinates referred to by the parametric distance t.

◆ getProjectedT()

template<typename T >
T ph::math::TLineSegment< T >::getProjectedT ( const TVector3< T > & point) const
inline

Get the parametric distance of a point when it is projected on the line.

◆ getRange()

template<typename T >
std::pair< T, T > ph::math::TLineSegment< T >::getRange ( ) const
inline

◆ getTail()

template<typename T >
TVector3< T > ph::math::TLineSegment< T >::getTail ( ) const
inline

Get the coordinates on minimum parametric distance.

◆ setDir()

template<typename T >
void ph::math::TLineSegment< T >::setDir ( const TVector3< T > & dir)
inline

Set the direction vector of the line.

Note that the vector does not need to be normalized.

◆ setMaxT()

template<typename T >
void ph::math::TLineSegment< T >::setMaxT ( T t)
inline

Set the parametric distance where the segment ends.

◆ setMinT()

template<typename T >
void ph::math::TLineSegment< T >::setMinT ( T t)
inline

Set the parametric distance where the segment starts.

◆ setOrigin()

template<typename T >
void ph::math::TLineSegment< T >::setOrigin ( const TVector3< T > & pos)
inline

Set the origin of the line.

◆ setRange() [1/2]

template<typename T >
void ph::math::TLineSegment< T >::setRange ( const std::pair< T, T > & minMaxT)
inline

Same as setRange(T,T).

◆ setRange() [2/2]

template<typename T >
void ph::math::TLineSegment< T >::setRange ( T minT,
T maxT )
inline

Set the parametric range where the segment extends. The range is [minT, maxT). This is equivalent to calling setMinT(T) and setMaxT(T) together.


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