CGAL::Plane_3<Kernel>

Definition

An object h of the data type Plane_3<Kernel> is an oriented plane in the three-dimensional Euclidean space 3. It is defined by the set of points with Cartesian coordinates (x,y,z) that satisfy the plane equation

h : a x + b y + c z + d = 0

The plane splits 3 in a positive and a negative side. A point p with Cartesian coordinates (px, py, pz) is on the positive side of h, iff a px + b py +c pz + d > 0. It is on the negative side, iff a px + b py +c pz + d < 0.

Creation

Plane_3<Kernel> h ( Kernel::RT a,
Kernel::RT b,
Kernel::RT c,
Kernel::RT d);
creates a plane h defined by the equation a px + b py + c pz + d = 0. Notice that h is degenerate if a = b = c.


Plane_3<Kernel> h ( Point_3<Kernel> p,
Point_3<Kernel> q,
Point_3<Kernel> r);
creates a plane h passing through the points p, q and r. The plane is oriented such that p, q and r are oriented in a positive sense (that is counterclockwise) when seen from the positive side of h. Notice that h is degenerate if the points are collinear.


Plane_3<Kernel> h ( Point_3<Kernel> p, Vector_3<Kernel> v);
introduces a plane h that passes through point p and that is orthogonal to v.


Plane_3<Kernel> h ( Point_3<Kernel> p, Direction_3<Kernel> d);
introduces a plane h that passes through point p and that has as an orthogonal direction equal to d.


Plane_3<Kernel> h ( Line_3<Kernel> l, Point_3<Kernel> p);
introduces a plane h that is defined through the three points l.point(0), l.point(1) and p.


Plane_3<Kernel> h ( Ray_3<Kernel> r, Point_3<Kernel> p);
introduces a plane h that is defined through the three points r.point(0), r.point(1) and p.


Plane_3<Kernel> h ( Segment_3<Kernel> s, Point_3<Kernel> p);
introduces a plane h that is defined through the three points s.source(), s.target() and p.

Operations

bool h.operator== ( h2)
Test for equality: two planes are equal, iff they have a non empty intersection and the same orientation.

bool h.operator!= ( h2)
Test for inequality.

Kernel::RT h.a () returns the first coefficient of h.
Kernel::RT h.b () returns the second coefficient of h.
Kernel::RT h.c () returns the third coefficient of h.
Kernel::RT h.d () returns the fourth coefficient of h.

Line_3<Kernel> h.perpendicular_line ( Point_3<Kernel> p)
returns the line that is perpendicular to h and that passes through point p. The line is oriented from the negative to the positive side of h.

Point_3<Kernel> h.projection ( Point_3<Kernel> p)
returns the orthogonal projection of p on h.

Plane_3<Kernel> h.opposite () returns the plane with opposite orientation.

Point_3<Kernel> h.point () returns an arbitrary point on h.

Vector_3<Kernel> h.orthogonal_vector ()
returns a vector that is orthogonal to h and that is directed to the positive side of h.

Direction_3<Kernel>
h.orthogonal_direction ()
returns the direction that is orthogonal to h and that is directed to the positive side of h.

Vector_3<Kernel> h.base1 () returns a vector orthogonal to orthogonal_vector().

Vector_3<Kernel> h.base2 () returns a vector that is both orthogonal to base1(), and to orthogonal_vector(), and such that the result of orientation( point(), point() + base1(), point()+base2(), point() + orthogonal_vector() ) is positive.

2D Conversion

The following functions provide conversion between a plane and CGAL's two-dimensional space. The transformation is affine, but not necessarily an isometry. This means, the transformation preserves combinatorics, but not distances.

Point_2<Kernel> h.to_2d ( Point_3<Kernel> p)
returns the image point of the projection of p under an affine transformation, which maps h onto the xy-plane, with the z-coordinate removed.

Point_3<Kernel> h.to_3d ( Point_2<Kernel> p)
returns a point q, such that to_2d( to_3d( p )) is equal to p.

Predicates

Oriented_side h.oriented_side ( Point_3<Kernel> p)
returns either ON_ORIENTED_BOUNDARY, or the constant ON_POSITIVE_SIDE, or the constant ON_NEGATIVE_SIDE, determined by the position of p relative to the oriented plane h.

For convenience we provide the following boolean functions:

bool h.has_on ( Point_3<Kernel> p)
bool h.has_on_positive_side ( Point_3<Kernel> p)
bool h.has_on_negative_side ( Point_3<Kernel> p)

bool h.has_on ( Line_3<Kernel> l)

bool h.is_degenerate () Plane h is degenerate, if the coefficients a, b, and c of the plane equation are zero.

Miscellaneous

Plane_3<Kernel> h.transform ( Aff_transformation_3<Kernel> t)
returns the plane obtained by applying t on a point of h and the orthogonal direction of h.

See Also

Kernel::Plane_3