The class Arr_conic_traits_2<RatKernel,AlgKernel,NtTraits> is a model of the ArrangementTraits_2 concept and can be used to construct and maintain arrangements of bounded segments of algebraic curves of degree 2 at most, also known as conic curves.
A general conic curve C is the locus of all points (x,y) satisfying the equation: r x2 + s y2 + t x y + u x + v y + w = 0, where:
A bounded conic arc is defined as either of the following:
A very useful subset of the set of conic arcs are line segments and circular arcs, as arrangements of circular arcs and line segments have some interesting applications (e.g. offsetting polygons, motion planning for a disc robot, etc.). Circular arcs and line segment are simpler objects and can be dealt with more efficiently than arbitrary arcs. For these reasons, it is possible to construct conic arcs from segments and from circles. Using these constructors is highly recommended: It is more straightforward and also speeds up the arrangement construction. However, in case the set of input curves contain only circular arcs and line segments, it is recommended to use the Arr_circle_segment_2 class to achieve faster running times.
In our representation, all conic coefficients (namely r, s, t, u, v, w) must be rational numbers. This guarantees that the coordinates of all arrangement vertices (in particular, those representing instersection points) are algebraic numbers of degree 4 (a real number α is an algebraic number of degree d if there exist a polynomial p with integer coefficient of degree d such that p(α) = 0). We therefore require separate representations of the curve coefficients and the point coordiantes. The NtTraits should be instantiated with a class that defines nested Integer, Rational and Algebraic number types and supports various operations on them, yielding certified computation results (for example, it can convert rational numbers to algebraic numbers and can compute roots of polynomials with integer coefficients). The other template parameters, RatKernel and AlgKernel should be geometric kernels templated with the NtTraits::Rational and NtTraits::Algebraic number types, repectively. It is recommended to instantiate the CORE_algebraic_number_traits class as the NtTraits parameter, with Cartesian<NtTraits::Rational> and Cartesian<NtTraits::Algebraic> instantiating the two kernel types, respectively. The number types in this case are provided by the Core library, with its ability to exactly represent simple algebraic numbers.
The traits class inherits its point type from AlgKernel::Point_2, and defines a curve and x-monotone curve types, as detailed below.
#include <CGAL/Arr_conic_traits_2.h>
The Curve_2 class nested within the conic-arc traits can represent arbitrary conic arcs and support their construction in various ways. The copy and default constructor as well as the assignment operator are provided for conic arcs. In addition, an operator<< for the curves is defined for standard output streams.
| |||||
constructs an arc corresponding to the line segment seg.
| |||||
| |||||
constructs an arc corresponding to the full circle circ
(note that this circle has a center point with rational coordinates
and rational squared radius).
| |||||
| |||||
constructs a circular arc supported by the circle circ, going
in the given orientation o from the source point ps to
its target point pt.
| |||||
| |||||
constructs a circular arc going from p1 (its source point)
through p2 to p3 (its target point). Note that all three
points have rational coordinates. The orientation of the arc is
determined automatically.
| |||||
| |||||
constructs a conic arc that corresponds to the full conic curve
r x2 + s y2 + t x y + u x + v y + w = 0.
| |||||
| |||||
constructs a conic arc supported by the conic curve
r x2 + s y2 + t x y + u x + v y + w = 0, going
in the given orientation o from the source point ps to
its target point pt.
| |||||
| |||||
constructs a conic arc going from p1 (its source point)
through p2, p3 and p4 (in this order) to p5
(its target point). Note that all five points have rational coordinates.
The orientation of the arc is determined automatically.
| |||||
| |||||
constructs a conic arc supported by the conic curve
r x2 + s y2 + t x y + u x + v y + w = 0, going
in the given orientation o from its source point to its target
point. In this case only some approximations of the endpoints
(app_ps and app_pt, repsectively) is available,
and their exact locations are given implicitly, specified by the
intersections of the supporting conic curve with
r1 x2 + s1 y2 + t1 x y + u1 x + v1 y + w1 = 0 and
r2 x2 + s2 y2 + t2 x y + u2 x + v2 y + w2 = 0, repsectively.
|
The six following methods return the coefficients of the supported conic, after their conversion to integer number (reprsented by the Integer type of the NtTraits class):
|
| returns the coefficient of x2. | ||
|
| returns the coefficient of t2. | ||
|
| returns the coefficient of x y. | ||
|
| returns the coefficient of x. | ||
|
| returns the coefficient of y. | ||
|
| returns the free coefficient. | ||
|
|
returns the source point of the arc.
| ||
|
|
returns the target point of the arc.
| ||
|
| returns the orientation of the arc. | ||
|
| return a bounding box of the arc a. |
|
|
sets a new source point for the conic arc.
| ||
|
|
sets a new target point for the conic arc.
|
The X_monotone_curve_2 class nested within the conic-arc traits is used to represent x-monotone conic arcs. It inherits from the Curve_2 type, therefore supports the access methods and the operations listed above.
For efficiency reasons, we recommend users not to construct x-monotone conic arc directly, but rather use the Make_x_monotone_2 functor supplied by the conic-arc traits class to convert conic curves to x-monotone curves.
| |||
converts the given arc to an x-monotone arc.
|
|
| returns the left (lexicographically smaller) endpoint of xa. |
|
| returns the right (lexicographically larger) endpoint of xa. |