mirror of https://github.com/CGAL/cgal
Cleaned up
This commit is contained in:
parent
2429950bdd
commit
a5e015a8a3
|
|
@ -33,8 +33,7 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
/*!
|
||||
* \class A traits class for maintaining an arrangement of conic arcs (bounded
|
||||
/*! \class A traits class for maintaining an arrangement of conic arcs (bounded
|
||||
* segments of algebraic curves of degree 2 at most).
|
||||
*
|
||||
* The class is templated with two parameters:
|
||||
|
|
@ -46,14 +45,14 @@ namespace CGAL {
|
|||
* Nt_traits A traits class for performing various operations on the integer,
|
||||
* rational and algebraic types.
|
||||
*/
|
||||
template <class Rat_kernel_, class Alg_kernel_, class Nt_traits_>
|
||||
template <typename RatKernel, typename AlgKernel, typename NtTraits>
|
||||
class Arr_conic_traits_2
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Rat_kernel_ Rat_kernel;
|
||||
typedef Alg_kernel_ Alg_kernel;
|
||||
typedef Nt_traits_ Nt_traits;
|
||||
typedef RatKernel Rat_kernel;
|
||||
typedef AlgKernel Alg_kernel;
|
||||
typedef NtTraits Nt_traits;
|
||||
|
||||
typedef typename Rat_kernel::FT Rational;
|
||||
typedef typename Rat_kernel::Point_2 Rat_point_2;
|
||||
|
|
@ -85,7 +84,6 @@ public:
|
|||
typedef unsigned int Multiplicity;
|
||||
|
||||
private:
|
||||
|
||||
// Type definition for the intersection points mapping.
|
||||
typedef typename X_monotone_curve_2::Conic_id Conic_id;
|
||||
typedef typename X_monotone_curve_2::Intersection_point Intersection_point;
|
||||
|
|
@ -95,16 +93,12 @@ private:
|
|||
// intersection points.
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Default constructor.
|
||||
/*! Default constructor.
|
||||
*/
|
||||
Arr_conic_traits_2 ()
|
||||
{}
|
||||
Arr_conic_traits_2() {}
|
||||
|
||||
/*! Get the next conic index. */
|
||||
static unsigned int get_index ()
|
||||
{
|
||||
/*! Obtain the next conic index. */
|
||||
static unsigned int get_index() {
|
||||
#ifdef CGAL_NO_ATOMIC
|
||||
static unsigned int index;
|
||||
#else
|
||||
|
|
@ -116,119 +110,89 @@ public:
|
|||
/// \name Basic functor definitions.
|
||||
//@{
|
||||
|
||||
class Compare_x_2
|
||||
{
|
||||
class Compare_x_2 {
|
||||
public:
|
||||
/*!
|
||||
* Compare the x-coordinates of two points.
|
||||
/*! Compare the x-coordinates of two points.
|
||||
* \param p1 The first point.
|
||||
* \param p2 The second point.
|
||||
* \return LARGER if x(p1) > x(p2);
|
||||
* SMALLER if x(p1) < x(p2);
|
||||
* EQUAL if x(p1) = x(p2).
|
||||
*/
|
||||
Comparison_result operator() (const Point_2 & p1, const Point_2 & p2) const
|
||||
Comparison_result operator() (const Point_2& p1, const Point_2& p2) const
|
||||
{
|
||||
Alg_kernel ker;
|
||||
return (ker.compare_x_2_object() (p1, p2));
|
||||
return (ker.compare_x_2_object()(p1, p2));
|
||||
}
|
||||
};
|
||||
|
||||
/*! Get a Compare_x_2 functor object. */
|
||||
Compare_x_2 compare_x_2_object () const
|
||||
{
|
||||
return Compare_x_2();
|
||||
}
|
||||
/*! Obtain a Compare_x_2 functor object. */
|
||||
Compare_x_2 compare_x_2_object () const { return Compare_x_2(); }
|
||||
|
||||
class Compare_xy_2
|
||||
{
|
||||
class Compare_xy_2 {
|
||||
public:
|
||||
/*!
|
||||
* Compares two points lexigoraphically: by x, then by y.
|
||||
/*! Compares two points lexigoraphically: by x, then by y.
|
||||
* \param p1 The first point.
|
||||
* \param p2 The second point.
|
||||
* \return LARGER if x(p1) > x(p2), or if x(p1) = x(p2) and y(p1) > y(p2);
|
||||
* SMALLER if x(p1) < x(p2), or if x(p1) = x(p2) and y(p1) < y(p2);
|
||||
* EQUAL if the two points are equal.
|
||||
*/
|
||||
Comparison_result operator() (const Point_2& p1, const Point_2& p2) const
|
||||
{
|
||||
Comparison_result operator()(const Point_2& p1, const Point_2& p2) const {
|
||||
Alg_kernel ker;
|
||||
return (ker.compare_xy_2_object() (p1, p2));
|
||||
return ker.compare_xy_2_object()(p1, p2);
|
||||
}
|
||||
};
|
||||
|
||||
/*! Get a Compare_xy_2 functor object. */
|
||||
Compare_xy_2 compare_xy_2_object () const
|
||||
{
|
||||
return Compare_xy_2();
|
||||
}
|
||||
/*! Obtain a Compare_xy_2 functor object. */
|
||||
Compare_xy_2 compare_xy_2_object() const
|
||||
{ return Compare_xy_2(); }
|
||||
|
||||
class Construct_min_vertex_2
|
||||
{
|
||||
class Construct_min_vertex_2 {
|
||||
public:
|
||||
/*!
|
||||
* Get the left endpoint of the x-monotone curve (segment).
|
||||
/*! Obtain the left endpoint of the x-monotone curve (segment).
|
||||
* \param cv The curve.
|
||||
* \return The left endpoint.
|
||||
*/
|
||||
const Point_2& operator() (const X_monotone_curve_2 & cv) const
|
||||
{
|
||||
return (cv.left());
|
||||
}
|
||||
const Point_2& operator()(const X_monotone_curve_2 & cv) const
|
||||
{ return cv.left(); }
|
||||
};
|
||||
|
||||
/*! Get a Construct_min_vertex_2 functor object. */
|
||||
Construct_min_vertex_2 construct_min_vertex_2_object () const
|
||||
{
|
||||
return Construct_min_vertex_2();
|
||||
}
|
||||
/*! Obtain a Construct_min_vertex_2 functor object. */
|
||||
Construct_min_vertex_2 construct_min_vertex_2_object() const
|
||||
{ return Construct_min_vertex_2(); }
|
||||
|
||||
class Construct_max_vertex_2
|
||||
{
|
||||
class Construct_max_vertex_2 {
|
||||
public:
|
||||
/*!
|
||||
* Get the right endpoint of the x-monotone curve (segment).
|
||||
/*! Obtain the right endpoint of the x-monotone curve (segment).
|
||||
* \param cv The curve.
|
||||
* \return The right endpoint.
|
||||
*/
|
||||
const Point_2& operator() (const X_monotone_curve_2 & cv) const
|
||||
{
|
||||
return (cv.right());
|
||||
}
|
||||
const Point_2& operator()(const X_monotone_curve_2 & cv) const
|
||||
{ return cv.right(); }
|
||||
};
|
||||
|
||||
/*! Get a Construct_max_vertex_2 functor object. */
|
||||
Construct_max_vertex_2 construct_max_vertex_2_object () const
|
||||
{
|
||||
return Construct_max_vertex_2();
|
||||
}
|
||||
/*! Obtain a Construct_max_vertex_2 functor object. */
|
||||
Construct_max_vertex_2 construct_max_vertex_2_object() const
|
||||
{ return Construct_max_vertex_2(); }
|
||||
|
||||
class Is_vertical_2
|
||||
{
|
||||
class Is_vertical_2 {
|
||||
public:
|
||||
/*!
|
||||
* Check whether the given x-monotone curve is a vertical segment.
|
||||
/*! Check whether the given x-monotone curve is a vertical segment.
|
||||
* \param cv The curve.
|
||||
* \return (true) if the curve is a vertical segment; (false) otherwise.
|
||||
*/
|
||||
bool operator() (const X_monotone_curve_2& cv) const
|
||||
{
|
||||
return (cv.is_vertical());
|
||||
}
|
||||
bool operator()(const X_monotone_curve_2& cv) const
|
||||
{ return cv.is_vertical(); }
|
||||
};
|
||||
|
||||
/*! Get an Is_vertical_2 functor object. */
|
||||
Is_vertical_2 is_vertical_2_object () const
|
||||
{
|
||||
return Is_vertical_2();
|
||||
}
|
||||
/*! Obtain an Is_vertical_2 functor object. */
|
||||
Is_vertical_2 is_vertical_2_object() const
|
||||
{ return Is_vertical_2(); }
|
||||
|
||||
class Compare_y_at_x_2
|
||||
{
|
||||
class Compare_y_at_x_2 {
|
||||
public:
|
||||
/*!
|
||||
* Return the location of the given point with respect to the input curve.
|
||||
/*! Return the location of the given point with respect to the input curve.
|
||||
* \param cv The curve.
|
||||
* \param p The point.
|
||||
* \pre p is in the x-range of cv.
|
||||
|
|
@ -236,69 +200,57 @@ public:
|
|||
* LARGER if y(p) > cv(x(p)), i.e. the point is above the curve;
|
||||
* EQUAL if p lies on the curve.
|
||||
*/
|
||||
Comparison_result operator() (const Point_2 & p,
|
||||
Comparison_result operator()(const Point_2 & p,
|
||||
const X_monotone_curve_2 & cv) const
|
||||
{
|
||||
Alg_kernel ker;
|
||||
|
||||
if (cv.is_vertical())
|
||||
{
|
||||
if (cv.is_vertical()) {
|
||||
// A special treatment for vertical segments:
|
||||
// In case p has the same x c-ordinate of the vertical segment, compare
|
||||
// it to the segment endpoints to determine its position.
|
||||
Comparison_result res1 = ker.compare_y_2_object() (p, cv.left());
|
||||
Comparison_result res2 = ker.compare_y_2_object() (p, cv.right());
|
||||
Comparison_result res1 = ker.compare_y_2_object()(p, cv.left());
|
||||
Comparison_result res2 = ker.compare_y_2_object()(p, cv.right());
|
||||
|
||||
if (res1 == res2)
|
||||
return (res1);
|
||||
else
|
||||
return (EQUAL);
|
||||
if (res1 == res2) return res1;
|
||||
else return EQUAL;
|
||||
}
|
||||
|
||||
// Check whether the point is exactly on the curve.
|
||||
if (cv.contains_point(p))
|
||||
return (EQUAL);
|
||||
if (cv.contains_point(p)) return EQUAL;
|
||||
|
||||
// Get a point q on the x-monotone arc with the same x coordinate as p.
|
||||
// Obtain a point q on the x-monotone arc with the same x coordinate as p.
|
||||
Comparison_result x_res;
|
||||
Point_2 q;
|
||||
|
||||
if ((x_res = ker.compare_x_2_object() (p, cv.left())) == EQUAL)
|
||||
{
|
||||
if ((x_res = ker.compare_x_2_object()(p, cv.left())) == EQUAL) {
|
||||
q = cv.left();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
CGAL_precondition (x_res != SMALLER);
|
||||
|
||||
if ((x_res = ker.compare_x_2_object() (p, cv.right())) == EQUAL)
|
||||
{
|
||||
if ((x_res = ker.compare_x_2_object()(p, cv.right())) == EQUAL) {
|
||||
q = cv.right();
|
||||
}
|
||||
else
|
||||
{
|
||||
CGAL_precondition (x_res != LARGER);
|
||||
else {
|
||||
CGAL_precondition(x_res != LARGER);
|
||||
|
||||
q = cv.point_at_x (p);
|
||||
}
|
||||
}
|
||||
|
||||
// Compare p with the a point of the curve with the same x coordinate.
|
||||
return (ker.compare_y_2_object() (p, q));
|
||||
return (ker.compare_y_2_object()(p, q));
|
||||
}
|
||||
};
|
||||
|
||||
/*! Get a Compare_y_at_x_2 functor object. */
|
||||
Compare_y_at_x_2 compare_y_at_x_2_object () const
|
||||
{
|
||||
return Compare_y_at_x_2();
|
||||
}
|
||||
/*! Obtain a Compare_y_at_x_2 functor object. */
|
||||
Compare_y_at_x_2 compare_y_at_x_2_object() const
|
||||
{ return Compare_y_at_x_2(); }
|
||||
|
||||
class Compare_y_at_x_left_2
|
||||
{
|
||||
class Compare_y_at_x_left_2 {
|
||||
public:
|
||||
/*!
|
||||
* Compares the y value of two x-monotone curves immediately to the left
|
||||
/*! Compares the y value of two x-monotone curves immediately to the left
|
||||
* of their intersection point.
|
||||
* \param cv1 The first curve.
|
||||
* \param cv2 The second curve.
|
||||
|
|
@ -308,53 +260,39 @@ public:
|
|||
* \return The relative position of cv1 with respect to cv2 immdiately to
|
||||
* the left of p: SMALLER, LARGER or EQUAL.
|
||||
*/
|
||||
Comparison_result operator() (const X_monotone_curve_2& cv1,
|
||||
Comparison_result operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
const Point_2& p) const
|
||||
{
|
||||
// Make sure that p lies on both curves, and that both are defined to its
|
||||
// left (so their left endpoint is lexicographically smaller than p).
|
||||
CGAL_precondition (cv1.contains_point (p) &&
|
||||
cv2.contains_point (p));
|
||||
CGAL_precondition(cv1.contains_point(p) &&
|
||||
cv2.contains_point(p));
|
||||
|
||||
CGAL_precondition_code (
|
||||
Alg_kernel ker;
|
||||
);
|
||||
CGAL_precondition (ker.compare_xy_2_object() (p,
|
||||
cv1.left()) == LARGER &&
|
||||
ker.compare_xy_2_object() (p,
|
||||
cv2.left()) == LARGER);
|
||||
CGAL_precondition_code(Alg_kernel ker;);
|
||||
CGAL_precondition(ker.compare_xy_2_object()(p, cv1.left()) == LARGER &&
|
||||
ker.compare_xy_2_object()(p, cv2.left()) == LARGER);
|
||||
|
||||
// If one of the curves is vertical, it is below the other one.
|
||||
if (cv1.is_vertical())
|
||||
{
|
||||
if (cv2.is_vertical())
|
||||
// Both are vertical:
|
||||
return (EQUAL);
|
||||
else
|
||||
return (SMALLER);
|
||||
}
|
||||
else if (cv2.is_vertical())
|
||||
{
|
||||
return (LARGER);
|
||||
if (cv1.is_vertical()) {
|
||||
// Check whether both are vertical:
|
||||
if (cv2.is_vertical()) return EQUAL;
|
||||
else return SMALLER;
|
||||
}
|
||||
else if (cv2.is_vertical()) return LARGER;
|
||||
|
||||
// Compare the two curves immediately to the left of p:
|
||||
return (cv1.compare_to_left (cv2, p));
|
||||
return cv1.compare_to_left(cv2, p);
|
||||
}
|
||||
};
|
||||
|
||||
/*! Get a Compare_y_at_x_left_2 functor object. */
|
||||
Compare_y_at_x_left_2 compare_y_at_x_left_2_object () const
|
||||
{
|
||||
return Compare_y_at_x_left_2();
|
||||
}
|
||||
/*! Obtain a Compare_y_at_x_left_2 functor object. */
|
||||
Compare_y_at_x_left_2 compare_y_at_x_left_2_object() const
|
||||
{ return Compare_y_at_x_left_2(); }
|
||||
|
||||
class Compare_y_at_x_right_2
|
||||
{
|
||||
class Compare_y_at_x_right_2 {
|
||||
public:
|
||||
/*!
|
||||
* Compares the y value of two x-monotone curves immediately to the right
|
||||
/*! Compares the y value of two x-monotone curves immediately to the right
|
||||
* of their intersection point.
|
||||
* \param cv1 The first curve.
|
||||
* \param cv2 The second curve.
|
||||
|
|
@ -364,88 +302,63 @@ public:
|
|||
* \return The relative position of cv1 with respect to cv2 immdiately to
|
||||
* the right of p: SMALLER, LARGER or EQUAL.
|
||||
*/
|
||||
Comparison_result operator() (const X_monotone_curve_2& cv1,
|
||||
Comparison_result operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
const Point_2& p) const
|
||||
{
|
||||
// Make sure that p lies on both curves, and that both are defined to its
|
||||
// left (so their left endpoint is lexicographically smaller than p).
|
||||
CGAL_precondition (cv1.contains_point (p) &&
|
||||
cv2.contains_point (p));
|
||||
|
||||
CGAL_precondition_code (
|
||||
Alg_kernel ker;
|
||||
);
|
||||
|
||||
CGAL_precondition (ker.compare_xy_2_object() (p,
|
||||
cv1.right()) == SMALLER &&
|
||||
ker.compare_xy_2_object() (p,
|
||||
cv2.right()) == SMALLER);
|
||||
CGAL_precondition(cv1.contains_point(p) && cv2.contains_point(p));
|
||||
CGAL_precondition_code(Alg_kernel ker;);
|
||||
CGAL_precondition(ker.compare_xy_2_object()(p, cv1.right()) == SMALLER &&
|
||||
ker.compare_xy_2_object()(p, cv2.right()) == SMALLER);
|
||||
|
||||
// If one of the curves is vertical, it is above the other one.
|
||||
if (cv1.is_vertical())
|
||||
{
|
||||
if (cv2.is_vertical())
|
||||
// Both are vertical:
|
||||
return (EQUAL);
|
||||
else
|
||||
return (LARGER);
|
||||
}
|
||||
else if (cv2.is_vertical())
|
||||
{
|
||||
return (SMALLER);
|
||||
if (cv1.is_vertical()) {
|
||||
// Check whether both are vertical:
|
||||
if (cv2.is_vertical()) return EQUAL;
|
||||
else return LARGER;
|
||||
}
|
||||
else if (cv2.is_vertical()) return SMALLER;
|
||||
|
||||
// Compare the two curves immediately to the right of p:
|
||||
return (cv1.compare_to_right (cv2, p));
|
||||
return cv1.compare_to_right(cv2, p);
|
||||
}
|
||||
};
|
||||
|
||||
/*! Get a Compare_y_at_x_right_2 functor object. */
|
||||
Compare_y_at_x_right_2 compare_y_at_x_right_2_object () const
|
||||
{
|
||||
return Compare_y_at_x_right_2();
|
||||
}
|
||||
/*! Obtain a Compare_y_at_x_right_2 functor object. */
|
||||
Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const
|
||||
{ return Compare_y_at_x_right_2(); }
|
||||
|
||||
class Equal_2
|
||||
{
|
||||
class Equal_2 {
|
||||
public:
|
||||
/*!
|
||||
* Check if the two x-monotone curves are the same (have the same graph).
|
||||
/*! Check whether the two x-monotone curves are the same (have the same graph).
|
||||
* \param cv1 The first curve.
|
||||
* \param cv2 The second curve.
|
||||
* \return (true) if the two curves are the same; (false) otherwise.
|
||||
*/
|
||||
bool operator() (const X_monotone_curve_2& cv1,
|
||||
bool operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2) const
|
||||
{
|
||||
if (&cv1 == &cv2)
|
||||
return (true);
|
||||
|
||||
return (cv1.equals (cv2));
|
||||
if (&cv1 == &cv2) return true;
|
||||
return cv1.equals(cv2);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Check if the two points are the same.
|
||||
/*! Check whether the two points are the same.
|
||||
* \param p1 The first point.
|
||||
* \param p2 The second point.
|
||||
* \return (true) if the two point are the same; (false) otherwise.
|
||||
*/
|
||||
bool operator() (const Point_2& p1, const Point_2& p2) const
|
||||
{
|
||||
if (&p1 == &p2)
|
||||
return (true);
|
||||
bool operator()(const Point_2& p1, const Point_2& p2) const {
|
||||
if (&p1 == &p2) return (true);
|
||||
|
||||
Alg_kernel ker;
|
||||
return (ker.compare_xy_2_object() (p1, p2) == EQUAL);
|
||||
return(ker.compare_xy_2_object()(p1, p2) == EQUAL);
|
||||
}
|
||||
};
|
||||
|
||||
/*! Get an Equal_2 functor object. */
|
||||
Equal_2 equal_2_object () const
|
||||
{
|
||||
return Equal_2();
|
||||
}
|
||||
/*! Obtain an Equal_2 functor object. */
|
||||
Equal_2 equal_2_object() const { return Equal_2(); }
|
||||
//@}
|
||||
|
||||
/// \name Intersections, subdivisions, and mergings
|
||||
|
|
@ -455,7 +368,7 @@ public:
|
|||
* A functor for subdividing curves into x-monotone curves.
|
||||
*/
|
||||
class Make_x_monotone_2 {
|
||||
typedef Arr_conic_traits_2 <Rat_kernel_, Alg_kernel_, Nt_traits_> Self;
|
||||
typedef Arr_conic_traits_2<Rat_kernel, Alg_kernel, Nt_traits> Self;
|
||||
|
||||
public:
|
||||
/*! Subdivide a given conic curve (or conic arc) into x-monotone subcurves
|
||||
|
|
@ -467,8 +380,7 @@ public:
|
|||
* \return the past-the-end iterator.
|
||||
*/
|
||||
template <typename OutputIterator>
|
||||
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
|
||||
{
|
||||
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const {
|
||||
typedef boost::variant<Point_2, X_monotone_curve_2>
|
||||
Make_x_monotone_result;
|
||||
|
||||
|
|
@ -524,11 +436,11 @@ public:
|
|||
// tangnecy points (or both lies above it).
|
||||
int ind_first = 0;
|
||||
int ind_second = 1;
|
||||
Alg_kernel_ ker;
|
||||
typename Alg_kernel_::Line_2 line =
|
||||
Alg_kernel ker;
|
||||
typename Alg_kernel::Line_2 line =
|
||||
ker.construct_line_2_object()(vtan_ps[0], vtan_ps[1]);
|
||||
const Comparison_result start_pos =
|
||||
ker.compare_y_at_x_2_object() (cv.source(), line);
|
||||
ker.compare_y_at_x_2_object()(cv.source(), line);
|
||||
const Comparison_result order_vpts =
|
||||
ker.compare_x_2_object()(vtan_ps[0], vtan_ps[1]);
|
||||
|
||||
|
|
@ -566,34 +478,26 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/*! Get a Make_x_monotone_2 functor object. */
|
||||
/*! Obtain a Make_x_monotone_2 functor object. */
|
||||
Make_x_monotone_2 make_x_monotone_2_object() const
|
||||
{ return Make_x_monotone_2(); }
|
||||
|
||||
class Split_2
|
||||
{
|
||||
class Split_2 {
|
||||
public:
|
||||
/*!
|
||||
* Split a given x-monotone curve at a given point into two sub-curves.
|
||||
/*! Split a given x-monotone curve at a given point into two sub-curves.
|
||||
* \param cv The curve to split
|
||||
* \param p The split point.
|
||||
* \param c1 Output: The left resulting subcurve (p is its right endpoint).
|
||||
* \param c2 Output: The right resulting subcurve (p is its left endpoint).
|
||||
* \pre p lies on cv but is not one of its end-points.
|
||||
*/
|
||||
void operator() (const X_monotone_curve_2& cv, const Point_2 & p,
|
||||
void operator()(const X_monotone_curve_2& cv, const Point_2 & p,
|
||||
X_monotone_curve_2& c1, X_monotone_curve_2& c2) const
|
||||
{
|
||||
cv.split (p, c1, c2);
|
||||
return;
|
||||
}
|
||||
{ cv.split(p, c1, c2); }
|
||||
};
|
||||
|
||||
/*! Get a Split_2 functor object. */
|
||||
Split_2 split_2_object () const
|
||||
{
|
||||
return Split_2();
|
||||
}
|
||||
/*! Obtain a Split_2 functor object. */
|
||||
Split_2 split_2_object() const { return Split_2(); }
|
||||
|
||||
class Intersect_2 {
|
||||
private:
|
||||
|
|
@ -615,17 +519,15 @@ public:
|
|||
OutputIterator operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
OutputIterator oi) const
|
||||
{ return (cv1.intersect(cv2, _inter_map, oi)); }
|
||||
{ return cv1.intersect(cv2, _inter_map, oi); }
|
||||
};
|
||||
|
||||
/*! Get an Intersect_2 functor object. */
|
||||
Intersect_2 intersect_2_object () const { return (Intersect_2(inter_map)); }
|
||||
/*! Obtain an Intersect_2 functor object. */
|
||||
Intersect_2 intersect_2_object() const { return (Intersect_2(inter_map)); }
|
||||
|
||||
class Are_mergeable_2
|
||||
{
|
||||
class Are_mergeable_2 {
|
||||
public:
|
||||
/*!
|
||||
* Check whether it is possible to merge two given x-monotone curves.
|
||||
/*! Check whether it is possible to merge two given x-monotone curves.
|
||||
* \param cv1 The first curve.
|
||||
* \param cv2 The second curve.
|
||||
* \return (true) if the two curves are mergeable - if they are supported
|
||||
|
|
@ -633,22 +535,17 @@ public:
|
|||
*/
|
||||
bool operator() (const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2) const
|
||||
{
|
||||
return (cv1.can_merge_with (cv2));
|
||||
}
|
||||
{ return cv1.can_merge_with(cv2); }
|
||||
};
|
||||
|
||||
/*! Get an Are_mergeable_2 functor object. */
|
||||
Are_mergeable_2 are_mergeable_2_object () const
|
||||
{
|
||||
return Are_mergeable_2();
|
||||
}
|
||||
/*! Obtain an Are_mergeable_2 functor object. */
|
||||
Are_mergeable_2 are_mergeable_2_object() const
|
||||
{ return Are_mergeable_2(); }
|
||||
|
||||
/*! \class Merge_2
|
||||
* A functor that merges two x-monotone arcs into one.
|
||||
*/
|
||||
class Merge_2
|
||||
{
|
||||
class Merge_2 {
|
||||
protected:
|
||||
typedef Arr_conic_traits_2<Rat_kernel, Alg_kernel, Nt_traits> Traits;
|
||||
|
||||
|
|
@ -663,14 +560,13 @@ public:
|
|||
friend class Arr_conic_traits_2<Rat_kernel, Alg_kernel, Nt_traits>;
|
||||
|
||||
public:
|
||||
/*!
|
||||
* Merge two given x-monotone curves into a single curve (segment).
|
||||
/*! Merge two given x-monotone curves into a single curve (segment).
|
||||
* \param cv1 The first curve.
|
||||
* \param cv2 The second curve.
|
||||
* \param c Output: The merged curve.
|
||||
* \pre The two curves are mergeable.
|
||||
*/
|
||||
void operator() (const X_monotone_curve_2& cv1,
|
||||
void operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
X_monotone_curve_2& c) const
|
||||
{
|
||||
|
|
@ -682,10 +578,7 @@ public:
|
|||
};
|
||||
|
||||
/*! Obtain a Merge_2 functor object. */
|
||||
Merge_2 merge_2_object() const
|
||||
{
|
||||
return Merge_2(this);
|
||||
}
|
||||
Merge_2 merge_2_object() const { return Merge_2(this); }
|
||||
|
||||
//@}
|
||||
|
||||
|
|
@ -693,35 +586,26 @@ public:
|
|||
//@{
|
||||
typedef double Approximate_number_type;
|
||||
|
||||
class Approximate_2
|
||||
{
|
||||
class Approximate_2 {
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Return an approximation of a point coordinate.
|
||||
/*! Return an approximation of a point coordinate.
|
||||
* \param p The exact point.
|
||||
* \param i The coordinate index (either 0 or 1).
|
||||
* \pre i is either 0 or 1.
|
||||
* \return An approximation of p's x-coordinate (if i == 0), or an
|
||||
* approximation of p's y-coordinate (if i == 1).
|
||||
*/
|
||||
Approximate_number_type operator() (const Point_2& p,
|
||||
int i) const
|
||||
{
|
||||
CGAL_precondition (i == 0 || i == 1);
|
||||
Approximate_number_type operator()(const Point_2& p, int i) const {
|
||||
CGAL_precondition(i == 0 || i == 1);
|
||||
|
||||
if (i == 0)
|
||||
return (CGAL::to_double(p.x()));
|
||||
else
|
||||
return (CGAL::to_double(p.y()));
|
||||
if (i == 0) return CGAL::to_double(p.x());
|
||||
else return CGAL::to_double(p.y());
|
||||
}
|
||||
};
|
||||
|
||||
/*! Get an Approximate_2 functor object. */
|
||||
/*! Obtain an Approximate_2 functor object. */
|
||||
Approximate_2 approximate_2_object () const
|
||||
{
|
||||
return Approximate_2();
|
||||
}
|
||||
{ return Approximate_2(); }
|
||||
|
||||
//! Functor
|
||||
class Construct_x_monotone_curve_2 {
|
||||
|
|
@ -736,7 +620,7 @@ public:
|
|||
{ return (X_monotone_curve_2(p, q)); }
|
||||
};
|
||||
|
||||
/*! Get a Construct_x_monotone_curve_2 functor object. */
|
||||
/*! Obtain a Construct_x_monotone_curve_2 functor object. */
|
||||
Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object () const
|
||||
{ return Construct_x_monotone_curve_2(); }
|
||||
|
||||
|
|
@ -750,10 +634,10 @@ public:
|
|||
* \return A segment connecting p and q.
|
||||
*/
|
||||
Curve_2 operator()(const Point_2& p, const Point_2& q) const
|
||||
{ return (Curve_2(p, q)); }
|
||||
{ return Curve_2(p, q); }
|
||||
};
|
||||
|
||||
/*! Get a Construct_curve_2 functor object. */
|
||||
/*! Obtain a Construct_curve_2 functor object. */
|
||||
Construct_curve_2 construct_curve_2_object () const
|
||||
{ return Construct_curve_2(); }
|
||||
//@}
|
||||
|
|
@ -761,55 +645,39 @@ public:
|
|||
/// \name Functor definitions for the Boolean set-operation traits.
|
||||
//@{
|
||||
|
||||
class Compare_endpoints_xy_2
|
||||
{
|
||||
class Compare_endpoints_xy_2 {
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Compare the endpoints of an $x$-monotone curve lexicographically.
|
||||
/*! Compare the endpoints of an $x$-monotone curve lexicographically.
|
||||
* (assuming the curve has a designated source and target points).
|
||||
* \param cv The curve.
|
||||
* \return SMALLER if the curve is directed right;
|
||||
* LARGER if the curve is directed left.
|
||||
*/
|
||||
Comparison_result operator() (const X_monotone_curve_2& cv) const
|
||||
{
|
||||
if (cv.is_directed_right())
|
||||
return (SMALLER);
|
||||
else
|
||||
return (LARGER);
|
||||
Comparison_result operator() (const X_monotone_curve_2& cv) const {
|
||||
if (cv.is_directed_right()) return SMALLER;
|
||||
else return LARGER;
|
||||
}
|
||||
};
|
||||
|
||||
/*! Get a Compare_endpoints_xy_2 functor object. */
|
||||
/*! Obtain a Compare_endpoints_xy_2 functor object. */
|
||||
Compare_endpoints_xy_2 compare_endpoints_xy_2_object() const
|
||||
{
|
||||
return Compare_endpoints_xy_2();
|
||||
}
|
||||
{ return Compare_endpoints_xy_2(); }
|
||||
|
||||
class Construct_opposite_2
|
||||
{
|
||||
class Construct_opposite_2 {
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Construct an opposite x-monotone (with swapped source and target).
|
||||
/*! Construct an opposite x-monotone (with swapped source and target).
|
||||
* \param cv The curve.
|
||||
* \return The opposite curve.
|
||||
*/
|
||||
X_monotone_curve_2 operator() (const X_monotone_curve_2& cv) const
|
||||
{
|
||||
return (cv.flip());
|
||||
}
|
||||
X_monotone_curve_2 operator()(const X_monotone_curve_2& cv) const
|
||||
{ return cv.flip(); }
|
||||
};
|
||||
|
||||
/*! Get a Construct_opposite_2 functor object. */
|
||||
/*! Obtain a Construct_opposite_2 functor object. */
|
||||
Construct_opposite_2 construct_opposite_2_object() const
|
||||
{
|
||||
return Construct_opposite_2();
|
||||
}
|
||||
{ return Construct_opposite_2(); }
|
||||
|
||||
class Trim_2
|
||||
{
|
||||
class Trim_2 {
|
||||
protected:
|
||||
typedef Arr_conic_traits_2<Rat_kernel, Alg_kernel, Nt_traits> Traits;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue