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

Elementary 3D objects

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 E3, a vector is the difference of two points p3, p1 and denotes the direction and the distance from p1 to p3 in the vector space R3, and a direction represents

the family of vectors that are positive multiples of each other. Their interface is described in Chapter reference arrow.

CGAL_Point_3<R>
CGAL_Vector_3<R>
CGAL_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 reference arrow.

CGAL_Line_3<R>
CGAL_Ray_3<R>
CGAL_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 E3 and the embedding of E2 in that space. Their interface is described in Chapter reference arrow.

CGAL_Plane_3<R>

Next we introduce the simplices triangle and tetrahedron. More complex polyhedra can be obtained from the basic library ( CGAL_Polyhedron_3), so they are not part of the kernel. The simplex interfaces are described in Chapter reference arrow.

CGAL_Triangle_3<R>
CGAL_Tetrahedron_3<R>

Predicates and functions

For testing where a point p lies with respect to a plane defined by three points q, r and s, one may be tempted to construct the line CGAL_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 p, q, r, and s. 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 p, q, r, s, 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 CGAL_orientation(p,q,r,s).

Consequently, we propose the most common predicates in Chapter reference arrow. 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(CGAL_Aff_transformation t) which applies the transformation to the object instance. The interface of the transformation class is described in Chapter reference arrow.

CGAL_Aff_transformation_3<R>

CGAL also provides a set of functions that detect or compute the intersection between two objects of the 3D kernel, see Chapter reference arrow.


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