CGAL::Arr_circle_segment_traits_2<Kernel>

Definition

The class Arr_circle_segment_traits_2<Kernel> is a model of the ArrangementTraits_2 concept and can be used to construct and maintain arrangements of circular arcs and line segments.

The traits class must be instantiated with a geometric kernel, such that the supporting circles of the circular arcs are of type Kernel::Circle_2 and the supporting lines of the line segments are of type Kernel::Line_2. Thus, the coordinates of the center of supporting circles, and its squared radius are of type Kernel::FT, which should be an exact rational number-type; similarly, the coefficients of each supporting line ax + by + c = 0 are also of type Kernel::FT. Note however that the intersection point between two such arcs do not have rational coordinates in general. For this reason, we do not require the endpoints of the input arcs and segments to have rational coordinates.

The nested Point_2 type defined by the traits class is therefore different than the Kernel::Point_2 type. Its coordinates are of type CoordNT, which an instantiation of CGAL::Sqrt_extension<NT,ROOT> where NT = ROOT = Kernel::FT. Moreover, the third and fourth (hidden) template parameters of CGAL::Sqrt_extension<NT,ROOT> are set to CGAL::Tag_true, which enables efficient comparison among different extensions.

For more details see the documentation of CGAL::Sqrt_extension<NT,ROOT>

#include <CGAL/Arr_circle_segment_traits_2.h>

Is Model for the Concepts

ArrangementTraits_2

Class Arr_circle_segment_traits_2<Kernel>::Point_2

The Point_2 number-type nested within the traits class represents a Cartesian point whose coordinates are algebraic numbers of type CoordNT.

Types

Arr_circle_segment_traits_2<Kernel>::Point_2::Rational
the Kernel::FT type.


Arr_circle_segment_traits_2<Kernel>::Point_2::CoordNT
the algebraic number-type.

Creation

Arr_circle_segment_traits_2<Kernel>::Point_2 p;
default constructor.


Arr_circle_segment_traits_2<Kernel>::Point_2 p ( Rational x, Rational y);
creates the point (x,y).


Arr_circle_segment_traits_2<Kernel>::Point_2 p ( CoordNT x, CoordNT y);
creates the point (x,y).

Access Functions

CoordNT p.x () const returns the x-coordinate.
CoordNT p.y () const returns the y-coordinate.

Class Arr_circle_segment_traits_2<Kernel>::Curve_2

The Curve_2 class nested within the traits class can represent arbitrary circular arcs, full circles and line segments and support their construction in various ways. The copy and default constructor as well as the assignment operator are provided. In addition, an operator<< for the curves is defined for standard output streams.

Creation

Arr_circle_segment_traits_2<Kernel>::Curve_2 cv ( typename Kernel::Segment_2 seg);
constructs an curve corresponding to the line segment seg.


Arr_circle_segment_traits_2<Kernel>::Curve_2 cv ( typename Kernel::Point_2 source, typename Kernel::Point_2 target);
constructs an curve corresponding to the line segment directed from source to target, both having rational coordinates.


Arr_circle_segment_traits_2<Kernel>::Curve_2 cv ( typename Kernel::Line_2 line, Point_2 source, Point_2 target);
constructs an curve corresponding to the line segment supported by the given line, directed from source to target. Note that the two endpoints may have one-root coordinates.
Precondition: Both endpoints must lie on the given supporting line.


Arr_circle_segment_traits_2<Kernel>::Curve_2 cv ( typename Kernel::Circle_2 circ);
constructs an curve corresponding to the given circle. circ has a center point with rational coordinates and its squared radius is rational.


Arr_circle_segment_traits_2<Kernel>::Curve_2 cv ( typename Kernel::Point_2 c,
typename Kernel::FT r,
Orientation orient = COUNTERCLOCKWISE);
constructs an curve corresponding to a circle centered at the rational point c whose radius r is rational.


