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, and represent real numbers obtained from solving quadratic equations with rational coordinates. A number of type CoordNT can therefore be expressed as α+ β√γ, where α, β and γ are all rational numbers. The definition of the curve and x-monotone curve types nested in the traits class are detailed below.
#include <CGAL/Arr_circle_segment_traits_2.h>
The CoordNT number-type nested within the traits class represents an algebraic number of degree 2; it can be represented as α+ β√γ, where α, β and γ are all rational numbers of type Kernel::FT.
| |
the Kernel::FT type.
|
| |
creates a variable whose value is 0.
| |
| |
creates a variable whose value is the rational number α.
| |
| |
creates a variable whose value is the algebraic number
α+ β√γ.
|
|
| determines whether x is rational. |
|
| returns α. |
|
| returns β (0 if x is rational). |
|
| returns γ (0 if x is rational). |
The CoordNT number-type supports all arithmetic operations with rational numbers of type Kernel::FT. For example, it is possible to compute x + q, q - x, x += q, etc. where q is rational.
The global functions CGAL::sign(x), CGAL::square(x), CGAL::to_double(x) and CGAL::compare(x,y), where x and y are of type CoordNT, are also supported.
It is also possible to call CGAL::to_double(x) to convert x to a rational number, with the precondition that it is indeed rational.
The Point_2 number-type nested within the traits class represents a Cartesian point whose coordinates are algebraic numbers of type CoordNT.
| |
the Kernel::FT type.
| |
| |
the algebraic number-type.
|
| |
default constructor.
| |
| |
creates the point (x,y).
| |
| |
creates the point (x,y).
|
|
| returns the x-coordinate. |
|
| 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.
| |||
constructs an curve corresponding to the line segment seg.
| |||
| |||
constructs an curve corresponding to the line segment directed
from source to target, both having rational coordinates.
| |||
| |||
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 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.
| |||
| |||
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.
|
|
| indicates whether the curve represents a full circle. | ||
|
|
returns the source point.
| ||
|
|
returns the target point.
| ||
|
| returns the orientation of the curve (COLLINEAR in case of line segments). | ||
|
| determines whether cv is a line segment. | ||
|
| determines whether cv is a circular arc. | ||
|
|
returns the supporting line of cv.
| ||
|
|
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.
| |||||
constructs an curve corresponding to the line segment directed
from source to target, both having rational coordinates.
| |||||
| |||||
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.
|
|
| returns the source point of xcv. | ||
|
| returns the target point of xcv. | ||
|
| returns true if xcv is directed right, false otherwise. | ||
|
| returns the left (lexicographically smaller) endpoint of xcv. | ||
|
| returns the right (lexicographically larger) endpoint of xcv. | ||
|
| returns the orientation of the curve (COLLINEAR in case of line segments). | ||
|
| determines whether xcv is a line segment. | ||
|
| determines whether xcv is a circular arc. | ||
|
|
returns the supporting line of xcv.
| ||
|
|
returns the supporting circle of xcv.
| ||
|
| returns a bounding box of the arc xcv. |