The three-dimensional kernel classes are contained in a representation class. Before you can declare one of the following classes, you have to include at least one of the following two statements:
#include <CGAL/Cartesian.h>
#include <CGAL/Homogeneous.h>
CGAL provides points, vectors, and directions.
A point is a point in the three-dimensional Euclidean space
, a vector is the difference of two points ,
and denotes the direction and the distance from to in the
vector space , and a direction represents
the family of vectors that are positive multiples of each other.
Their interface is described in Chapter
.
Point_3<R>
Vector_3<R>
Direction_3<R>
Lines in CGAL are directed.
Any two points on a line induce an orientation of this line.
A ray is semi-infinite interval on a line, and this line is oriented from the
finite endpoint of this interval towards any other point in this interval.
A segment is a bounded interval on a directed line, and the endpoints are
ordered so that they induce a direction which is the same as that of the line.
Their interface is described in Chapter
.
Line_3<R>
Ray_3<R>
Segment_3<R>
Planes are affine subspaces of dimension two, passing through three points,
or a point and a line, ray, or segment.
CGAL provides a correspondence between any plane in the ambient space and the
embedding of in that space.
Their interface is described in Chapter
.
Next we introduce the simplices triangle and tetrahedron.
More complex polyhedra can be obtained from the basic library
(Polyhedron_3), so they are not part of the kernel.
The simplex interfaces are described in Chapter
.
Triangle_3<R>
Tetrahedron_3<R>
For testing where a point lies with respect to a plane defined by three points , and , one may be tempted to construct the line Plane_3<R>(q,r,s) and use the method oriented_side(p). This may pay off if many tests with respect to the plane are made. Nevertheless, unless the number type is exact, the constructed plane is only approximated, and round-off errors may lead oriented_side(p) to return an orientation which is different from the orientation of , , , and . This is the well-known problem of robustness.
In CGAL, we provide predicates in which such geometric decisions are made directly with a reference to the input points , , , , without an intermediary object like a plane. This enables to use exact predicates that are cheaper than exact number types, a concept that has been the focus of much research recently in computational geometry. For the above test, the recommended way to get the result is to use orientation(p,q,r,s).
Consequently, we propose the most common predicates in
Chapter
. They use the elementary classes of the 3D kernel.
Finally, affine transformations allow to generate new object instances under
arbitrary affine transformations. These transformations include translations,
rotations and scaling. Most of the classes above have a member function
transform(Aff_transformation t) which applies the transformation to
the object instance. The interface of the transformation class is described
in Chapter
.
CGAL also provides a set of functions that detect or compute the intersection
between two objects of the 3D kernel, see Chapter
.