Arr_circle_segment_traits_2<Kernel>::Curve_2 cv ( typename Kernel::Circle_2 circ, Point_2 source, Point_2 target);
constructs a circular arc supported by circ, which has a center point with rational coordinates and whose squared radius is rational, with the given endpoints. The orientation of the arc is the same as the orientation of circ.
Precondition: Both endpoints must lie on the given supporting circle.


Arr_circle_segment_traits_2<Kernel>::Curve_2 cv ( typename Kernel::Point_2 c,
typename Kernel::FT r,
Orientation orient,
Point_2 source,
Point_2 target);
constructs a circular arc supported by a circle centered at the rational point c whose radius r is rational, directed from source to target with the given orientation.
Precondition: Both endpoints must lie on the supporting circle.


Arr_circle_segment_traits_2<Kernel>::Curve_2 cv ( typename Kernel::Point_2 source,
typename Kernel::Point_2 mid,
typename Kernel::Point_2 target);
constructs an circular arc whose endpoints are source and target that passes through mid. All three points have rational coordinates.
Precondition: The three points must not be collinear.

Access Functions

bool cv.is_full () const indicates whether the curve represents a full circle.

Point_2 cv.source () const returns the source point.
Precondition: cv is not a full circle.
Point_2 cv.target () const returns the target point.
Precondition: cv is not a full circle.

Orientation cv.orientation () const returns the orientation of the curve (COLLINEAR in case of line segments).

bool cv.is_linear () const determines whether cv is a line segment.
bool cv.is_circular () const determines whether cv is a circular arc.

typename Kernel::Line_2 cv.supporting_line () const returns the supporting line of cv.
Precondition: cv is a line segment.
typename Kernel::Circle_2 cv.supporting_circle () const returns the supporting circle of cv.
Precondition: cv is a circular arc.

Class Arr_circle_segment_traits_2<Kernel>::X_monotone_curve_2

The X_monotone_curve_2 class nested within the traits class can represent x-monotone and line segments (which are always weakly x-monotone). The copy and default constructor as well as the assignment operator are provided. In addition, an operator<< for the curves is defined for standard output streams.

Creation

Arr_circle_segment_traits_2<Kernel>::X_monotone_curve_2 xcv ( typename Kernel::Point_2 source, typename Kernel::Point_2 target);
constructs an curve corresponding to the line segment directed from source to target, both having rational coordinates.


Arr_circle_segment_traits_2<Kernel>::X_monotone_curve_2 xcv ( typename Kernel::Line_2 line, Point_2 source, Point_2 target);
constructs an curve corresponding to the line segment supported by the given line, directed from source to target. Note that the two endpoints may have one-root coordinates.
Precondition: Both endpoints must lie on the given supporting line.


Arr_circle_segment_traits_2<Kernel>::X_monotone_curve_2 xcv ( typename Kernel::Circle_2 circ,
Point_2 source,
Point_2 target,
Orientation orient);
constructs a circular arc supported by circ, which has a center point with rational coordinates and whose squared radius is rational, with the given endpoints. The orientation of the arc is determined by orient.
Precondition: Both endpoints must lie on the given supporting circle.
Precondition: The circular arc is x-monotone.

Access Functions

Point_2 xcv.source () const returns the source point of xcv.
Point_2 xcv.target () const returns the target point of xcv.

bool xcv.is_directed_right () const returns true if xcv is directed right, false otherwise.
Point_2 xcv.left () const returns the left (lexicographically smaller) endpoint of xcv.
Point_2 xcv.right () const returns the right (lexicographically larger) endpoint of xcv.

Orientation xcv.orientation () const returns the orientation of the curve (COLLINEAR in case of line segments).

bool xcv.is_linear () const determines whether xcv is a line segment.
bool xcv.is_circular () const determines whether xcv is a circular arc.

typename Kernel::Line_2 xcv.supporting_line () const returns the supporting line of xcv.
Precondition: xcv is a line segment.
typename Kernel::Circle_2 xcv.supporting_circle () const returns the supporting circle of xcv.
Precondition: xcv is a circular arc.

Bbox_2 xcv.bbox () const returns a bounding box of the arc xcv.