Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TLineSegment.h
Go to the documentation of this file.
1#pragma once
2
3#include "Math/TVector3.h"
4
5#include <utility>
6
7namespace ph::math
8{
9
23template<typename T>
24class TLineSegment final
25{
26public:
29 TLineSegment() = default;
30
33 TLineSegment(const TVector3<T>& origin, const TVector3<T>& direction);
34
40 const TVector3<T>& origin,
41 const TVector3<T>& dir,
42 T minT,
43 T maxT);
44
51
54 void setMinT(T t);
55
58 void setMaxT(T t);
59
64 void setRange(T minT, T maxT);
65
68 void setRange(const std::pair<T, T>& minMaxT);
69
72 void setOrigin(const TVector3<T>& pos);
73
78 void setDir(const TVector3<T>& dir);
79
86 const TVector3<T>& getOrigin() const;
87 const TVector3<T>& getDir() const;
88 T getMinT() const;
89 T getMaxT() const;
90 std::pair<T, T> getRange() const;
91
94 TVector3<T> getTail() const;
95
98 TVector3<T> getHead() const;
99
102 TVector3<T> getPoint(T t) const;
103
106 T getProjectedT(const TVector3<T>& point) const;
107
110 T getFoldedT(const TVector3<T>& point) const;
111
114 T getDeltaT() const;
116
117private:
118 TVector3<T> m_origin;
119 TVector3<T> m_dir;
120 T m_minT;
121 T m_maxT;
122};
123
124}// end namespace ph::math
125
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
Math functions and utilities.
Definition TransformInfo.h:10