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

Requirements of Traits Classes for 2D Smallest Enclosing Circle

The class template Min_circle_2 is parameterized with a Traits class which defines the abstract interface between the optimisation algorithm and the primitives it uses. The following requirements catalog lists the primitives, i.e. types, member functions etc., that must be defined for a class that can be used to parameterize Min_circle_2. A traits class implementation using the 2D CGAL-kernel is available and described in Section reference. In addition, we provide traits class adapters to user supplied point classes, see Sections reference and reference. Both, the implementation and the adapters, can be used as a starting point for customizing own traits classes, e.g. through derivation and specialization.

Traits Class (Traits)

Definition

A class that satisfies the requirements of a traits class for Min_circle_2 must provide the following primitives.

Types

Traits::Point
The point type must provide default and copy constructor, assignment and equality test.


Traits::Circle
The circle type must fulfill the requirements listed below in the next section.

In addition, if I/O is used, the corresponding I/O operators for Point and Circle have to be provided, see topic I/O in Section reference.

Variables

Circle circle; The actual circle. This variable is maintained by the algorithm, the user should neither access nor modify it directly.

Creation

Only default and copy constructor are required. Note that further constructors can be provided.

Traits traits;
A default constructor.


Traits traits ( Traits);
A copy constructor.

Operations

The following predicate is only needed, if the member function is_valid of Min_circle_2 is used.

Orientation traits.orientation ( Point p, Point q, Point r)
returns constants LEFTTURN, COLLINEAR, or RIGHTTURN iff r lies properly to the left of, on, or properly to the right of the oriented line through p and q, resp.

Circle Type (Circle)

Definition

An object of the class Circle is a circle in two-dimensional Euclidean plane 2. Its boundary splits the plane into a bounded and an unbounded side. By definition, an empty Circle has no boundary and no bounded side, i.e. its unbounded side equals the whole plane 2. A Circle containing exactly one point p has no bounded side, its boundary is {p}, and its unbounded side equals 2-{p}.

Types

Circle::Point
Point type.

The following type is only needed, if the member function is_valid of Min_circle_2 is used.

Circle::Distance
Distance type. The function squared_radius (see below) returns an object of this type.

Creation

void circle.set () sets circle to the empty circle.

void circle.set ( Point p)
sets circle to the circle containing exactly {p}.

void circle.set ( Point p, Point q)
sets circle to the circle with diameter equal to the segment connecting p and q. The algorithm guarantees that set is never called with two equal points.

void circle.set ( Point p, Point q, Point r)
sets circle to the circle through p,q,r. The algorithm guarantees that set is never called with three collinear points.

Predicates

bool circle.has_on_unbounded_side ( Point p)
returns true, iff p lies properly outside of circle.

Each of the following predicates is only needed, if the corresponding predicate of Min_circle_2 is used.

Bounded_side circle.bounded_side ( Point p)
returns ON_BOUNDED_SIDE, ON_BOUNDARY, or ON_UNBOUNDED_SIDE iff p lies properly inside, on the boundary, or properly outside of circle, resp.

bool circle.has_on_bounded_side ( Point p)
returns true, iff p lies properly inside circle.

bool circle.has_on_boundary ( Point p)
returns true, iff p lies on the boundary of circle.

bool circle.is_empty () returns true, iff circle is empty (this implies degeneracy).

bool circle.is_degenerate ()
returns true, iff circle is degenerate, i.e. if circle is empty or equal to a single point.

Additional Operations for Checking

The following operations are only needed, if the member function is_valid of Min_circle_2 is used.

bool circle == circle2 returns true, iff circle and circle2 are equal.

Point circle.center () returns the center of circle.

Distance circle.squared_radius ()
returns the squared radius of circle.

I/O

The following I/O operators are only needed, if the corresponding I/O operators of Min_circle_2 are used.

ostream& ostream& os << circle
writes circle to output stream os.

Window_stream& Window_stream& ws << circle
writes circle to window stream ws.


Next: Class declaration of Min_ellipse_2<Traits>
Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The GALIA project. Jan 18, 2000.