24 #include <geometry/line_segment.h>
108 HomVector direction = (m_p2 - m_p1).unit();
109 float factor = direction * (p - m_p1);
114 return m_p1 + (direction * factor);
132 stream <<
"P1: " << m_p1 <<
" P2: " << m_p2;
const HomPoint & p1() const
Get the starting point.
Fawkes library namespace.
LineSegment(const HomPoint &a, const HomPoint &b)
Constructor.
float length() const
Get the length of the line segment.
const HomPoint & p2() const
Get the endpoint.
virtual void post_transform()
This method is called after the primitives are transformed.
float length() const
Calculates the length of the vector.
virtual void register_primitives()
Here, a derived class should register its primitives (HomPoints and HomVectors) by calling add_primit...
virtual ~LineSegment()
Destructor.
virtual std::ostream & print(std::ostream &stream) const
This method is called by the overloaded <<-operator.
HomPoint project(const HomPoint &p) const
Project a point on this LineSegment.