Core 1.0
|
Lines in the plane. More...
#include <segment.h>
Public Member Functions | |
Line2 () | |
Direction. | |
Line2 (const Vector2 &, const Vector2 &) | |
Creates a line in the plane. | |
Line2 (const Segment2 &) | |
Creates a line from a segment. | |
Vector2 | Point () const |
Return one of the vertices of the line. | |
Vector2 | Direction () const |
Return the direction of the line. | |
bool | Intersection (const Line2 &, Vector2 &) const |
Compute the intersection between two lines. | |
bool | Intersection (const Segment2 &, Vector2 &) const |
Compute the intersection between a line and a segment. | |
Vector2 | Symmetry (const Vector2 &) const |
Compute the point symmetric to the line. | |
Box2 | Symmetry (const Box2 &) const |
Compute the box bounding the box symmetric to the line. | |
Circle2 | Symmetry (const Circle2 &) const |
Compute the circle symmetric to the line. | |
void | Translate (const Vector2 &) |
Translation. | |
double | R (const Vector2 &) const |
Compute the squared distance to the line. | |
bool | IsLeftOrOn (const Vector2 &, const double &=0.0) const |
Compute the position of a point with respect to a line. | |
bool | IsRightOrOn (const Vector2 &, const double &=0.0) const |
Compute the position of a point with respect to a line. | |
Static Public Attributes | |
static const Line2 | X |
Horizontal. | |
static const Line2 | Y |
Vertical. | |
Protected Attributes | |
Vector2 | n = Vector2::X |
Vertex. | |
Lines in the plane.
Lines implicitly define half spaces in the plane. The corresponding positive half-space is in the direction orthogonal to the direction of the line.
|
inline |
Direction.
Empty
Creates a line in the plane.
o | Origin. |
d | Direction. |
|
explicit |
Creates a line from a segment.
s | Segment. |
Compute the intersection between two lines.
Note that the algorithm is the same as for segments, except that the range of the intersection parameters is not checked.
l | Other line. |
p | Intersection point. |
Compute the intersection between a line and a segment.
Note that the algorithm is the same as for segments, except that the range of the intersection parameters is checked only for the segment.
e | Segment. |
p | Intersection point. |
bool Line2::IsLeftOrOn | ( | const Vector2 & | p, |
const double & | epsilon = 0.0 ) const |
Compute the position of a point with respect to a line.
p | Point |
epsilon | Precision. |
bool Line2::IsRightOrOn | ( | const Vector2 & | p, |
const double & | epsilon = 0.0 ) const |
Compute the position of a point with respect to a line.
p | Point |
epsilon | Precision. |
double Line2::R | ( | const Vector2 & | p | ) | const |
Compute the squared distance to the line.
p | Point. |
Compute the box bounding the box symmetric to the line.
box | The box. |
Compute the circle symmetric to the line.
c | Circle. |
Compute the point symmetric to the line.
p | Point. |
void Line2::Translate | ( | const Vector2 & | t | ) |
Translation.
t | Translation vector. |