CGAL 5.5.1 - 2D Arrangements
CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2 Class Reference

#include <CGAL/Arr_conic_traits_2.h>

Definition

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.

Creation

 Curve_2 (const typename RatKernel::Segment_2 &seg)
 constructs an arc corresponding to the line segment seg.
 
 Curve_2 (const typename RatKernel::Circle_2 &circ)
 constructs an arc corresponding to the full circle circ (note that this circle has a center point with rational coordinates and rational squared radius).
 
 Curve_2 (const typename RatKernel::Circle_2 &circ, Orientation o, const Point_2 &ps, const Point_2 &pt)
 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. More...
 
 Curve_2 (const typename RatKernel::Point_2 &p1, const typename RatKernel::Point_2 &p2, const typename RatKernel::Point_2 &p3)
 constructs a circular arc going from p1 (its source point) through p2 to p3 (its target point). More...
 
 Curve_2 (const Rational &r, const Rational &s, const Rational &t, const Rational &u, const Rational &v, const Rational &w)
 constructs a conic arc that corresponds to the full conic curve \( r x^2 + s y^2 + t x y + u x + v y + w = 0\). More...
 
 Curve_2 (const Rational &r, const Rational &s, const Rational &t, const Rational &u, const Rational &v, const Rational &w, Orientation o, const Point_2 &ps, const Point_2 &pt)
 constructs a conic arc supported by the conic curve \( r x^2 + s y^2 + 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. More...
 
 Curve_2 (const typename RatKernel::Point_2 &p1, const typename RatKernel::Point_2 &p2, const typename RatKernel::Point_2 &p3, const typename RatKernel::Point_2 &p4, const typename RatKernel::Point_2 &p5)
 constructs a conic arc going from p1 (its source point) through p2, p3 and p4 (in this order) to p5 (its target point). More...
 
 Curve_2 (const Rational &r, const Rational &s, const Rational &t, const Rational &u, const Rational &v, const Rational &w, Orientation o, const Point_2 &app_ps, const Rational &r1, const Rational &s1, const Rational &t1, const Rational &u1, const Rational &v1, const Rational &w1, const Point_2 &app_pt, const Rational &r2, const Rational &s2, const Rational &t2, const Rational &u2, const Rational &v2, const Rational &w2)
 constructs a conic arc supported by the conic curve \( r x^2 + s y^2 + t x y + u x + v y + w = 0\), going in the given orientation o from its source point to its target Point. More...
 

Access Functions

bool is_valid () const
 indicates whether a is a valid conic arc. More...
 
bool is_x_monotone () const
 determines whether the arc is \( x\)-monotone, namely each vertical line intersects it at most once. More...
 
bool is_y_monotone () const
 determines whether the arc is \( y\)-monotone, namely each horizontal line intersects it at most once. More...
 
bool is_full_conic () const
 indicates whether the arc represents a full conic curve (en ellipse or a circle).
 

The six following methods return the coefficients of the supported conic, after their conversion to integer number (represented by the Integer type of the NtTraits class):

const NtTraits::Integer & r () const
 returns the coefficient of \( x^2\).
 
const NtTraits::Integer & s () const
 returns the coefficient of \( t^2\).
 
const NtTraits::Integer & t () const
 returns the coefficient of \( x y\).
 
const NtTraits::Integer & u () const
 returns the coefficient of \( x\).
 
const NtTraits::Integer & v () const
 returns the coefficient of \( y\).
 
const NtTraits::Integer & w () const
 returns the free coefficient.
 
const Point_2source () const
 returns the source point of the arc. More...
 
const Point_2target () const
 returns the target point of the arc. More...
 
Orientation orientation () const
 returns the orientation of the arc.
 
Bbox_2 bbox () const
 return a bounding box of the arc a.
 

Operations

void set_source (const Point_2 &ps)
 sets a new source point for the conic arc. More...
 
void set_target (const Point_2 &pt)
 sets a new target point for the conic arc. More...
 

Constructor & Destructor Documentation

◆ Curve_2() [1/6]

template<typename RatKernel , typename AlgKernel , typename NtTraits >
CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2::Curve_2 ( const typename RatKernel::Circle_2 &  circ,
Orientation  o,
const Point_2 ps,
const Point_2 pt 
)

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.

Precondition
ps and pt both lie on the circle circ.
o is not COLLINEAR.

◆ Curve_2() [2/6]

template<typename RatKernel , typename AlgKernel , typename NtTraits >
CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2::Curve_2 ( const typename RatKernel::Point_2 &  p1,
const typename RatKernel::Point_2 &  p2,
const typename RatKernel::Point_2 &  p3 
)

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.

Precondition
The three points are not collinear.

◆ Curve_2() [3/6]

template<typename RatKernel , typename AlgKernel , typename NtTraits >
CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2::Curve_2 ( const Rational r,
const Rational s,
const Rational t,
const Rational u,
const Rational v,
const Rational w 
)

constructs a conic arc that corresponds to the full conic curve \( r x^2 + s y^2 + t x y + u x + v y + w = 0\).

Precondition
As a conic arc must be bounded, the given curve must be an ellipse, that is \( 4 r s - t^2 > 0\).

◆ Curve_2() [4/6]

template<typename RatKernel , typename AlgKernel , typename NtTraits >
CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2::Curve_2 ( const Rational r,
const Rational s,
const Rational t,
const Rational u,
const Rational v,
const Rational w,
Orientation  o,
const Point_2 ps,
const Point_2 pt 
)

constructs a conic arc supported by the conic curve \( r x^2 + s y^2 + 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.

  • *
Precondition
ps and pt both satisfy the equation of the supporting conic curve and define a bounded segment of this curve (e.g. in case of a hyperbolic arc, both point should be located on the same branch of the hyperbola).
o is not COLLINEAR if the supporting conic is curves, and must be COLLINEAR if it is not curved (a line or a line-pair).

◆ Curve_2() [5/6]

template<typename RatKernel , typename AlgKernel , typename NtTraits >
CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2::Curve_2 ( const typename RatKernel::Point_2 &  p1,
const typename RatKernel::Point_2 &  p2,
const typename RatKernel::Point_2 &  p3,
const typename RatKernel::Point_2 &  p4,
const typename RatKernel::Point_2 &  p5 
)

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.

Precondition
No three points of the five are not collinear.
The five points define a valid arc, in their given order.

◆ Curve_2() [6/6]

template<typename RatKernel , typename AlgKernel , typename NtTraits >
CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2::Curve_2 ( const Rational r,
const Rational s,
const Rational t,
const Rational u,
const Rational v,
const Rational w,
Orientation  o,
const Point_2 app_ps,
const Rational r1,
const Rational s1,
const Rational t1,
const Rational u1,
const Rational v1,
const Rational w1,
const Point_2 app_pt,
const Rational r2,
const Rational s2,
const Rational t2,
const Rational u2,
const Rational v2,
const Rational w2 
)

constructs a conic arc supported by the conic curve \( r x^2 + s y^2 + 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, respectively) is available, and their exact locations are given implicitly, specified by the intersections of the supporting conic curve with \( r_1 x^2 + s_1 y^2 + t_1 x y + u_1 x + v_1 y + w_1 = 0\) and \( r_2 x^2 + s_2 y^2 + t_2 x y + u_2 x + v_2 y + w_2 = 0\), respectively.

Precondition
The two auxiliary curves specifying the endpoints really intersect with the supporting conic curve, such that the arc endpoints define a bounded segment of the supporting curve (e.g. in case of a hyperbolic arc, both point should be located on the same branch of the hyperbola).
o is not COLLINEAR if the supporting conic is curves, and must be COLLINEAR if it is not curved (a line or a line-pair).

Member Function Documentation

◆ is_valid()

template<typename RatKernel , typename AlgKernel , typename NtTraits >
bool CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2::is_valid ( ) const

indicates whether a is a valid conic arc.

As the precondition to some of the constructor listed above are quite complicated, their 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.

◆ is_x_monotone()

template<typename RatKernel , typename AlgKernel , typename NtTraits >
bool CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2::is_x_monotone ( ) const

determines whether the arc is \( x\)-monotone, namely each vertical line intersects it at most once.

A vertical line segment is also considered (weakly) \( x\)-monotone.

◆ is_y_monotone()

template<typename RatKernel , typename AlgKernel , typename NtTraits >
bool CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2::is_y_monotone ( ) const

determines whether the arc is \( y\)-monotone, namely each horizontal line intersects it at most once.

A horizontal line segment is also considered (weakly) \( x\)-monotone.

◆ set_source()

template<typename RatKernel , typename AlgKernel , typename NtTraits >
void CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2::set_source ( const Point_2 ps)

sets a new source point for the conic arc.

Precondition
ps lies on the supporting conic of a.

◆ set_target()

template<typename RatKernel , typename AlgKernel , typename NtTraits >
void CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2::set_target ( const Point_2 pt)

sets a new target point for the conic arc.

Precondition
pt lies on the supporting conic of a.

◆ source()

template<typename RatKernel , typename AlgKernel , typename NtTraits >
const Point_2& CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2::source ( ) const

returns the source point of the arc.

Precondition
a is not a full conic curve.

◆ target()

template<typename RatKernel , typename AlgKernel , typename NtTraits >
const Point_2& CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits >::Curve_2::target ( ) const

returns the target point of the arc.

Precondition
a is not a full conic curve.