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

Kernel Utilities

In this chapter we introduce some basic enumeration types and constants. Furthermore, we define the class CGAL_Object, which is a generic object that can contain an object of any type. You get all the functionality described in this chapter by

#include <CGAL/basic.h>

Order types

#include <CGAL/basic.h>

In geometric algorithms we often want to know the orientation type of a sequence of d+1 points in d dimensional space. CGAL provides the following enumeration type:

enum CGAL_Sign { CGAL_NEGATIVE = -1, CGAL_ZERO, CGAL_POSITIVE};

and a

typedef CGAL_Sign CGAL_Orientation;.

For the two-dimensional space, different names are often used in the literature. Here one wants to know whether three points perform a leftturn, or a rightturn, or if they are collinear. The latter includes the case that two or even all three points have the same coordinates. Therefore, CGAL also provides

const CGAL_Orientation
CGAL_LEFTTURN = CGAL_POSITIVE;

const CGAL_Orientation
CGAL_RIGHTTURN = CGAL_NEGATIVE;

const CGAL_Orientation
CGAL_COUNTERCLOCKWISE = CGAL_POSITIVE;

const CGAL_Orientation
CGAL_CLOCKWISE = CGAL_NEGATIVE;

const CGAL_Orientation
CGAL_COPLANAR = CGAL_ZERO;

const CGAL_Orientation
CGAL_COLLINEAR = CGAL_ZERO;

const CGAL_Orientation
CGAL_DEGENERATE = CGAL_ZERO;

Relative Position

#include <CGAL/basic.h>

Geometric objects in CGAL have member functions that test the position of a point relative to the object. Full dimensional objects and their boundaries are represented by the same type, e.g. halfspaces and hyperplanes are not distinguished, neither are spheres and circles. Such objects split the ambient space into two full-dimensional parts, a bounded part and an unbounded part (e.g. circles), or two unbounded parts (e.g. hyperplanes). By default these objects are oriented, i.e., one of the resulting parts is called the positive side, the other one is called the negative side. Both of these may be unbounded.

For these objects there is a function oriented_side() that determines whether a test point is on the positive side, the negative side, or on the oriented boundary. These function returns an enumeration type

enum CGAL_Oriented_side { CGAL_ON_NEGATIVE_SIDE = -1,
CGAL_ON_ORIENTED_BOUNDARY,
CGAL_POSITIVE_SIDE};

Accordingly, has_on_negative_side(CGAL_Point_d<R>), has_on_boundary(CGAL_Point_d<R>), and has_on_positive_side(CGAL_Point_d<R>) return a boolean value, where d is 2 or 3, according to the dimension of the ambient space.

CGAL provides also:

CGAL_Oriented_side CGAL_opposite ( CGAL_Oriented_side o)
returns the opposite side (for example CGAL_ON_POSITIVE_SIDE if o==CGAL_ON_NEGATIVE_SIDE), or CGAL_ON_ORIENTED_BOUNDARY if o==CGAL_ON_ORIENTED_BOUNDARY.

Those objects that split the space in a bounded and an unbounded part, have a member function bounded_side() with the return type

enum = CGAL_Bounded_side { CGAL_ON_BOUNDED_SIDE = -1,
CGAL_ON_BOUNDARY,
CGAL_ON_UNBOUNDED_SIDE};

Accordingly, there are the two member functions has_on_bounded_side(CGAL_Point_d<R>) and has_on_unbounded_side(CGAL_Point_d<R>), which return a boolean value.

CGAL provides also:

CGAL_Bounded_side CGAL_opposite ( CGAL_Bounded_side o)
returns the opposite side (for example CGAL_BOUNDED_SIDE if o==CGAL_UNBOUNDED_SIDE), or returns CGAL_ON_BOUNDARY if o==CGAL_ON_BOUNDARY.

If an object is lower dimensional, e.g. a triangle in three-dimensional space or a segment in two-dimensional space, there is only a test whether a point belongs to the object or not. This member function, which takes a point as an argument and returns a boolean value, is called has_on().

Comparison Results

#include <CGAL/basic.h>

enum CGAL_Comparison_result { CGAL_SMALLER = -1,
CGAL_EQUAL,
CGAL_LARGER};


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