2D line between two points with intersection methods. More...
#include <line2d.h>
Public Member Functions | |
| line2d () | |
| Default constructor for line going from (0,0) to (1,1). | |
| line2d (const line2d< T > &other) | |
| Copy constructor. | |
| line2d (const vector2d< T > &start, const vector2d< T > &end) | |
| Constructor for line between the two points given as vectors. | |
| line2d (T xa, T ya, T xb, T yb) | |
| Constructor for line between the two points. | |
| f64 | getAngleWith (const line2d< T > &l) const |
| Get angle between this line and given line. | |
| vector2d< T > | getClosestPoint (const vector2d< T > &point, bool checkOnlySegments=true) const |
| Get the closest point on this line to a point. | |
| vector2df | getClosestPoint (const vector2df &point, bool checkOnlySegments) const |
| T | getLength () const |
| Get length of line. | |
| T | getLengthSQ () const |
| Get squared length of the line. | |
| vector2d< T > | getMiddle () const |
| Get middle of the line. | |
| T | getPointOrientation (const vector2d< T > &point) const |
| Tells us if the given point lies to the left, right, or on the line. | |
| vector2d< T > | getUnitVector () const |
| Get unit vector of the line. | |
| vector2d< T > | getVector () const |
| Get the vector of the line. | |
| bool | intersectWith (const line2d< T > &l, vector2d< T > &out, bool checkOnlySegments=true) const |
| Tests if this line intersects with another line. | |
| bool | isPointBetweenStartAndEnd (const vector2d< T > &point) const |
| Check if the given point is between start and end of the line. | |
| bool | isPointOnLine (const vector2d< T > &point) const |
| Check if the given point is a member of the line. | |
| bool | operator!= (const line2d< T > &other) const |
| line2d< T > | operator+ (const vector2d< T > &point) const |
| line2d< T > & | operator+= (const vector2d< T > &point) |
| line2d< T > | operator- (const vector2d< T > &point) const |
| line2d< T > & | operator-= (const vector2d< T > &point) |
| bool | operator== (const line2d< T > &other) const |
| void | setLine (const line2d< T > &line) |
| Set this line to new line given as parameter. | |
| void | setLine (const T &xa, const T &ya, const T &xb, const T &yb) |
| Set this line to new line going through the two points. | |
| void | setLine (const vector2d< T > &nstart, const vector2d< T > &nend) |
| Set this line to new line going through the two points. | |
Public Attributes | |
| vector2d< T > | end |
| End point of the line. | |
| vector2d< T > | start |
| Start point of the line. | |
2D line between two points with intersection methods.
|
inline |
Default constructor for line going from (0,0) to (1,1).
Definition at line 22 of file line2d.h.
Referenced by irr::core::line2d< f32 >::operator+(), and irr::core::line2d< f32 >::operator-().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the closest point on this line to a point.
| point | Starting search at this 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. |
|
inline |
|
inline |
Get length of line.
Definition at line 53 of file line2d.h.
Referenced by irr::core::line2d< f32 >::getUnitVector().
|
inline |
|
inline |
|
inline |
Tells us if the given point lies to the left, right, or on the line.
Definition at line 192 of file line2d.h.
Referenced by irr::core::line2d< f32 >::isPointOnLine().
|
inline |
|
inline |
Get the vector of the line.
Definition at line 68 of file line2d.h.
Referenced by irr::core::line2d< f32 >::getAngleWith().
|
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. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| vector2d<T> irr::core::line2d< T >::end |
End point of the line.
Definition at line 240 of file line2d.h.
Referenced by irr::core::line2d< f32 >::intersectWith(), irr::core::line2d< f32 >::operator!=(), irr::core::line2d< f32 >::operator==(), and irr::core::line2d< f32 >::setLine().
| vector2d<T> irr::core::line2d< T >::start |
Start point of the line.
Definition at line 238 of file line2d.h.
Referenced by irr::core::line2d< f32 >::intersectWith(), irr::core::line2d< f32 >::operator!=(), irr::core::line2d< f32 >::operator==(), and irr::core::line2d< f32 >::setLine().