The line splits 2 in a positive and a negative side. A point p with Cartesian coordinates (px, py) is on the positive side of l, iff a px + b py +c > 0, it is on the negative side of l, iff a px + b py +c < 0. The positive side is to the left of l.
Line_2<Kernel> l ( Kernel::RT a, Kernel::RT b, Kernel::RT c); | |
introduces a line l with the line equation in
Cartesian
coordinates ax +by +c = 0.
| |
Line_2<Kernel> l ( Point_2<Kernel> p, Point_2<Kernel> q); | |
introduces a line l passing through the points p and q.
Line l is directed from p to q.
| |
Line_2<Kernel> l ( Point_2<Kernel> p, Direction_2<Kernel> d); | |
introduces a line l passing through point p with
direction d.
| |
Line_2<Kernel> l ( Point_2<Kernel> p, Vector_2<Kernel> v); | |
introduces a line l passing through point p and
oriented by v.
| |
Line_2<Kernel> l ( Segment_2<Kernel> s); | |
introduces a line l supporting the segment s,
oriented from source to target.
| |
Line_2<Kernel> l ( Ray_2<Kernel> r); | |
introduces a line l supporting the ray r,
with same orientation.
|
bool | l.operator== ( h) const | Test for equality: two lines are equal, iff they have a non empty intersection and the same direction. | ||
bool | l.operator!= ( h) const | Test for inequality. | ||
Kernel::RT | l.a () const | returns the first coefficient of l. | ||
Kernel::RT | l.b () const | returns the second coefficient of l. | ||
Kernel::RT | l.c () const | returns the third coefficient of l. | ||
Point_2<Kernel> | l.point ( int i) const | returns an arbitrary point on l. It holds point(i) == point(j), iff i==j. Furthermore, l is directed from point(i) to point(j), for all i < j. | ||
Point_2<Kernel> | l.projection ( Point_2<Kernel> p) const | |||
returns the orthogonal projection of p onto l. | ||||
Kernel::FT | l.x_at_y ( Kernel::FT y) const |
returns the x-coordinate of the point at l with
given y-coordinate.
| ||
Kernel::FT | l.y_at_x ( Kernel::FT x) const |
returns the y-coordinate of the point at l with
given x-coordinate.
|
bool | l.is_degenerate () const | line l is degenerate, if the coefficients a and b of the line equation are zero. |
bool | l.is_horizontal () const | |
bool | l.is_vertical () const | |
Oriented_side | l.oriented_side ( Point_2<Kernel> p) const | |
returns ON_ORIENTED_BOUNDARY, ON_NEGATIVE_SIDE, or the constant ON_POSITIVE_SIDE, depending on the position of p relative to the oriented line l. |
For convenience we provide the following Boolean functions:
bool | l.has_on ( Point_2<Kernel> p) const | |
bool | l.has_on_positive_side ( Point_2<Kernel> p) const | |
bool | l.has_on_negative_side ( Point_2<Kernel> p) const |
Vector_2<Kernel> | l.to_vector () const | returns a vector having the direction of l. |
Direction_2<Kernel> | l.direction () const | returns the direction of l. |
Line_2<Kernel> | l.opposite () const | returns the line with opposite direction. |
Line_2<Kernel> | l.perpendicular ( Point_2<Kernel> p) const | |
returns the line perpendicular to l and passing through p, where the direction is the direction of l rotated counterclockwise by 90 degrees. | ||
Line_2<Kernel> | l.transform ( Aff_transformation_2<Kernel> t) const | |
returns the line obtained by applying t on a point on l and the direction of l. |
Point_2< Cartesian<double> > p(1.0,1.0), q(4.0,7.0);
To define a line l we write:
Line_2< Cartesian<double> > l(p,q);