![]() |
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>
While Arr_circle_segment_traits_2<Kernel> models the concept ArrangementDirectionalXMonotoneTraits_2, the implementation of the Arr_mergeable_2 operation does not enforce the input curves to have the same direction as a precondition. Moreover, Arr_circle_segment_traits_2<Kernel> supports the merging of curves of opposite directions.
#include <CGAL/Arr_circle_segment_traits_2.h>
The Point_2 number-type nested within the traits class represents a Cartesian point whose coordinates are algebraic numbers of type CoordNT.
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.
|
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).
|
CoordNT | p.x () const | returns the x-coordinate. |
CoordNT | p.y () const | returns the y-coordinate. |
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.
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.
| |||
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.
| |||
| |||
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.
| |||
| |||
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.
| |||
| |||
constructs an circular arc whose endpoints are source and
target that passes through mid. All three points have
rational coordinates.
|
bool | cv.is_full () const | indicates whether the curve represents a full circle. | ||
Point_2 | cv.source () const |
returns the source point.
| ||
Point_2 | cv.target () const |
returns the target point.
| ||
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.
| ||
typename Kernel::Circle_2 | cv.supporting_circle () const |
returns the supporting circle of cv.
|
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.
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.
| |||||
| |||||
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.
|
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.
| ||
typename Kernel::Circle_2 | xcv.supporting_circle () const |
returns the supporting circle of xcv.
| ||
Bbox_2 | xcv.bbox () const | returns a bounding box of the arc xcv. |