The traits class Arr_rational_arc_traits_2<AlgKernel,NtTraits> is a model of the ArrangementTraits_2 concept. It handles bounded segments of rational functions, referred to as rational arcs, and enables the construction and maintenance of arrangements of such arcs. A rational function is defined by two polynomials and of arbitrary degrees. In particular, if then the function is a simple polynomial function. A bounded rational arc is defined by the graph of a rational function over some internal , where does not have any real roots in this interval (thus the arc does not contain any poles). Rational functions, and polynomial functions in particular, are not only interesting in their own right, they are also very useful for approximating or interpolating more complicated curves.
In our representation, all polynomial coefficients (the coefficients of and ) must be rational numbers. This guarantees that the -coordinates of all arrangement vertices (in particular, those representing instersection points) can be represneted as roots of polynomials with integer coefficients - namely, algebraic numbers. The -coordinates can be obtained by simple arithmetic operations on the -coordinates, hence they are also algebraic numbers.
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, in can convert rational numbers to algebraic numbers and can compute roots of polynomials with integer coefficients). The AlgKernel template-parameter should be a geometric kernel templated with the NtTraits::Algebraic number-type. It is recommended to instantiate the CORE_algebraic_number_traits class as the NtTraits parameter, with Cartesian<NtTraits::Algebraic> instantiating the kernel. The number types in this case are provided by the CORE library, with its ability to exactly represent simple algebraic numbers.
The traits class defined its point type to be AlgKernel::Point_2, and defines a curve type (and an identical -monotone curve type, as a rational arc is always -monotone by definition) as detailed below.
#include <CGAL/Arr_rational_arc_traits_2.h>
The Curve_2 class nested within the rational-arc traits is used to represent rational arcs and support their construction from a single polynomial and the range where the arc is defined or a pair of polynomials and a pair of corresponding ranges. The copy and default constructor as well as the assignment operator are provided for polyline curves. In addition, an operator<< for the curves is defined for standard output streams.
| |
A vector of rational numbers (equivalent to
std::vector<typename NtTraits::Rational).
| |
| |
the NtTraits::Polynomial type
(a polynomial with integer coefficients).
|
| |||
default constructor.
| |||
| |||
constructs an arc supported by the polynomial , defined over
the interval [x_s, x_t], given by the -coordinates of the arc's
source and target. The vector p_coeffs specifies
the coefficients of , where the polynomial degree is
p_coeffs.size() - 1 and p[k] is the coefficient of in . Precondition: s_x != t_x.
| |||
| |||
constructs an arc supported by the rational function
, defined over the internal [s_x, t_x],
given by the -coordinates of the arc's source and target.
The vectors p_coeffs and q_coeffs specify the coefficients
of and , respectively (see above). Precondition: x_min < x_max. Precondition: For each x_min x x_max, .
|
|
| indicates whether a is a valid rational arc. As the precondition to the constructor from two polynomials is quite complicated, its violation does not cause the program to abort. Instead, the constructed arc is invalid (a defaultly constructed arc is also invalid). It is however recommended to check that a constructed arc is valid before inserting it to an arrangement, as this operation will cause the program to abort. |
|
| returns a polynomial with integer coefficients equivalent to . |
|
| returns a polynomial with integer coefficients equivalent to . |
|
|
returns the source point of the arc. Precondition: a is not a full conic curve. |
|
|
returns the target point of the arc. Precondition: a is not a full conic curve. |
|
| returns the left (lexicographically smaller) endpoint of a. |
|
| returns the right (lexicographically larger) endpoint of a. |