CGAL 6.0.1 - 2D Arrangements
Loading...
Searching...
No Matches
CGAL::Arr_Bezier_curve_traits_2< RatKernel, AlgKernel, NtTraits > Class Template Reference

#include <CGAL/Arr_Bezier_curve_traits_2.h>

Definition

template<typename RatKernel, typename AlgKernel, typename NtTraits>
class CGAL::Arr_Bezier_curve_traits_2< RatKernel, AlgKernel, NtTraits >

The traits class Arr_Bezier_curve_traits_2 is a model of the ArrangementTraits_2 concept that handles planar Bézier curves.

A planar Bézier curve \( B\) is a parametric curve defined by a sequence of control points \( p_0, \ldots, p_n\) as follows:

\begin{eqnarray*} B(t) = \left(X(t), Y(t)\right) = \ccSum{k=0}{n}{p_k \cdot \frac{n!}{k! (n-k)!} \cdot t^k (1-t)^{n-k}}\ . \end{eqnarray*}

where \( t \in [0, 1]\). The degree of the curve is therefore \( n\) - namely, \( X(t)\) and \( Y(t)\) are polynomials of degree \( n\). Bézier curves have numerous applications in computer graphics and solid modelling. They are used, for example, in free-form sketches and for defining the true-type fonts.

In our representation, we assume that the coordinates of all control points are rational numbers (namely they are given as objects of the RatKernel::Point_2 type), so both \( X(t)\) and \( Y(t)\) are polynomials with rational coefficients. The intersection points between curves are however algebraic numbers, and their exact computation is time-consuming. The traits class therefore contains a layer of geometric filtering that performs all computation in an approximate manner whenever possible, and it resorts to exact computations only when the approximate computation fails to produce an unambiguous result.

We therefore require separate representations of the control points and the intersection points. 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 other template parameters, RatKernel and AlgKernel should be geometric kernels templated with the NtTraits::Rational and NtTraits::Algebraic number types, respectively. 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.

While Arr_Bezier_curve_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_Bezier_curve_traits_2 supports the merging of curves of opposite directions.

Is model of
ArrangementTraits_2
ArrangementDirectionalXMonotoneTraits_2

Classes

class  Curve_2
 The Curve_2 class nested within the Bézier traits class is used to represent a Bézier curve of arbitrary degree, which is defined by a sequence of rational control points. More...
 
class  Point_2
 The Point_2 class nested within the Bézier traits class is used to represent: (i) an endpoint of a Bézier curve, (ii) a vertical tangency point of a curve, used to subdivide it into \( x\)-monotone subcurve, and (iii) an intersection point between two curves. More...
 
class  Trim_2
 
class  X_monotone_curve_2
 The X_monotone_curve_2 class nested within the Bézier traits is used to represent \( x\)-monotone subcurves of Bézier curves. More...
 

Types

typedef unspecified_type Rational
 the NtTraits::Rational type (and also the RatKernel::FT type).
 
typedef unspecified_type Algebraic
 the NtTraits::Algebraic type (and also the AlgKernel::FT type).