CGAL 5.2.1 - 2D Arrangements
|
#include <CGAL/Arr_rational_function_traits_2.h>
The traits class Arr_rational_function_traits_2
is a model of the ArrangementTraits_2
concept.
It handles bounded and unbounded arcs of rational functions, referred to as rational arcs (in particular, such an arc may correspond to the entire graph of a rational function). It supports bounded and unbounded arcs. Thus, it is also a model of the concept ArrangementOpenBoundaryTraits_2
. The traits class enables the construction and maintenance of arrangements of such arcs.
A rational function \( y = \frac{P(x)}{Q(x)}\) is defined by two polynomials \( P\) and \( Q\) of arbitrary degrees. If \( Q(x) = 1\) then the function is a simple polynomial function. Usually the domain is \( \mathbb{R}\) but the function may also be restricted to a bounded interval \( [x_{\rm min}, x_{\rm max}]\) or defined over a ray \( (-\infty, x_{\rm max}]\) or over \( [x_{\rm min}, \infty)\). Rational functions are represented by the nested type Curve_2
. Note that a rational function may be not continuous since roots of \( Q\) induce vertical asymptotes, which would contradict the notion of an \( x\)-monotone curve as it is introduced by the ArrangementTraits_2
concept. Thus, continuous portions of rational functions are represented by the nested type X_monotone_curve_2
, which is different from Curve_2
. Constructors for both classes are provided by the traits. A Curve_2
may be split up into several X_monotone_curve_2
using Make_x_monotone_2
.
The template parameter of the traits must be a model of the concept AlgebraicKernel_d_1
. A rational function is then represented by two polynomials \( P\) and \( Q\) of type AlgebraicKernel_d_1::Polynomial_1
. A point is represented by a rational function and its \( x\)-coordinate, which is of type AlgebraicKernel_d_1::Algebraic_real_1
. Note that an explicit representation of the \( y\)-coordinate is only computed upon request, which can be a rather costly operation.
The constructed rational functions are cached by the traits class. The cache is local to each traits class object. It is therefore necessary to construct the curves using the constructor objects provided by member functions of the traits class. Moreover, a curve must only be used with its own traits. The cache is automatically cleaned up from time to time. The amortized clean up costs are constant. However, there is also a separate member function that cleans up the cache on demand.
While Arr_rational_function_traits_2
models the concept ArrangementDirectionalXMonotoneTraits_2
, the implementation of the Are_mergeable_2
operation does not enforce the input curves to have the same direction as a precondition. Moreover, Arr_rational_function_traits_2
supports the merging of curves of opposite directions.
Classes | |
class | Construct_curve_2 |
Functor to construct a Curve_2 . More... | |
class | Construct_x_monotone_curve_2 |
Functor to construct a X_monotone_curve_2 . More... | |
class | Curve_2 |
The Curve_2 class nested within the traits is used to represent rational functions which may be restricted to a certain x-range. More... | |
class | Point_2 |
class | X_monotone_curve_2 |
The X_monotone_curve_2 class nested within the traits is used to represent \( x\)-monotone parts of rational functions. More... | |
Types | |
typedef AlgebraicKernel_d_1 | Algebraic_kernel_d_1 |
typedef AlgebraicKernel_d_1::Coefficient | Coefficient |
typedef AlgebraicKernel_d_1::Polynomial_1 | Polynomial_1 |
typedef AlgebraicKernel_d_1::Algebraic_real_1 | Algebraic_real_1 |
typedef AlgebraicKernel_d_1::Bound | Bound |
Creation | |
Arr_rational_function_traits_2 (const Algebraic_kernel_d_1 *kernel) | |
constructs an empty traits that uses the kernel pointed by kernel for performing algebraic operations. | |
Operations | |
Construct_curve_2 | construct_curve_2_object () const |
Returns an instance of Construct_curve_2 . | |
Construct_x_monotone_curve_2 | construct_x_monotone_curve_2_object () const |
Returns an instance of Construct_x_monotone_curve_2 . | |
void | cleanup_cache () const |
Deletes all curves from the cache that exist only there. | |
const Algebraic_kernel_d_1 * | algebraic_kernel_d_1 () const |
Returns a pointer to the used algerbaic kernel object. | |