5#include <Common/assertion.h>
19 std::numeric_limits<T>::max())
37 m_dir.mulLocal(T(-1));
57 PH_ASSERT_LE(minT, maxT);
66 setRange(minMaxT.first, minMaxT.second);
108 return {m_minT, m_maxT};
114 return m_dir * m_minT + m_origin;
120 return m_dir * m_maxT + m_origin;
126 return m_origin.
add(m_dir.mul(t));
133 return pointVec.
dot(m_dir) / m_dir.lengthSquared();
140 return std::sqrt(pointVec.
lengthSquared() / m_dir.lengthSquared());
146 return m_maxT - m_minT;
Represents a line segment in space.
Definition TLineSegment.h:25
void setMinT(T t)
Set the parametric distance where the segment starts.
Definition TLineSegment.ipp:43
TVector3< T > getHead() const
Get the coordinates on maximum parametric distance.
Definition TLineSegment.ipp:118
void setMaxT(T t)
Set the parametric distance where the segment ends.
Definition TLineSegment.ipp:49
T getMinT() const
Definition TLineSegment.ipp:94
void setOrigin(const TVector3< T > &pos)
Set the origin of the line.
Definition TLineSegment.ipp:70
const TVector3< T > & getOrigin() const
Definition TLineSegment.ipp:82
const TVector3< T > & getDir() const
Definition TLineSegment.ipp:88
void setDir(const TVector3< T > &dir)
Set the direction vector of the line.
Definition TLineSegment.ipp:76
TVector3< T > getPoint(T t) const
Get the coordinates referred to by the parametric distance t.
Definition TLineSegment.ipp:124
TLineSegment()=default
A line which state is unspecified.
T getMaxT() const
Definition TLineSegment.ipp:100
TVector3< T > getTail() const
Get the coordinates on minimum parametric distance.
Definition TLineSegment.ipp:112
T getDeltaT() const
Get the length of line in terms of parametric distance.
Definition TLineSegment.ipp:144
std::pair< T, T > getRange() const
Definition TLineSegment.ipp:106
void setRange(T minT, T maxT)
Set the parametric range where the segment extends. The range is [minT, maxT). This is equivalent to ...
Definition TLineSegment.ipp:55
TLineSegment & flip()
Point the line in opposite direction.
Definition TLineSegment.ipp:35
T getFoldedT(const TVector3< T > &point) const
Get the parametric distance of a point when it is rotated to the line.
Definition TLineSegment.ipp:137
T getProjectedT(const TVector3< T > &point) const
Get the parametric distance of a point when it is projected on the line.
Definition TLineSegment.ipp:130
Represents a 3-D vector.
Definition TVector3.h:17
T dot(const Derived &rhs) const
Definition TVectorNBase.ipp:14
T lengthSquared() const
Definition TVectorNBase.ipp:44
Derived add(const Derived &rhs) const
Definition TArithmeticArrayBase.ipp:26
Math functions and utilities.
Definition TransformInfo.h:10