Navigation: Up, Table of Contents, Bibliography, Index, Title Page

3D Plane (CGAL_Plane_3)

Definition

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

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

The plane splits E3 in a positive and a negative side.[^1] 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.

#include <CGAL/Plane_3.h>

Creation

CGAL_Plane_3<R> h ( R::RT a, R::RT b, R::RT c, R::RT d);
introduces a plane h defined by the equation a px + b py + c pz + d = 0.

CGAL_Plane_3<R> h ( CGAL_Point_3<R> p,
CGAL_Point_3<R> q,
CGAL_Point_3<R> r);
introduces 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.

CGAL_Plane_3<R> h ( CGAL_Point_3<R> p, CGAL_Direction_3<R> d);
introduces a plane h that passes through point p and that has as an orthogonal direction equal to d.

CGAL_Plane_3<R> h ( CGAL_Line_3<R> l, CGAL_Point_3<R> p);
introduces a plane h that is defined through the three points l.point(0), l.point(1) and p.

CGAL_Plane_3<R> h ( CGAL_Ray_3<R> r, CGAL_Point_3<R> p);
introduces a plane h that is defined through the three points r.point(0), r.point(1) and p.

CGAL_Plane_3<R> h ( CGAL_Segment_3<R> s, CGAL_Point_3<R> p);
introduces a plane h that is defined through the three points s.source(), s.target() and p.

Operations

bool h == h2 Test for equality: two planes are equal, iff they have a non empty intersection and the same orientation.
bool h != h2 Test for inequality.
R::RT h.a () returns the first coefficient of H.
R::RT h.b () returns the second coefficient of H.
R::RT h.c () returns the third coefficient of H.
R::RT h.d () returns the fourth coefficient of H.
CGAL_Line_3<R> h.perpendicular_line ( CGAL_Point_3<R> 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.
CGAL_Plane_3<R> h.opposite () returns the plane with opposite orientation.
CGAL_Point_3<R> h.projection ( CGAL_Point_3<R> p)
returns the orthogonal projection of p on h.
CGAL_Point_3<R> h.point () returns an arbitrary point on h.
CGAL_Vector_3<R> h.orthogonal_vector ()
returns a vector that is orthogonal to h and that is directed to the positive side of h.
CGAL_Direction_3<R>
h.orthogonal_direction ()
returns the direction that is orthogonal to h and that is directed to the positive side of h.
CGAL_Vector_3<R> h.base1 () returns a vector orthogonal to orthogonal_vector().
CGAL_Vector_3<R> h.base2 () returns a vector that is both orthogonal to base1(), and to orthogonal_vector(), and such that the result of CGAL_orientation( point(), point() + base1(), point()+base2(), point() + orthogonal_vector() ) is positive.

Projection

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.

CGAL_Point_2<R> h.to_2d ( CGAL_Point_3<R> 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.
CGAL_Point_3<R> h.to_3d ( CGAL_Point_2<R> p)
returns a point q, such that to_2d( to_3d( p )) is equal to p.
CGAL_Oriented_side h.oriented_side ( CGAL_Point_3<R> p)
returns either CGAL_ON_ORIENTED_BOUNDARY, or the constant CGAL_ON_POSITIVE_SIDE, or the con\-stant CGAL_ON_NEGATIVE_SIDE, determined by the position of p relative to the oriented plane h.

Predicates

For convenience we provide the following boolean functions:

bool h.has_on ( CGAL_Point_3<R> p)
bool h.has_on_boundary ( CGAL_Point_3<R> p)
bool h.has_on_positive_side ( CGAL_Point_3<R> p)
bool h.has_on_negative_side ( CGAL_Point_3<R> p)
bool h.has_on ( CGAL_Line_3<R> l)
bool h.has_on_boundary ( CGAL_Line_3<R> l)
bool h.is_degenerate () Plane h is degenerate, if the coefficients a, b, and c of the plane equation are zero.

Miscellaneous

CGAL_Plane_3<R> h.transform ( CGAL_Aff_transformation_3<R> t)
returns the plane obtained by applying t on a point of h and the orthogonal direction of h.


Footnotes

  1. See Chapter [ref:Utilities] for the definition of CGAL_Oriented_side.

Return to chapter:
3D Plane
Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The CGAL Project. Wed, January 20, 1999.