Ocular Engine
|
#include <LineSegment2D.hpp>
Public Member Functions | |
LineSegment2D (Vector2< T > const &a, Vector2< T > const &b) | |
Vector2< T > const & | getA () const |
Vector2< T > const & | getB () const |
void | setA (Vector2< T > const &a) |
void | setB (Vector2< T > const &b) |
T const & | getLength () const |
T const & | getLengthSquared () const |
LineSegmentSide | whichSide (Vector2< T > const &point) const |
T | distanceTo (Vector2< T > const &point) const |
Protected Member Functions | |
void | updateLength () |
A 2D line segment composed of two endpoints: A and B.
|
inline |
Creates a new line segment with the given end points.
[in] | a | |
[in] | b |
|
inline |
Calculates the minimum distance from the point to the line segment. This distance is in relation whichever point on the segment is closest to the point.
[in] | point |
|
inline |
Returns the length of the line segment.
|
inline |
Returns the squared length of the line segment.
|
inline |
Calculates which side of the line segment the point lies.
This can be visualized as standing on A and looking torwards B.
If the return value is -1, then the point is to the right of the line. If the return value is +1, then the point is to the left of the line. If the reutrn value is 0, then the point is on the line.
[in] | point |