2D line between two points with intersection methods. More...
#include <line2d.h>
2D line between two points with intersection methods.
irr::core::line2d< T >::line2d | ( | ) | [inline] |
irr::core::line2d< T >::line2d | ( | T | xa, |
T | ya, | ||
T | xb, | ||
T | yb | ||
) | [inline] |
irr::core::line2d< T >::line2d | ( | const vector2d< T > & | start, |
const vector2d< T > & | end | ||
) | [inline] |
irr::core::line2d< T >::line2d | ( | const line2d< T > & | other | ) | [inline] |
f64 irr::core::line2d< T >::getAngleWith | ( | const line2d< T > & | l | ) | const [inline] |
Get angle between this line and given line.
l | Other line for test. |
Definition at line 182 of file line2d.h.
References irr::core::vector2d< T >::getAngleWith(), and irr::core::line2d< T >::getVector().
vector2d<T> irr::core::line2d< T >::getClosestPoint | ( | const vector2d< T > & | point, |
bool | checkOnlySegments = true |
||
) | const [inline] |
Get the closest point on this line to a point.
checkOnlySegments,: | Default (true) is to return a point on the line-segment (between begin and end) of the line. When set to false the function will check for the first the closest point on the the line even when outside the segment. |
Definition at line 216 of file line2d.h.
References irr::core::vector2d< T >::dotProduct(), irr::core::line2d< T >::end, irr::core::vector2d< T >::getLength(), irr::core::line2d< T >::start, irr::core::vector2d< T >::X, and irr::core::vector2d< T >::Y.
vector2df irr::core::line2d< irr::f32 >::getClosestPoint | ( | const vector2df & | point, |
bool | checkOnlySegments | ||
) | const [inline] |
Definition at line 244 of file line2d.h.
References irr::core::vector2d< T >::dotProduct(), and irr::core::vector2d< T >::getLength().
T irr::core::line2d< T >::getLength | ( | ) | const [inline] |
Get length of line.
Definition at line 53 of file line2d.h.
References irr::core::line2d< T >::end, and irr::core::line2d< T >::start.
Referenced by irr::core::line2d< T >::getUnitVector().
T irr::core::line2d< T >::getLengthSQ | ( | ) | const [inline] |
Get squared length of the line.
Definition at line 57 of file line2d.h.
References irr::core::line2d< T >::end, and irr::core::line2d< T >::start.
vector2d<T> irr::core::line2d< T >::getMiddle | ( | ) | const [inline] |
Get middle of the line.
Definition at line 61 of file line2d.h.
References irr::core::line2d< T >::end, and irr::core::line2d< T >::start.
T irr::core::line2d< T >::getPointOrientation | ( | const vector2d< T > & | point | ) | const [inline] |
Tells us if the given point lies to the left, right, or on the line.
Definition at line 192 of file line2d.h.
References irr::core::line2d< T >::end, irr::core::line2d< T >::start, irr::core::vector2d< T >::X, and irr::core::vector2d< T >::Y.
Referenced by irr::core::line2d< T >::isPointOnLine().
vector2d<T> irr::core::line2d< T >::getUnitVector | ( | ) | const [inline] |
Get unit vector of the line.
Definition at line 173 of file line2d.h.
References irr::core::line2d< T >::end, irr::core::line2d< T >::getLength(), and irr::core::line2d< T >::start.
vector2d<T> irr::core::line2d< T >::getVector | ( | ) | const [inline] |
Get the vector of the line.
Definition at line 68 of file line2d.h.
References irr::core::line2d< T >::end, and irr::core::line2d< T >::start.
Referenced by irr::core::line2d< T >::getAngleWith().
bool irr::core::line2d< T >::intersectWith | ( | const line2d< T > & | l, |
vector2d< T > & | out, | ||
bool | checkOnlySegments = true |
||
) | const [inline] |
Tests if this line intersects with another line.
l,: | Other line to test intersection with. |
checkOnlySegments,: | Default is to check intersection between the begin and endpoints. When set to false the function will check for the first intersection point when extending the lines. |
out,: | If there is an intersection, the location of the intersection will be stored in this vector. |
Definition at line 77 of file line2d.h.
References irr::core::line2d< T >::end, irr::core::equals(), irr::core::line2d< T >::start, irr::core::vector2d< T >::X, and irr::core::vector2d< T >::Y.
bool irr::core::line2d< T >::isPointBetweenStartAndEnd | ( | const vector2d< T > & | point | ) | const [inline] |
Check if the given point is between start and end of the line.
Assumes that the point is already somewhere on the line.
Definition at line 208 of file line2d.h.
References irr::core::line2d< T >::end, irr::core::vector2d< T >::isBetweenPoints(), and irr::core::line2d< T >::start.
bool irr::core::line2d< T >::isPointOnLine | ( | const vector2d< T > & | point | ) | const [inline] |
Check if the given point is a member of the line.
Definition at line 200 of file line2d.h.
References irr::core::line2d< T >::end, irr::core::line2d< T >::getPointOrientation(), irr::core::vector2d< T >::isBetweenPoints(), and irr::core::line2d< T >::start.
bool irr::core::line2d< T >::operator!= | ( | const line2d< T > & | other | ) | const [inline] |
Definition at line 40 of file line2d.h.
References irr::core::line2d< T >::end, and irr::core::line2d< T >::start.
line2d<T> irr::core::line2d< T >::operator+ | ( | const vector2d< T > & | point | ) | const [inline] |
Definition at line 32 of file line2d.h.
References irr::core::line2d< T >::end, and irr::core::line2d< T >::start.
line2d<T>& irr::core::line2d< T >::operator+= | ( | const vector2d< T > & | point | ) | [inline] |
Definition at line 33 of file line2d.h.
References irr::core::line2d< T >::end, and irr::core::line2d< T >::start.
line2d<T> irr::core::line2d< T >::operator- | ( | const vector2d< T > & | point | ) | const [inline] |
Definition at line 35 of file line2d.h.
References irr::core::line2d< T >::end, and irr::core::line2d< T >::start.
line2d<T>& irr::core::line2d< T >::operator-= | ( | const vector2d< T > & | point | ) | [inline] |
Definition at line 36 of file line2d.h.
References irr::core::line2d< T >::end, and irr::core::line2d< T >::start.
bool irr::core::line2d< T >::operator== | ( | const line2d< T > & | other | ) | const [inline] |
Definition at line 38 of file line2d.h.
References irr::core::line2d< T >::end, and irr::core::line2d< T >::start.
void irr::core::line2d< T >::setLine | ( | const T & | xa, |
const T & | ya, | ||
const T & | xb, | ||
const T & | yb | ||
) | [inline] |
Set this line to new line going through the two points.
Definition at line 45 of file line2d.h.
References irr::core::line2d< T >::end, and irr::core::line2d< T >::start.
void irr::core::line2d< T >::setLine | ( | const vector2d< T > & | nstart, |
const vector2d< T > & | nend | ||
) | [inline] |
Set this line to new line going through the two points.
Definition at line 47 of file line2d.h.
References irr::core::line2d< T >::end, and irr::core::line2d< T >::start.
void irr::core::line2d< T >::setLine | ( | const line2d< T > & | line | ) | [inline] |
Set this line to new line given as parameter.
Definition at line 49 of file line2d.h.
References irr::core::line2d< T >::end, and irr::core::line2d< T >::start.
vector2d<T> irr::core::line2d< T >::end |
End point of the line.
Definition at line 239 of file line2d.h.
Referenced by irr::core::line2d< T >::getClosestPoint(), irr::core::line2d< T >::getLength(), irr::core::line2d< T >::getLengthSQ(), irr::core::line2d< T >::getMiddle(), irr::core::line2d< T >::getPointOrientation(), irr::core::line2d< T >::getUnitVector(), irr::core::line2d< T >::getVector(), irr::core::line2d< T >::intersectWith(), irr::core::line2d< T >::isPointBetweenStartAndEnd(), irr::core::line2d< T >::isPointOnLine(), irr::core::line2d< T >::operator!=(), irr::core::line2d< T >::operator+(), irr::core::line2d< T >::operator+=(), irr::core::line2d< T >::operator-(), irr::core::line2d< T >::operator-=(), irr::core::line2d< T >::operator==(), and irr::core::line2d< T >::setLine().
vector2d<T> irr::core::line2d< T >::start |
Start point of the line.
Definition at line 237 of file line2d.h.
Referenced by irr::core::line2d< T >::getClosestPoint(), irr::core::line2d< T >::getLength(), irr::core::line2d< T >::getLengthSQ(), irr::core::line2d< T >::getMiddle(), irr::core::line2d< T >::getPointOrientation(), irr::core::line2d< T >::getUnitVector(), irr::core::line2d< T >::getVector(), irr::core::line2d< T >::intersectWith(), irr::core::line2d< T >::isPointBetweenStartAndEnd(), irr::core::line2d< T >::isPointOnLine(), irr::core::line2d< T >::operator!=(), irr::core::line2d< T >::operator+(), irr::core::line2d< T >::operator+=(), irr::core::line2d< T >::operator-(), irr::core::line2d< T >::operator-=(), irr::core::line2d< T >::operator==(), and irr::core::line2d< T >::setLine().