mirror of https://github.com/CGAL/cgal
Changed Cartesian to Simple_cartesian. Used size_t for Multiplicity. Properly indented and cleaned up.
This commit is contained in:
parent
48262b8068
commit
5812c1d6b5
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include <CGAL/tags.h>
|
||||
#include <CGAL/Arr_tags.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Arr_geometry_traits/Circle_segment_2.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -41,31 +41,31 @@ namespace CGAL {
|
|||
template <typename Kernel_, bool Filter = true>
|
||||
class Arr_circle_segment_traits_2 {
|
||||
public:
|
||||
typedef Kernel_ Kernel;
|
||||
typedef typename Kernel::FT NT;
|
||||
typedef typename Kernel::Point_2 Rational_point_2;
|
||||
typedef typename Kernel::Segment_2 Rational_segment_2;
|
||||
typedef typename Kernel::Circle_2 Rational_circle_2;
|
||||
typedef _One_root_point_2<NT, Filter> Point_2;
|
||||
typedef typename Point_2::CoordNT CoordNT;
|
||||
typedef _Circle_segment_2<Kernel, Filter> Curve_2;
|
||||
typedef _X_monotone_circle_segment_2<Kernel, Filter> X_monotone_curve_2;
|
||||
typedef unsigned int Multiplicity;
|
||||
typedef Arr_circle_segment_traits_2<Kernel, Filter> Self;
|
||||
using Kernel = Kernel_;
|
||||
using NT = typename Kernel::FT;
|
||||
using Rational_point_2 = typename Kernel::Point_2;
|
||||
using Rational_segment_2 = typename Kernel::Segment_2;
|
||||
using Rational_circle_2 = typename Kernel::Circle_2;
|
||||
using Point_2 = _One_root_point_2<NT, Filter>;
|
||||
using CoordNT = typename Point_2::CoordNT;
|
||||
using Curve_2 = _Circle_segment_2<Kernel, Filter>;
|
||||
using X_monotone_curve_2 = _X_monotone_circle_segment_2<Kernel, Filter>;
|
||||
using Multiplicity = std::size_t;
|
||||
using Self = Arr_circle_segment_traits_2<Kernel, Filter>;
|
||||
|
||||
// Category tags:
|
||||
typedef Tag_true Has_left_category;
|
||||
typedef Tag_true Has_merge_category;
|
||||
typedef Tag_false Has_do_intersect_category;
|
||||
using Has_left_category = Tag_true;
|
||||
using Has_merge_category = Tag_true;
|
||||
using Has_do_intersect_category = Tag_false;
|
||||
|
||||
typedef Arr_oblivious_side_tag Left_side_category;
|
||||
typedef Arr_oblivious_side_tag Bottom_side_category;
|
||||
typedef Arr_oblivious_side_tag Top_side_category;
|
||||
typedef Arr_oblivious_side_tag Right_side_category;
|
||||
using Left_side_category = Arr_oblivious_side_tag;
|
||||
using Bottom_side_category = Arr_oblivious_side_tag;
|
||||
using Top_side_category = Arr_oblivious_side_tag;
|
||||
using Right_side_category = Arr_oblivious_side_tag;
|
||||
|
||||
protected:
|
||||
// Type definition for the intersection points mapping.
|
||||
typedef typename X_monotone_curve_2::Intersection_map Intersection_map;
|
||||
using Intersection_map = typename X_monotone_curve_2::Intersection_map;
|
||||
|
||||
mutable Intersection_map inter_map; // Mapping pairs of curve IDs to their
|
||||
// intersection points.
|
||||
|
|
@ -78,8 +78,7 @@ public:
|
|||
{}
|
||||
|
||||
/*! obtains the next curve index. */
|
||||
static unsigned int get_index ()
|
||||
{
|
||||
static unsigned int get_index() {
|
||||
#ifdef CGAL_NO_ATOMIC
|
||||
static unsigned int index;
|
||||
#else
|
||||
|
|
@ -91,8 +90,7 @@ public:
|
|||
/// \name Basic functor definitions.
|
||||
//@{
|
||||
|
||||
class Compare_x_2
|
||||
{
|
||||
class Compare_x_2 {
|
||||
public:
|
||||
/*! compares the \f$x\f$-coordinates of two points.
|
||||
* \param p1 The first point.
|
||||
|
|
@ -101,23 +99,17 @@ public:
|
|||
* SMALLER if x(p1) < x(p2);
|
||||
* EQUAL if x(p1) = x(p2).
|
||||
*/
|
||||
Comparison_result operator() (const Point_2& p1, const Point_2& p2) const
|
||||
{
|
||||
if (p1.identical (p2))
|
||||
return (EQUAL);
|
||||
Comparison_result operator() (const Point_2& p1, const Point_2& p2) const {
|
||||
if (p1.identical (p2)) return (EQUAL);
|
||||
|
||||
return (CGAL::compare (p1.x(), p2.x()));
|
||||
}
|
||||
};
|
||||
|
||||
/*! obtains a `Compare_x_2` functor object. */
|
||||
Compare_x_2 compare_x_2_object () const
|
||||
{
|
||||
return Compare_x_2();
|
||||
}
|
||||
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.
|
||||
* \param p1 The first point.
|
||||
|
|
@ -126,15 +118,11 @@ public:
|
|||
* 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
|
||||
{
|
||||
if (p1.identical (p2))
|
||||
return (EQUAL);
|
||||
Comparison_result operator() (const Point_2& p1, const Point_2& p2) const {
|
||||
if (p1.identical (p2)) return (EQUAL);
|
||||
|
||||
Comparison_result res = CGAL::compare (p1.x(), p2.x());
|
||||
|
||||
if (res != EQUAL)
|
||||
return (res);
|
||||
Comparison_result res = CGAL::compare(p1.x(), p2.x());
|
||||
if (res != EQUAL) return (res);
|
||||
|
||||
return (CGAL::compare (p1.y(), p2.y()));
|
||||
}
|
||||
|
|
@ -142,69 +130,51 @@ public:
|
|||
|
||||
/*! obtains a Compare_xy_2 functor object. */
|
||||
Compare_xy_2 compare_xy_2_object () const
|
||||
{
|
||||
return Compare_xy_2();
|
||||
}
|
||||
{ return Compare_xy_2(); }
|
||||
|
||||
class Construct_min_vertex_2
|
||||
{
|
||||
class Construct_min_vertex_2 {
|
||||
public:
|
||||
/*! obtains the left endpoint of the \f$x\f$-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());
|
||||
}
|
||||
{ return (cv.left()); }
|
||||
};
|
||||
|
||||
/*! obtains a `Construct_min_vertex_2` functor object. */
|
||||
Construct_min_vertex_2 construct_min_vertex_2_object () const
|
||||
{
|
||||
return Construct_min_vertex_2();
|
||||
}
|
||||
{ return Construct_min_vertex_2(); }
|
||||
|
||||
class Construct_max_vertex_2
|
||||
{
|
||||
class Construct_max_vertex_2 {
|
||||
public:
|
||||
/*! obtains the right endpoint of the \f$x\f$-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());
|
||||
}
|
||||
{ return (cv.right()); }
|
||||
};
|
||||
|
||||
/*! obtains a Construct_max_vertex_2 functor object. */
|
||||
Construct_max_vertex_2 construct_max_vertex_2_object () const
|
||||
{
|
||||
return Construct_max_vertex_2();
|
||||
}
|
||||
{ return Construct_max_vertex_2(); }
|
||||
|
||||
class Is_vertical_2
|
||||
{
|
||||
class Is_vertical_2 {
|
||||
public:
|
||||
/*! checks whether the given \f$x\f$-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());
|
||||
}
|
||||
{ return (cv.is_vertical()); }
|
||||
};
|
||||
|
||||
/*! obtains an `Is_vertical_2` functor object. */
|
||||
Is_vertical_2 is_vertical_2_object () const
|
||||
{
|
||||
return Is_vertical_2();
|
||||
}
|
||||
{ return Is_vertical_2(); }
|
||||
|
||||
class Compare_y_at_x_2
|
||||
{
|
||||
class Compare_y_at_x_2 {
|
||||
public:
|
||||
/*! returns the location of the given point with respect to the input curve.
|
||||
* \param cv The curve.
|
||||
|
|
@ -214,23 +184,19 @@ 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,
|
||||
const X_monotone_curve_2& cv) const
|
||||
{
|
||||
CGAL_precondition (cv.is_in_x_range (p));
|
||||
Comparison_result operator()(const Point_2& p,
|
||||
const X_monotone_curve_2& cv) const {
|
||||
CGAL_precondition (cv.is_in_x_range(p));
|
||||
|
||||
return (cv.point_position (p));
|
||||
return (cv.point_position(p));
|
||||
}
|
||||
};
|
||||
|
||||
/*! obtains 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();
|
||||
}
|
||||
{ return Compare_y_at_x_2(); }
|
||||
|
||||
class Compare_y_at_x_right_2
|
||||
{
|
||||
class Compare_y_at_x_right_2 {
|
||||
public:
|
||||
/*! compares the y value of two \f$x\f$-monotone curves immediately to the
|
||||
* right of their intersection point.
|
||||
|
|
@ -244,30 +210,29 @@ public:
|
|||
*/
|
||||
Comparison_result operator() (const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
const Point_2& p) const
|
||||
{
|
||||
const Point_2& p) const {
|
||||
// Make sure that p lies on both curves, and that both are defined to its
|
||||
// right (so their right endpoint is lexicographically larger than p).
|
||||
CGAL_precondition (cv1.point_position (p) == EQUAL &&
|
||||
cv2.point_position (p) == EQUAL);
|
||||
|
||||
if ((CGAL::compare (cv1.left().x(),cv1.right().x()) == EQUAL) &&
|
||||
(CGAL::compare (cv2.left().x(),cv2.right().x()) == EQUAL))
|
||||
{ //both cv1 and cv2 are vertical
|
||||
(CGAL::compare (cv2.left().x(),cv2.right().x()) == EQUAL)) {
|
||||
//both cv1 and cv2 are vertical
|
||||
CGAL_precondition (!(cv1.right()).equals(p) && !(cv2.right()).equals(p));
|
||||
}
|
||||
else if ((CGAL::compare (cv1.left().x(),cv1.right().x()) != EQUAL) &&
|
||||
(CGAL::compare (cv2.left().x(),cv2.right().x()) == EQUAL))
|
||||
{ //only cv1 is vertical
|
||||
(CGAL::compare (cv2.left().x(),cv2.right().x()) == EQUAL)) {
|
||||
//only cv1 is vertical
|
||||
CGAL_precondition (!(cv1.right()).equals(p));
|
||||
}
|
||||
else if ((CGAL::compare (cv1.left().x(),cv1.right().x()) == EQUAL) &&
|
||||
(CGAL::compare (cv2.left().x(),cv2.right().x()) != EQUAL))
|
||||
{ //only cv2 is vertical
|
||||
(CGAL::compare (cv2.left().x(),cv2.right().x()) != EQUAL)) {
|
||||
//only cv2 is vertical
|
||||
CGAL_precondition (!(cv2.right()).equals(p));
|
||||
}
|
||||
else
|
||||
{ //both cv1 and cv2 are non vertical
|
||||
else {
|
||||
//both cv1 and cv2 are non vertical
|
||||
CGAL_precondition (CGAL::compare (cv1.right().x(),p.x()) == LARGER &&
|
||||
CGAL::compare (cv2.right().x(),p.x()) == LARGER);
|
||||
}
|
||||
|
|
@ -278,12 +243,9 @@ public:
|
|||
|
||||
/*! obtains 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();
|
||||
}
|
||||
{ return Compare_y_at_x_right_2(); }
|
||||
|
||||
class Compare_y_at_x_left_2
|
||||
{
|
||||
class Compare_y_at_x_left_2 {
|
||||
public:
|
||||
/*! compares the \f$y\f$-value of two \f$x\f$-monotone curves immediately to
|
||||
* the left of their intersection point.
|
||||
|
|
@ -297,8 +259,7 @@ public:
|
|||
*/
|
||||
Comparison_result operator() (const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
const Point_2& p) const
|
||||
{
|
||||
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).
|
||||
|
||||
|
|
@ -306,25 +267,25 @@ public:
|
|||
cv2.point_position (p) == EQUAL);
|
||||
|
||||
if ((CGAL::compare (cv1.left().x(),cv1.right().x()) == EQUAL) &&
|
||||
(CGAL::compare (cv2.left().x(),cv2.right().x()) == EQUAL))
|
||||
{ //both cv1 and cv2 are vertical
|
||||
CGAL_precondition (!(cv1.left()).equals(p) && !(cv2.left()).equals(p));
|
||||
}
|
||||
else if ((CGAL::compare (cv1.left().x(),cv1.right().x()) != EQUAL) &&
|
||||
(CGAL::compare (cv2.left().x(),cv2.right().x()) == EQUAL))
|
||||
{ //only cv1 is vertical
|
||||
CGAL_precondition (!(cv1.left()).equals(p));
|
||||
}
|
||||
else if ((CGAL::compare (cv1.left().x(),cv1.right().x()) == EQUAL) &&
|
||||
(CGAL::compare (cv2.left().x(),cv2.right().x()) != EQUAL))
|
||||
{ //only cv2 is vertical
|
||||
CGAL_precondition (!(cv2.left()).equals(p));
|
||||
}
|
||||
else
|
||||
{ //both cv1 and cv2 are non vertical
|
||||
(CGAL::compare (cv2.left().x(),cv2.right().x()) == EQUAL)) {
|
||||
//both cv1 and cv2 are vertical
|
||||
CGAL_precondition (!(cv1.left()).equals(p) && !(cv2.left()).equals(p));
|
||||
}
|
||||
else if ((CGAL::compare (cv1.left().x(),cv1.right().x()) != EQUAL) &&
|
||||
(CGAL::compare (cv2.left().x(),cv2.right().x()) == EQUAL)) {
|
||||
//only cv1 is vertical
|
||||
CGAL_precondition (!(cv1.left()).equals(p));
|
||||
}
|
||||
else if ((CGAL::compare (cv1.left().x(),cv1.right().x()) == EQUAL) &&
|
||||
(CGAL::compare (cv2.left().x(),cv2.right().x()) != EQUAL)) {
|
||||
//only cv2 is vertical
|
||||
CGAL_precondition (!(cv2.left()).equals(p));
|
||||
}
|
||||
else {
|
||||
//both cv1 and cv2 are non vertical
|
||||
CGAL_precondition (CGAL::compare (cv1.left().x(),p.x()) == SMALLER &&
|
||||
CGAL::compare (cv2.left().x(),p.x()) == SMALLER);
|
||||
}
|
||||
}
|
||||
// Compare the two curves immediately to the left of p:
|
||||
return (cv1.compare_to_left (cv2, p));
|
||||
}
|
||||
|
|
@ -332,12 +293,9 @@ public:
|
|||
|
||||
/*! obtains 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();
|
||||
}
|
||||
{ return Compare_y_at_x_left_2(); }
|
||||
|
||||
class Equal_2
|
||||
{
|
||||
class Equal_2 {
|
||||
public:
|
||||
/*! checks if the two \f$x\f$-monotone curves are the same (have the same
|
||||
* graph).
|
||||
|
|
@ -346,10 +304,8 @@ public:
|
|||
* \return (true) if the two curves are the same; (false) otherwise.
|
||||
*/
|
||||
bool operator() (const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2) const
|
||||
{
|
||||
if (&cv1 == &cv2)
|
||||
return (true);
|
||||
const X_monotone_curve_2& cv2) const {
|
||||
if (&cv1 == &cv2) return (true);
|
||||
|
||||
return (cv1.equals (cv2));
|
||||
}
|
||||
|
|
@ -360,24 +316,20 @@ public:
|
|||
* \return (true) if the two point are the same; (false) otherwise.
|
||||
*/
|
||||
bool operator() (const Point_2& p1, const Point_2& p2) const
|
||||
{
|
||||
return (p1.equals (p2));
|
||||
}
|
||||
{ return (p1.equals (p2)); }
|
||||
};
|
||||
|
||||
/*! obtains an `Equal_2` functor object. */
|
||||
Equal_2 equal_2_object () const
|
||||
{
|
||||
return Equal_2();
|
||||
}
|
||||
{ return Equal_2(); }
|
||||
//@}
|
||||
|
||||
/// \name Functor definitions for approximations. Used by the landmarks
|
||||
// point-location strategy and the drawing procedure.
|
||||
//@{
|
||||
typedef double Approximate_number_type;
|
||||
typedef CGAL::Cartesian<Approximate_number_type> Approximate_kernel;
|
||||
typedef Approximate_kernel::Point_2 Approximate_point_2;
|
||||
using Approximate_number_type = double;
|
||||
using Approximate_kernel = CGAL::Simple_cartesian<Approximate_number_type>;
|
||||
using Approximate_point_2 = Approximate_kernel::Point_2;
|
||||
|
||||
class Approximate_2 {
|
||||
protected:
|
||||
|
|
@ -557,7 +509,7 @@ public:
|
|||
*/
|
||||
class Make_x_monotone_2 {
|
||||
private:
|
||||
typedef Arr_circle_segment_traits_2<Kernel_, Filter> Self;
|
||||
using Self = Arr_circle_segment_traits_2<Kernel_, Filter>;
|
||||
|
||||
bool m_use_cache;
|
||||
|
||||
|
|
@ -573,8 +525,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 {
|
||||
// Increment the serial number of the curve cv, which will serve as its
|
||||
// unique identifier.
|
||||
unsigned int index = 0;
|
||||
|
|
@ -591,7 +542,7 @@ public:
|
|||
|
||||
// Check the case of a degenerate circle (a point).
|
||||
const typename Kernel::Circle_2& circ = cv.supporting_circle();
|
||||
CGAL::Sign sign_rad = CGAL::sign (circ.squared_radius());
|
||||
CGAL::Sign sign_rad = CGAL::sign (circ.squared_radius());
|
||||
CGAL_precondition (sign_rad != NEGATIVE);
|
||||
|
||||
if (sign_rad == ZERO) {
|
||||
|
|
@ -603,8 +554,8 @@ public:
|
|||
|
||||
// The curve is circular: compute the to vertical tangency points
|
||||
// of the supporting circle.
|
||||
Point_2 vpts[2];
|
||||
unsigned int n_vpts = cv.vertical_tangency_points (vpts);
|
||||
Point_2 vpts[2];
|
||||
unsigned int n_vpts = cv.vertical_tangency_points (vpts);
|
||||
|
||||
if (cv.is_full()) {
|
||||
CGAL_assertion (n_vpts == 2);
|
||||
|
|
@ -674,8 +625,7 @@ public:
|
|||
Make_x_monotone_2 make_x_monotone_2_object() const
|
||||
{ return Make_x_monotone_2(m_use_cache); }
|
||||
|
||||
class Split_2
|
||||
{
|
||||
class Split_2 {
|
||||
public:
|
||||
|
||||
/*! splits a given \f$x\f$-monotone curve at a given point into two
|
||||
|
|
@ -687,8 +637,7 @@ public:
|
|||
* \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,
|
||||
X_monotone_curve_2& c1, X_monotone_curve_2& c2) const
|
||||
{
|
||||
X_monotone_curve_2& c1, X_monotone_curve_2& c2) const {
|
||||
CGAL_precondition (cv.point_position(p)==EQUAL &&
|
||||
! p.equals (cv.source()) &&
|
||||
! p.equals (cv.target()));
|
||||
|
|
@ -699,10 +648,7 @@ public:
|
|||
};
|
||||
|
||||
/*! obtains a `Split_2` functor object. */
|
||||
Split_2 split_2_object () const
|
||||
{
|
||||
return Split_2();
|
||||
}
|
||||
Split_2 split_2_object () const { return Split_2(); }
|
||||
|
||||
class Intersect_2 {
|
||||
private:
|
||||
|
|
@ -730,8 +676,7 @@ public:
|
|||
/*! obtains 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:
|
||||
/*! checks whether it is possible to merge two given \f$x\f$-monotone curves.
|
||||
* \param cv1 The first curve.
|
||||
|
|
@ -742,24 +687,19 @@ 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)); }
|
||||
};
|
||||
|
||||
/*! obtains an `Are_mergeable_2` functor object. */
|
||||
Are_mergeable_2 are_mergeable_2_object () const
|
||||
{
|
||||
return Are_mergeable_2();
|
||||
}
|
||||
{ return Are_mergeable_2(); }
|
||||
|
||||
/*! \class Merge_2
|
||||
* A functor that merges two \f$x\f$-monotone arcs into one.
|
||||
*/
|
||||
class Merge_2
|
||||
{
|
||||
class Merge_2 {
|
||||
protected:
|
||||
typedef Arr_circle_segment_traits_2<Kernel, Filter> Traits;
|
||||
using Traits = Arr_circle_segment_traits_2<Kernel, Filter>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits* m_traits;
|
||||
|
|
@ -780,8 +720,7 @@ public:
|
|||
*/
|
||||
void operator() (const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
X_monotone_curve_2& c) const
|
||||
{
|
||||
X_monotone_curve_2& c) const {
|
||||
CGAL_precondition(m_traits->are_mergeable_2_object()(cv2, cv1));
|
||||
|
||||
c = cv1;
|
||||
|
|
@ -790,20 +729,15 @@ public:
|
|||
};
|
||||
|
||||
/*! obtains 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); }
|
||||
|
||||
class Compare_endpoints_xy_2
|
||||
{
|
||||
class Compare_endpoints_xy_2 {
|
||||
public:
|
||||
/*! compares lexicogrphic the endpoints of a \f$x\f$-monotone curve.
|
||||
* \param cv the curve
|
||||
* \return `SMALLER` if the curve is directed right, else return `LARGER`.
|
||||
*/
|
||||
Comparison_result operator()(const X_monotone_curve_2& cv) const
|
||||
{
|
||||
Comparison_result operator()(const X_monotone_curve_2& cv) const {
|
||||
if(cv.is_directed_right())
|
||||
return(SMALLER);
|
||||
return (LARGER);
|
||||
|
|
@ -812,32 +746,25 @@ public:
|
|||
|
||||
/*! obtains 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:
|
||||
/*! constructs an opposite \f$x\f$-monotone curve.
|
||||
* \param cv the curve
|
||||
* \return an opposite \f$x\f$-monotone curve.
|
||||
*/
|
||||
X_monotone_curve_2 operator()(const X_monotone_curve_2& cv) const
|
||||
{
|
||||
return cv.construct_opposite();
|
||||
}
|
||||
{ return cv.construct_opposite(); }
|
||||
};
|
||||
|
||||
/*! obtains 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 {
|
||||
protected:
|
||||
typedef Arr_circle_segment_traits_2<Kernel, Filter> Traits;
|
||||
using Traits = Arr_circle_segment_traits_2<Kernel, Filter>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -860,8 +787,7 @@ public:
|
|||
*/
|
||||
X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv,
|
||||
const Point_2& src,
|
||||
const Point_2& tgt)const
|
||||
{
|
||||
const Point_2& tgt)const {
|
||||
// make functor objects
|
||||
CGAL_precondition_code(Compare_y_at_x_2 compare_y_at_x_2 =
|
||||
m_traits.compare_y_at_x_2_object());
|
||||
|
|
@ -885,7 +811,6 @@ public:
|
|||
Trim_2 trim_2_object() const { return Trim_2(*this); }
|
||||
|
||||
// @}
|
||||
|
||||
};
|
||||
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
|
|
@ -40,55 +40,54 @@
|
|||
namespace CGAL {
|
||||
|
||||
namespace internal{
|
||||
template <class CircularKernel>
|
||||
class Non_x_monotonic_Circular_arc_2
|
||||
: public CircularKernel::Circular_arc_2
|
||||
{
|
||||
typedef typename CircularKernel::FT FT;
|
||||
typedef typename CircularKernel::Point_2 Point_2;
|
||||
typedef typename CircularKernel::Line_2 Line_2;
|
||||
typedef typename CircularKernel::Circle_2 Circle_2;
|
||||
typedef typename CircularKernel::Circular_arc_point_2
|
||||
Circular_arc_point_2;
|
||||
|
||||
typedef typename CircularKernel::Circular_arc_2 Base;
|
||||
template <typename CircularKernel>
|
||||
class Non_x_monotonic_Circular_arc_2 :
|
||||
public CircularKernel::Circular_arc_2 {
|
||||
using FT = typename CircularKernel::FT;
|
||||
using Point_2 = typename CircularKernel::Point_2;
|
||||
using Line_2 = typename CircularKernel::Line_2;
|
||||
using Circle_2 = typename CircularKernel::Circle_2;
|
||||
using Circular_arc_point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
|
||||
using Base = typename CircularKernel::Circular_arc_2;
|
||||
|
||||
public:
|
||||
Non_x_monotonic_Circular_arc_2(): Base(){}
|
||||
|
||||
Non_x_monotonic_Circular_arc_2(const Circle_2 &c): Base(c){}
|
||||
Non_x_monotonic_Circular_arc_2(const Circle_2& c): Base(c){}
|
||||
// Not Documented
|
||||
Non_x_monotonic_Circular_arc_2(const Circle_2 &support,
|
||||
const Line_2 &l1, const bool b_l1,
|
||||
const Line_2 &l2, const bool b_l2)
|
||||
: Base(support,l1,b_l1,l2,b_l2){}
|
||||
Non_x_monotonic_Circular_arc_2(const Circle_2& support,
|
||||
const Line_2& l1, const bool b_l1,
|
||||
const Line_2& l2, const bool b_l2) :
|
||||
Base(support,l1,b_l1,l2,b_l2){}
|
||||
|
||||
// Not Documented
|
||||
Non_x_monotonic_Circular_arc_2(const Circle_2 &c,
|
||||
const Circle_2 &c1, const bool b_1,
|
||||
const Circle_2 &c2, const bool b_2)
|
||||
: Base(c,c1,b_1,c2,b_2)
|
||||
Non_x_monotonic_Circular_arc_2(const Circle_2& c,
|
||||
const Circle_2& c1, const bool b_1,
|
||||
const Circle_2& c2, const bool b_2) :
|
||||
Base(c,c1,b_1,c2,b_2)
|
||||
{}
|
||||
|
||||
Non_x_monotonic_Circular_arc_2(const Point_2 &start,
|
||||
const Point_2 &middle,
|
||||
const Point_2 &end)
|
||||
: Base(start,middle,end)
|
||||
Non_x_monotonic_Circular_arc_2(const Point_2& start,
|
||||
const Point_2& middle,
|
||||
const Point_2& end) :
|
||||
Base(start,middle,end)
|
||||
{}
|
||||
|
||||
Non_x_monotonic_Circular_arc_2(const Circle_2 &support,
|
||||
const Circular_arc_point_2 &begin,
|
||||
const Circular_arc_point_2 &end)
|
||||
: Base(support,begin,end)
|
||||
Non_x_monotonic_Circular_arc_2(const Circle_2& support,
|
||||
const Circular_arc_point_2& begin,
|
||||
const Circular_arc_point_2& end) :
|
||||
Base(support,begin,end)
|
||||
{}
|
||||
|
||||
Non_x_monotonic_Circular_arc_2(const Point_2 &start,
|
||||
const Point_2 &end,
|
||||
const FT &bulge)
|
||||
: Base(start,end,bulge)
|
||||
Non_x_monotonic_Circular_arc_2(const Point_2& start,
|
||||
const Point_2& end,
|
||||
const FT& bulge) :
|
||||
Base(start,end,bulge)
|
||||
{}
|
||||
|
||||
Non_x_monotonic_Circular_arc_2(const Base& a) : Base(a) {}
|
||||
Non_x_monotonic_Circular_arc_2(const Base& a) : Base(a) {}
|
||||
};
|
||||
|
||||
} //namespace internal
|
||||
|
|
@ -98,45 +97,40 @@ public:
|
|||
|
||||
template < typename CircularKernel >
|
||||
class Arr_circular_arc_traits_2 {
|
||||
|
||||
CircularKernel ck;
|
||||
|
||||
public:
|
||||
using Kernel = CircularKernel;
|
||||
using Curve_2 = internal::Non_x_monotonic_Circular_arc_2<CircularKernel>;
|
||||
using X_monotone_curve_2 = typename CircularKernel::Circular_arc_2;
|
||||
|
||||
typedef CircularKernel Kernel;
|
||||
typedef internal::Non_x_monotonic_Circular_arc_2<CircularKernel> Curve_2;
|
||||
typedef typename CircularKernel::Circular_arc_2 X_monotone_curve_2;
|
||||
using Point = typename CircularKernel::Circular_arc_point_2;
|
||||
using Point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
|
||||
typedef typename CircularKernel::Circular_arc_point_2 Point;
|
||||
typedef typename CircularKernel::Circular_arc_point_2 Point_2;
|
||||
using Multiplicity = std::size_t;
|
||||
|
||||
typedef unsigned int Multiplicity;
|
||||
using Has_left_category = CGAL::Tag_false;
|
||||
using Has_merge_category = CGAL::Tag_false;
|
||||
using Has_do_intersect_category = CGAL::Tag_false;
|
||||
|
||||
typedef CGAL::Tag_false Has_left_category;
|
||||
typedef CGAL::Tag_false Has_merge_category;
|
||||
typedef CGAL::Tag_false Has_do_intersect_category;
|
||||
using Left_side_category = Arr_oblivious_side_tag;
|
||||
using Bottom_side_category = Arr_oblivious_side_tag;
|
||||
using Top_side_category = Arr_oblivious_side_tag;
|
||||
using Right_side_category = Arr_oblivious_side_tag;
|
||||
|
||||
typedef Arr_oblivious_side_tag Left_side_category;
|
||||
typedef Arr_oblivious_side_tag Bottom_side_category;
|
||||
typedef Arr_oblivious_side_tag Top_side_category;
|
||||
typedef Arr_oblivious_side_tag Right_side_category;
|
||||
Arr_circular_arc_traits_2(const CircularKernel& k = CircularKernel()) : ck(k) {}
|
||||
|
||||
Arr_circular_arc_traits_2(const CircularKernel &k = CircularKernel())
|
||||
: ck(k) {}
|
||||
|
||||
typedef typename CircularKernel::Compare_x_2 Compare_x_2;
|
||||
typedef typename CircularKernel::Compare_xy_2 Compare_xy_2;
|
||||
typedef typename CircularKernel::Compare_y_at_x_2 Compare_y_at_x_2;
|
||||
typedef typename CircularKernel::Compare_y_to_right_2 Compare_y_at_x_right_2;
|
||||
typedef typename CircularKernel::Construct_circular_max_vertex_2
|
||||
Construct_max_vertex_2;
|
||||
typedef typename CircularKernel::Construct_circular_min_vertex_2
|
||||
Construct_min_vertex_2;
|
||||
typedef typename CircularKernel::Equal_2 Equal_2;
|
||||
using Compare_x_2 = typename CircularKernel::Compare_x_2;
|
||||
using Compare_xy_2 = typename CircularKernel::Compare_xy_2;
|
||||
using Compare_y_at_x_2 = typename CircularKernel::Compare_y_at_x_2;
|
||||
using Compare_y_at_x_right_2 = typename CircularKernel::Compare_y_to_right_2;
|
||||
using Construct_max_vertex_2 = typename CircularKernel::Construct_circular_max_vertex_2;
|
||||
using Construct_min_vertex_2 = typename CircularKernel::Construct_circular_min_vertex_2;
|
||||
using Equal_2 = typename CircularKernel::Equal_2;
|
||||
// typedef typename CircularKernel::Make_x_monotone_2 Make_x_monotone_2;
|
||||
typedef typename CircularKernel::Split_2 Split_2;
|
||||
typedef typename CircularKernel::Intersect_2 Intersect_2;
|
||||
typedef typename CircularKernel::Is_vertical_2 Is_vertical_2;
|
||||
using Split_2 = typename CircularKernel::Split_2;
|
||||
using Intersect_2 = typename CircularKernel::Intersect_2;
|
||||
using Is_vertical_2 = typename CircularKernel::Is_vertical_2;
|
||||
|
||||
Compare_x_2 compare_x_2_object() const
|
||||
{ return ck.compare_x_2_object(); }
|
||||
|
|
@ -160,26 +154,23 @@ public:
|
|||
{ return ck.split_2_object(); }
|
||||
|
||||
Intersect_2 intersect_2_object() const
|
||||
{ return ck.intersect_2_object(); }
|
||||
{ return ck.intersect_2_object(); }
|
||||
|
||||
Construct_max_vertex_2 construct_max_vertex_2_object() const
|
||||
{ return ck.construct_circular_max_vertex_2_object(); }
|
||||
{ return ck.construct_circular_max_vertex_2_object(); }
|
||||
|
||||
Construct_min_vertex_2 construct_min_vertex_2_object() const
|
||||
{ return ck.construct_circular_min_vertex_2_object(); }
|
||||
{ return ck.construct_circular_min_vertex_2_object(); }
|
||||
|
||||
Is_vertical_2 is_vertical_2_object() const
|
||||
{ return ck.is_vertical_2_object(); }
|
||||
|
||||
{ return ck.is_vertical_2_object(); }
|
||||
|
||||
//! A functor for subdividing curves into x-monotone curves.
|
||||
class Make_x_monotone_2 {
|
||||
public:
|
||||
template <typename OutputIterator>
|
||||
OutputIterator operator()(const Curve_2& arc, OutputIterator oi) const
|
||||
{
|
||||
typedef std::variant<Point_2, X_monotone_curve_2>
|
||||
Make_x_monotone_result;
|
||||
OutputIterator operator()(const Curve_2& arc, OutputIterator oi) const {
|
||||
using Make_x_monotone_result = std::variant<Point_2, X_monotone_curve_2>;
|
||||
|
||||
std::vector<Make_x_monotone_result> objs;
|
||||
CircularKernel().make_x_monotone_2_object()(arc, std::back_inserter(objs));
|
||||
|
|
|
|||
|
|
@ -41,515 +41,395 @@
|
|||
#include <CGAL/Arr_tags.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace VariantFunctors{
|
||||
|
||||
// Takes an iterator range of Object(Line/Circular_arc/Point),
|
||||
// returns a variant of Line, Circular_arc, and Point_2.
|
||||
template <class CK, class Arc1, class Arc2, class OutputIterator>
|
||||
OutputIterator
|
||||
object_to_object_variant(const std::vector<CGAL::Object>& res1,
|
||||
OutputIterator res2)
|
||||
{
|
||||
typedef typename CK::Circular_arc_point_2 Point_2;
|
||||
typedef std::variant<Arc1, Arc2> X_monotone_curve_2;
|
||||
typedef std::variant<Point_2, X_monotone_curve_2>
|
||||
Make_x_monotone_result;
|
||||
namespace VariantFunctors {
|
||||
|
||||
for (auto it = res1.begin(); it != res1.end(); ++it) {
|
||||
if (const Arc1* arc = CGAL::object_cast<Arc1>(&*it)) {
|
||||
std::variant<Arc1, Arc2> v = *arc;
|
||||
*res2++ = Make_x_monotone_result(v);
|
||||
}
|
||||
else if (const Arc2* line = CGAL::object_cast<Arc2>(&*it)) {
|
||||
std::variant<Arc1, Arc2> v = *line;
|
||||
*res2++ = Make_x_monotone_result(v);
|
||||
}
|
||||
else if (const Point_2* p = CGAL::object_cast<Point_2>(&*it)) {
|
||||
*res2++ = Make_x_monotone_result(*p);
|
||||
}
|
||||
else CGAL_error();
|
||||
// Takes an iterator range of Object(Line/Circular_arc/Point),
|
||||
// returns a variant of Line, Circular_arc, and Point_2.
|
||||
template <typename CK, typename Arc1, typename Arc2, typename OutputIterator>
|
||||
OutputIterator object_to_object_variant(const std::vector<CGAL::Object>& res1,
|
||||
OutputIterator res2) {
|
||||
using Point_2 = typename CK::Circular_arc_point_2;
|
||||
using X_monotone_curve_2 = std::variant<Arc1, Arc2>;
|
||||
using Make_x_monotone_result = std::variant<Point_2, X_monotone_curve_2>;
|
||||
|
||||
for (auto it = res1.begin(); it != res1.end(); ++it) {
|
||||
if (const Arc1* arc = CGAL::object_cast<Arc1>(&*it)) {
|
||||
std::variant<Arc1, Arc2> v = *arc;
|
||||
*res2++ = Make_x_monotone_result(v);
|
||||
}
|
||||
else if (const Arc2* line = CGAL::object_cast<Arc2>(&*it)) {
|
||||
std::variant<Arc1, Arc2> v = *line;
|
||||
*res2++ = Make_x_monotone_result(v);
|
||||
}
|
||||
else if (const Point_2* p = CGAL::object_cast<Point_2>(&*it)) {
|
||||
*res2++ = Make_x_monotone_result(*p);
|
||||
}
|
||||
else CGAL_error();
|
||||
}
|
||||
return res2;
|
||||
}
|
||||
|
||||
template <typename CircularKernel, typename Arc1, typename Arc2>
|
||||
class Compare_y_to_right_2 {
|
||||
public:
|
||||
using result_type = CGAL::Comparison_result;
|
||||
using Circular_arc_point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
|
||||
result_type operator()(const std::variant<Arc1, Arc2>& a1,
|
||||
const std::variant<Arc1, Arc2>& a2,
|
||||
const Circular_arc_point_2& p) const {
|
||||
if (const Arc1* arc1 = std::get_if<Arc1>(&a1)) {
|
||||
if (const Arc1* arc2 = std::get_if<Arc1>(&a2)) {
|
||||
return CircularKernel().compare_y_to_right_2_object()(*arc1, *arc2, p);
|
||||
}
|
||||
return res2;
|
||||
else {
|
||||
const Arc2* arc2e = std::get_if<Arc2>(&a2);
|
||||
return CircularKernel().compare_y_to_right_2_object()(*arc1, *arc2e, p);
|
||||
}
|
||||
}
|
||||
const Arc2* arc1 = std::get_if<Arc2>(&a1);
|
||||
if (const Arc1* arc2 = std::get_if<Arc1>(&a2)) {
|
||||
return CircularKernel().compare_y_to_right_2_object()(*arc1, *arc2, p);
|
||||
}
|
||||
const Arc2* arc2e = std::get_if<Arc2>(&a2);
|
||||
return CircularKernel().compare_y_to_right_2_object()(*arc1, *arc2e, p);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename CircularKernel>
|
||||
class Variant_Equal_2 {
|
||||
public:
|
||||
template <typename T>
|
||||
bool operator()(const T& a0, const T& a1) const
|
||||
{ return CircularKernel().equal_2_object()(a0,a1); }
|
||||
|
||||
template <typename T1, typename T2>
|
||||
bool operator()(const T1& , const T2&) const
|
||||
{ return false; }
|
||||
};
|
||||
|
||||
template <typename CircularKernel, class Arc1, class Arc2>
|
||||
class Equal_2 : public CircularKernel::Equal_2 {
|
||||
public:
|
||||
using Curve_2 = std::variant< Arc1, Arc2>;
|
||||
using result_type = bool;
|
||||
using CircularKernel::Equal_2::operator();
|
||||
using Circular_arc_point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
using Line_arc_2 = typename CircularKernel::Line_arc_2;
|
||||
using Circular_arc_2 = typename CircularKernel::Circular_arc_2;
|
||||
using CK_Equal_2 = typename CircularKernel::Equal_2;
|
||||
|
||||
result_type operator()(const Circular_arc_point_2& p0,
|
||||
const Circular_arc_point_2& p1) const
|
||||
{ return CK_Equal_2()(p0, p1); }
|
||||
|
||||
result_type operator()(const Circular_arc_2& a0, const Circular_arc_2& a1) const
|
||||
{ return CK_Equal_2()(a0, a1); }
|
||||
|
||||
result_type operator()(const Line_arc_2& a0, const Line_arc_2& a1) const
|
||||
{ return CK_Equal_2()(a0, a1); }
|
||||
|
||||
result_type operator()(const Line_arc_2& /*a0*/, const Circular_arc_2& /*a1*/) const
|
||||
{ return false; }
|
||||
|
||||
result_type operator()(const Circular_arc_2& /*a0*/, const Line_arc_2& /*a1*/) const
|
||||
{ return false; }
|
||||
|
||||
result_type operator()(const Curve_2& a0, const Curve_2& a1) const
|
||||
{ return std::visit(Variant_Equal_2<CircularKernel>(), a0, a1); }
|
||||
};
|
||||
|
||||
template <typename CircularKernel, typename Arc1, typename Arc2>
|
||||
class Compare_y_at_x_2 {
|
||||
public:
|
||||
using Circular_arc_point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
using result_type = CGAL::Comparison_result;
|
||||
|
||||
result_type operator()(const Circular_arc_point_2& p,
|
||||
const std::variant< Arc1, Arc2>& A1) const {
|
||||
if (const Arc1* arc1 = std::get_if<Arc1>(&A1)){
|
||||
return CircularKernel().compare_y_at_x_2_object()(p, *arc1);
|
||||
}
|
||||
else {
|
||||
const Arc2* arc2 = std::get_if<Arc2>(&A1);
|
||||
return CircularKernel().compare_y_at_x_2_object()(p, *arc2);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename CircularKernel>
|
||||
class Variant_Do_overlap_2 {
|
||||
public:
|
||||
template <typename T>
|
||||
bool operator()(const T& a0, const T& a1) const
|
||||
{ return CircularKernel().do_overlap_2_object()(a0, a1); }
|
||||
|
||||
template <typename T1, typename T2>
|
||||
bool operator()(const T1&, const T2&) const
|
||||
{ return false; }
|
||||
};
|
||||
|
||||
template <typename CircularKernel, typename Arc1, typename Arc2>
|
||||
class Do_overlap_2 {
|
||||
public:
|
||||
using Circular_arc_point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
using result_type = bool;
|
||||
|
||||
result_type operator()(const std::variant< Arc1, Arc2>& A0,
|
||||
const std::variant< Arc1, Arc2>& A1) const
|
||||
{ return std::visit(Variant_Do_overlap_2<CircularKernel>(), A0, A1); }
|
||||
};
|
||||
|
||||
//! A functor for subdividing curves into x-monotone curves.
|
||||
template <typename CircularKernel, typename Arc1, typename Arc2>
|
||||
class Make_x_monotone_2 {
|
||||
public:
|
||||
using Circular_arc_point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
|
||||
template <typename OutputIterator, typename Not_X_Monotone>
|
||||
OutputIterator operator()(const std::variant<Arc1, Arc2, Not_X_Monotone>& A,
|
||||
OutputIterator res) const {
|
||||
if ( const Arc1* arc1 = std::get_if<Arc1>(&A)) {
|
||||
return CircularKernel().make_x_monotone_2_object()(*arc1, res);
|
||||
}
|
||||
else {
|
||||
const Arc2* arc2 = std::get_if<Arc2>(&A);
|
||||
return CircularKernel().make_x_monotone_2_object()(*arc2, res);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename CircularKernel, typename Arc1, typename Arc2>
|
||||
class Intersect_2 {
|
||||
public:
|
||||
using Circular_arc_point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
|
||||
template <typename OutputIterator>
|
||||
OutputIterator operator()(const std::variant< Arc1, Arc2>& c1,
|
||||
const std::variant< Arc1, Arc2>& c2,
|
||||
OutputIterator oi) const {
|
||||
if (const Arc1* arc1 = std::get_if<Arc1>(&c1)) {
|
||||
if ( const Arc1* arc2 = std::get_if<Arc1>(&c2)) {
|
||||
return CircularKernel().intersect_2_object()(*arc1, *arc2, oi);
|
||||
}
|
||||
const Arc2* arc2 = std::get_if<Arc2>(&c2);
|
||||
return CircularKernel().intersect_2_object()(*arc1, *arc2, oi);
|
||||
}
|
||||
|
||||
template <class CircularKernel, class Arc1, class Arc2>
|
||||
class Compare_y_to_right_2
|
||||
{
|
||||
public:
|
||||
typedef CGAL::Comparison_result result_type;
|
||||
typedef typename CircularKernel::Circular_arc_point_2
|
||||
Circular_arc_point_2;
|
||||
|
||||
result_type
|
||||
operator()(const std::variant< Arc1, Arc2 > &a1,
|
||||
const std::variant< Arc1, Arc2 > &a2,
|
||||
const Circular_arc_point_2 &p) const
|
||||
{
|
||||
if ( const Arc1* arc1 = std::get_if<Arc1>( &a1 ) ){
|
||||
if ( const Arc1* arc2 = std::get_if<Arc1>( &a2 ) ){
|
||||
return CircularKernel()
|
||||
.compare_y_to_right_2_object()(*arc1, *arc2, p);
|
||||
}
|
||||
else {
|
||||
const Arc2* arc2e = std::get_if<Arc2>( &a2 );
|
||||
return CircularKernel()
|
||||
.compare_y_to_right_2_object()(*arc1, *arc2e, p);
|
||||
}
|
||||
}
|
||||
const Arc2* arc1 = std::get_if<Arc2>( &a1 );
|
||||
if ( const Arc1* arc2 = std::get_if<Arc1>( &a2 ) ){
|
||||
return CircularKernel()
|
||||
.compare_y_to_right_2_object()(*arc1, *arc2, p);
|
||||
}
|
||||
const Arc2* arc2e = std::get_if<Arc2>( &a2 );
|
||||
return CircularKernel()
|
||||
.compare_y_to_right_2_object()(*arc1, *arc2e, p);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class CircularKernel>
|
||||
class Variant_Equal_2
|
||||
{
|
||||
public :
|
||||
|
||||
template < typename T >
|
||||
bool
|
||||
operator()(const T &a0, const T &a1) const
|
||||
{
|
||||
return CircularKernel().equal_2_object()(a0,a1);
|
||||
}
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
bool
|
||||
operator()(const T1 &, const T2 &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <class CircularKernel, class Arc1, class Arc2>
|
||||
class Equal_2
|
||||
: public CircularKernel::Equal_2
|
||||
{
|
||||
public:
|
||||
typedef std::variant< Arc1, Arc2 > Curve_2;
|
||||
typedef bool result_type;
|
||||
using CircularKernel::Equal_2::operator();
|
||||
typedef typename CircularKernel::Circular_arc_point_2
|
||||
Circular_arc_point_2;
|
||||
typedef typename CircularKernel::Line_arc_2 Line_arc_2;
|
||||
typedef typename CircularKernel::Circular_arc_2 Circular_arc_2;
|
||||
typedef typename CircularKernel::Equal_2 CK_Equal_2;
|
||||
|
||||
result_type
|
||||
operator() (const Circular_arc_point_2 &p0,
|
||||
const Circular_arc_point_2 &p1) const
|
||||
{ return CK_Equal_2()(p0, p1); }
|
||||
|
||||
result_type
|
||||
operator() (const Circular_arc_2 &a0, const Circular_arc_2 &a1) const
|
||||
{ return CK_Equal_2()(a0, a1); }
|
||||
|
||||
result_type
|
||||
operator() (const Line_arc_2 &a0, const Line_arc_2 &a1) const
|
||||
{ return CK_Equal_2()(a0, a1); }
|
||||
|
||||
result_type
|
||||
operator() ( const Line_arc_2 &/*a0*/, const Circular_arc_2 &/*a1*/) const
|
||||
{ return false; }
|
||||
|
||||
result_type
|
||||
operator() ( const Circular_arc_2 &/*a0*/, const Line_arc_2 &/*a1*/) const
|
||||
{ return false; }
|
||||
|
||||
result_type
|
||||
operator()(const Curve_2 &a0, const Curve_2 &a1) const
|
||||
{
|
||||
return std::visit
|
||||
( Variant_Equal_2<CircularKernel>(), a0, a1 );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template <class CircularKernel, class Arc1, class Arc2>
|
||||
class Compare_y_at_x_2
|
||||
{
|
||||
public:
|
||||
typedef typename CircularKernel::Circular_arc_point_2
|
||||
Circular_arc_point_2;
|
||||
typedef CGAL::Comparison_result result_type;
|
||||
|
||||
result_type
|
||||
operator() (const Circular_arc_point_2 &p,
|
||||
const std::variant< Arc1, Arc2 > &A1) const
|
||||
{
|
||||
if ( const Arc1* arc1 = std::get_if<Arc1>( &A1 ) ){
|
||||
return CircularKernel().compare_y_at_x_2_object()(p, *arc1);
|
||||
}
|
||||
else {
|
||||
const Arc2* arc2 = std::get_if<Arc2>( &A1 );
|
||||
return CircularKernel().compare_y_at_x_2_object()(p, *arc2);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class CircularKernel>
|
||||
class Variant_Do_overlap_2
|
||||
{
|
||||
public:
|
||||
template < typename T >
|
||||
bool
|
||||
operator()(const T &a0, const T &a1) const
|
||||
{
|
||||
return CircularKernel().do_overlap_2_object()(a0, a1);
|
||||
}
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
bool
|
||||
operator()(const T1 &, const T2 &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class CircularKernel, class Arc1, class Arc2>
|
||||
class Do_overlap_2
|
||||
{
|
||||
public:
|
||||
typedef typename CircularKernel::Circular_arc_point_2
|
||||
Circular_arc_point_2;
|
||||
typedef bool result_type;
|
||||
|
||||
result_type
|
||||
operator()(const std::variant< Arc1, Arc2 > &A0,
|
||||
const std::variant< Arc1, Arc2 > &A1) const
|
||||
{
|
||||
return std::visit
|
||||
( Variant_Do_overlap_2<CircularKernel>(), A0, A1 );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//! A functor for subdividing curves into x-monotone curves.
|
||||
template <class CircularKernel, class Arc1, class Arc2>
|
||||
class Make_x_monotone_2
|
||||
{
|
||||
public:
|
||||
typedef typename CircularKernel::Circular_arc_point_2
|
||||
Circular_arc_point_2;
|
||||
|
||||
template < class OutputIterator,class Not_X_Monotone >
|
||||
OutputIterator
|
||||
operator()(const std::variant<Arc1, Arc2, Not_X_Monotone> &A,
|
||||
OutputIterator res) const
|
||||
{
|
||||
if ( const Arc1* arc1 = std::get_if<Arc1>( &A ) ) {
|
||||
return CircularKernel().
|
||||
make_x_monotone_2_object()(*arc1, res);
|
||||
}
|
||||
else {
|
||||
const Arc2* arc2 = std::get_if<Arc2>( &A );
|
||||
return CircularKernel().
|
||||
make_x_monotone_2_object()(*arc2, res);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class CircularKernel, class Arc1, class Arc2>
|
||||
class Intersect_2
|
||||
{
|
||||
public:
|
||||
typedef typename CircularKernel::Circular_arc_point_2
|
||||
Circular_arc_point_2;
|
||||
|
||||
template < class OutputIterator >
|
||||
OutputIterator
|
||||
operator()(const std::variant< Arc1, Arc2 > &c1,
|
||||
const std::variant< Arc1, Arc2 > &c2,
|
||||
OutputIterator oi) const
|
||||
{
|
||||
if ( const Arc1* arc1 = std::get_if<Arc1>( &c1 ) ){
|
||||
if ( const Arc1* arc2 = std::get_if<Arc1>( &c2 ) ){
|
||||
return CircularKernel().intersect_2_object()(*arc1, *arc2, oi);
|
||||
}
|
||||
const Arc2* arc2 = std::get_if<Arc2>( &c2 );
|
||||
return CircularKernel().intersect_2_object()(*arc1, *arc2, oi);
|
||||
}
|
||||
|
||||
const Arc2* arc1e = std::get_if<Arc2>( &c1 );
|
||||
if ( const Arc1* arc2 = std::get_if<Arc1>( &c2 ) ){
|
||||
return CircularKernel().intersect_2_object()(*arc1e, *arc2, oi);
|
||||
}
|
||||
const Arc2* arc2 = std::get_if<Arc2>( &c2 );
|
||||
return CircularKernel().intersect_2_object()(*arc1e, *arc2, oi);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <class CircularKernel, class Arc1, class Arc2>
|
||||
class Split_2
|
||||
{
|
||||
|
||||
public:
|
||||
typedef typename CircularKernel::Circular_arc_point_2
|
||||
Circular_arc_point_2;
|
||||
typedef void result_type;
|
||||
result_type
|
||||
operator()(const std::variant< Arc1, Arc2 > &A,
|
||||
const Circular_arc_point_2 &p,
|
||||
std::variant< Arc1, Arc2 > &ca1,
|
||||
std::variant< Arc1, Arc2 > &ca2) const
|
||||
{
|
||||
// TODO : optimize by extracting the references from the variants ?
|
||||
if ( const Arc1* arc1 = std::get_if<Arc1>( &A ) ){
|
||||
Arc1 carc1;
|
||||
Arc1 carc2;
|
||||
CircularKernel().split_2_object()(*arc1, p, carc1, carc2);
|
||||
ca1 = carc1;
|
||||
ca2 = carc2;
|
||||
return ;
|
||||
|
||||
}
|
||||
else{
|
||||
const Arc2* arc2 = std::get_if<Arc2>( &A );
|
||||
Arc2 cline1;
|
||||
Arc2 cline2;
|
||||
CircularKernel().split_2_object()(*arc2, p, cline1, cline2);
|
||||
ca1 = cline1;
|
||||
ca2 = cline2;
|
||||
return ;
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class CircularKernel>
|
||||
class Variant_Construct_min_vertex_2
|
||||
{
|
||||
typedef typename CircularKernel::Circular_arc_point_2
|
||||
Circular_arc_point_2;
|
||||
|
||||
public :
|
||||
|
||||
typedef Circular_arc_point_2 result_type;
|
||||
//typedef const result_type& qualified_result_type;
|
||||
|
||||
template < typename T >
|
||||
//std::remove_reference_t<qualified_result_type>
|
||||
Circular_arc_point_2
|
||||
operator()(const T &a) const
|
||||
{
|
||||
//CGAL_kernel_precondition(CircularKernel().compare_xy_2_object()(a.left(), a.right())==CGAL::SMALLER);
|
||||
return CircularKernel().construct_circular_min_vertex_2_object()(a);
|
||||
}
|
||||
};
|
||||
|
||||
template <class CircularKernel, class Arc1, class Arc2>
|
||||
class Construct_min_vertex_2//: public Has_qrt
|
||||
{
|
||||
typedef typename CircularKernel::Circular_arc_point_2 Point_2;
|
||||
public:
|
||||
|
||||
typedef Point_2 result_type;
|
||||
//typedef const result_type& qualified_result_type;
|
||||
|
||||
//std::remove_reference_t<qualified_result_type>
|
||||
result_type
|
||||
operator() (const std::variant< Arc1, Arc2 > & cv) const
|
||||
{
|
||||
return std::visit
|
||||
( Variant_Construct_min_vertex_2<CircularKernel>(), cv );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class CircularKernel>
|
||||
class Variant_Construct_max_vertex_2
|
||||
{
|
||||
typedef typename CircularKernel::Circular_arc_point_2
|
||||
Circular_arc_point_2;
|
||||
|
||||
public:
|
||||
typedef Circular_arc_point_2 result_type;
|
||||
//typedef const result_type& qualified_result_type;
|
||||
|
||||
template < typename T >
|
||||
//std::remove_reference_t<qualified_result_type>
|
||||
Circular_arc_point_2
|
||||
operator()(const T &a) const
|
||||
{
|
||||
//CGAL_kernel_precondition(CircularKernel().compare_xy_2_object()(a.left(), a.right())==CGAL::SMALLER);
|
||||
return (CircularKernel().construct_circular_max_vertex_2_object()(a));
|
||||
}
|
||||
};
|
||||
|
||||
template <class CircularKernel, class Arc1, class Arc2>
|
||||
class Construct_max_vertex_2//: public Has_qrt
|
||||
{
|
||||
typedef typename CircularKernel::Circular_arc_point_2 Point_2;
|
||||
|
||||
public:
|
||||
/*! obtains the right endpoint of the x-monotone curve (segment).
|
||||
* \param cv The curve.
|
||||
* \return The right endpoint.
|
||||
*/
|
||||
typedef Point_2 result_type;
|
||||
//typedef const result_type& qualified_result_type;
|
||||
|
||||
//std::remove_reference<qualified_result_type>
|
||||
result_type
|
||||
operator() (const std::variant< Arc1, Arc2 > & cv) const
|
||||
{
|
||||
return std::visit
|
||||
( Variant_Construct_max_vertex_2<CircularKernel>(), cv );
|
||||
}
|
||||
};
|
||||
|
||||
template <class CircularKernel>
|
||||
class Variant_Is_vertical_2
|
||||
{
|
||||
public:
|
||||
|
||||
template < typename T >
|
||||
bool
|
||||
operator()(const T &a) const
|
||||
{
|
||||
return CircularKernel().is_vertical_2_object()(a);
|
||||
}
|
||||
};
|
||||
|
||||
template <class CircularKernel, class Arc1, class Arc2>
|
||||
class Is_vertical_2
|
||||
{
|
||||
public:
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator() (const std::variant< Arc1, Arc2 >& cv) const
|
||||
{
|
||||
return std::visit
|
||||
( Variant_Is_vertical_2<CircularKernel>(), cv );
|
||||
}
|
||||
};
|
||||
|
||||
const Arc2* arc1e = std::get_if<Arc2>(&c1);
|
||||
if ( const Arc1* arc2 = std::get_if<Arc1>(&c2)) {
|
||||
return CircularKernel().intersect_2_object()(*arc1e, *arc2, oi);
|
||||
}
|
||||
const Arc2* arc2 = std::get_if<Arc2>(&c2);
|
||||
return CircularKernel().intersect_2_object()(*arc1e, *arc2, oi);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename CircularKernel, typename Arc1, typename Arc2>
|
||||
class Split_2 {
|
||||
public:
|
||||
using Circular_arc_point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
using result_type = void;
|
||||
|
||||
// an empty class used to have different types between Curve_2 and X_monotone_curve_2
|
||||
// in Arr_circular_line_arc_traits_2.
|
||||
namespace internal_Argt_traits {
|
||||
struct Not_X_Monotone{};
|
||||
inline std::ostream& operator << (std::ostream& os, const Not_X_Monotone&)
|
||||
{return os;}
|
||||
result_type operator()(const std::variant< Arc1, Arc2>& A,
|
||||
const Circular_arc_point_2& p,
|
||||
std::variant< Arc1, Arc2>& ca1,
|
||||
std::variant< Arc1, Arc2>& ca2) const {
|
||||
// TODO : optimize by extracting the references from the variants ?
|
||||
if (const Arc1* arc1 = std::get_if<Arc1>(&A)) {
|
||||
Arc1 carc1;
|
||||
Arc1 carc2;
|
||||
CircularKernel().split_2_object()(*arc1, p, carc1, carc2);
|
||||
ca1 = carc1;
|
||||
ca2 = carc2;
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
const Arc2* arc2 = std::get_if<Arc2>(&A);
|
||||
Arc2 cline1;
|
||||
Arc2 cline2;
|
||||
CircularKernel().split_2_object()(*arc2, p, cline1, cline2);
|
||||
ca1 = cline1;
|
||||
ca2 = cline2;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/// Traits class for CGAL::Arrangement_2 (and similar) based on a CircularKernel.
|
||||
template <typename CircularKernel>
|
||||
class Variant_Construct_min_vertex_2 {
|
||||
using Circular_arc_point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
public:
|
||||
using result_type = Circular_arc_point_2;
|
||||
// using qualified_result_type = const result_type& ;
|
||||
|
||||
template < typename CircularKernel>
|
||||
class Arr_circular_line_arc_traits_2 {
|
||||
template <typename T>
|
||||
//std::remove_reference_t<qualified_result_type>
|
||||
Circular_arc_point_2 operator()(const T& a) const {
|
||||
//CGAL_kernel_precondition(CircularKernel().compare_xy_2_object()(a.left(), a.right())==CGAL::SMALLER);
|
||||
return CircularKernel().construct_circular_min_vertex_2_object()(a);
|
||||
}
|
||||
};
|
||||
|
||||
typedef Arr_circular_line_arc_traits_2< CircularKernel > Self;
|
||||
template <typename CircularKernel, typename Arc1, typename Arc2>
|
||||
class Construct_min_vertex_2 {
|
||||
//: public Has_qrt
|
||||
using Point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
|
||||
typedef typename CircularKernel::Line_arc_2 Arc1;
|
||||
typedef typename CircularKernel::Circular_arc_2 Arc2;
|
||||
public:
|
||||
using result_type = Point_2;
|
||||
// using qualified_result_type = const result_type&;
|
||||
|
||||
public:
|
||||
//std::remove_reference_t<qualified_result_type>
|
||||
result_type operator() (const std::variant< Arc1, Arc2>& cv) const
|
||||
{ return std::visit(Variant_Construct_min_vertex_2<CircularKernel>(), cv); }
|
||||
};
|
||||
|
||||
typedef CircularKernel Kernel;
|
||||
typedef typename CircularKernel::Circular_arc_point_2
|
||||
Circular_arc_point_2;
|
||||
template <typename CircularKernel>
|
||||
class Variant_Construct_max_vertex_2 {
|
||||
using Circular_arc_point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
public:
|
||||
using result_type = Circular_arc_point_2;
|
||||
// using qualified_result_type = const result_type&;
|
||||
|
||||
typedef typename CircularKernel::Circular_arc_point_2 Point;
|
||||
typedef typename CircularKernel::Circular_arc_point_2 Point_2;
|
||||
template <typename T>
|
||||
//std::remove_reference_t<qualified_result_type>
|
||||
Circular_arc_point_2 operator()(const T& a) const {
|
||||
//CGAL_kernel_precondition(CircularKernel().compare_xy_2_object()(a.left(), a.right())==CGAL::SMALLER);
|
||||
return (CircularKernel().construct_circular_max_vertex_2_object()(a));
|
||||
}
|
||||
};
|
||||
|
||||
typedef unsigned int Multiplicity;
|
||||
template <typename CircularKernel, typename Arc1, typename Arc2>
|
||||
class Construct_max_vertex_2 {
|
||||
//: public Has_qrt
|
||||
using Point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
|
||||
typedef CGAL::Tag_false Has_left_category;
|
||||
typedef CGAL::Tag_false Has_merge_category;
|
||||
typedef CGAL::Tag_false Has_do_intersect_category;
|
||||
public:
|
||||
/*! obtains the right endpoint of the x-monotone curve (segment).
|
||||
* \param cv The curve.
|
||||
* \return The right endpoint.
|
||||
*/
|
||||
using result_type = Point_2;
|
||||
// using qualified_result_type = const result_type&;
|
||||
|
||||
typedef Arr_oblivious_side_tag Left_side_category;
|
||||
typedef Arr_oblivious_side_tag Bottom_side_category;
|
||||
typedef Arr_oblivious_side_tag Top_side_category;
|
||||
typedef Arr_oblivious_side_tag Right_side_category;
|
||||
//std::remove_reference<qualified_result_type>
|
||||
result_type operator() (const std::variant<Arc1, Arc2>& cv) const
|
||||
{ return std::visit(Variant_Construct_max_vertex_2<CircularKernel>(), cv); }
|
||||
};
|
||||
|
||||
typedef internal_Argt_traits::Not_X_Monotone Not_X_Monotone;
|
||||
template <typename CircularKernel>
|
||||
class Variant_Is_vertical_2 {
|
||||
public:
|
||||
template <typename T>
|
||||
bool operator()(const T& a) const
|
||||
{ return CircularKernel().is_vertical_2_object()(a); }
|
||||
};
|
||||
|
||||
typedef std::variant< Arc1, Arc2, Not_X_Monotone > Curve_2;
|
||||
typedef std::variant< Arc1, Arc2 > X_monotone_curve_2;
|
||||
template <typename CircularKernel, typename Arc1, typename Arc2>
|
||||
class Is_vertical_2 {
|
||||
public:
|
||||
using result_type = bool;
|
||||
|
||||
private:
|
||||
CircularKernel ck;
|
||||
public:
|
||||
bool operator() (const std::variant<Arc1, Arc2>& cv) const
|
||||
{ return std::visit(Variant_Is_vertical_2<CircularKernel>(), cv); }
|
||||
};
|
||||
|
||||
Arr_circular_line_arc_traits_2(const CircularKernel &k = CircularKernel())
|
||||
: ck(k) {}
|
||||
}
|
||||
|
||||
typedef typename CircularKernel::Compare_x_2 Compare_x_2;
|
||||
typedef typename CircularKernel::Compare_xy_2 Compare_xy_2;
|
||||
typedef typename
|
||||
VariantFunctors::Construct_min_vertex_2<CircularKernel, Arc1, Arc2>
|
||||
Construct_min_vertex_2;
|
||||
typedef
|
||||
VariantFunctors::Construct_max_vertex_2<CircularKernel, Arc1, Arc2>
|
||||
Construct_max_vertex_2;
|
||||
typedef VariantFunctors::Is_vertical_2<CircularKernel, Arc1, Arc2>
|
||||
Is_vertical_2;
|
||||
typedef VariantFunctors::Compare_y_at_x_2<CircularKernel, Arc1, Arc2>
|
||||
Compare_y_at_x_2;
|
||||
typedef VariantFunctors::Compare_y_to_right_2<CircularKernel, Arc1, Arc2>
|
||||
Compare_y_at_x_right_2;
|
||||
typedef VariantFunctors::Equal_2<CircularKernel, Arc1, Arc2>
|
||||
Equal_2;
|
||||
typedef VariantFunctors::Make_x_monotone_2<CircularKernel, Arc1, Arc2>
|
||||
Make_x_monotone_2;
|
||||
typedef VariantFunctors::Split_2<CircularKernel, Arc1, Arc2>
|
||||
Split_2;
|
||||
typedef VariantFunctors::Intersect_2<CircularKernel, Arc1, Arc2>
|
||||
Intersect_2;
|
||||
// an empty class used to have different types between Curve_2 and X_monotone_curve_2
|
||||
// in Arr_circular_line_arc_traits_2.
|
||||
namespace internal_Argt_traits {
|
||||
|
||||
Compare_x_2 compare_x_2_object() const
|
||||
{ return ck.compare_x_2_object(); }
|
||||
struct Not_X_Monotone{};
|
||||
|
||||
Compare_xy_2 compare_xy_2_object() const
|
||||
{ return ck.compare_xy_2_object(); }
|
||||
inline std::ostream& operator << (std::ostream& os, const Not_X_Monotone&) { return os; }
|
||||
|
||||
Compare_y_at_x_2 compare_y_at_x_2_object() const
|
||||
{ return Compare_y_at_x_2(); }
|
||||
}
|
||||
|
||||
Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const
|
||||
{ return Compare_y_at_x_right_2(); }
|
||||
/// Traits class for CGAL::Arrangement_2 (and similar) based on a CircularKernel.
|
||||
|
||||
Equal_2 equal_2_object() const
|
||||
{ return Equal_2(); }
|
||||
template <typename CircularKernel>
|
||||
class Arr_circular_line_arc_traits_2 {
|
||||
using Self = Arr_circular_line_arc_traits_2<CircularKernel>;
|
||||
|
||||
Make_x_monotone_2 make_x_monotone_2_object() const
|
||||
{ return Make_x_monotone_2(); }
|
||||
using Arc1 = typename CircularKernel::Line_arc_2;
|
||||
using Arc2 = typename CircularKernel::Circular_arc_2;
|
||||
|
||||
Split_2 split_2_object() const
|
||||
{ return Split_2(); }
|
||||
public:
|
||||
using Kernel = CircularKernel;
|
||||
using Circular_arc_point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
|
||||
Intersect_2 intersect_2_object() const
|
||||
{ return Intersect_2(); }
|
||||
using Point = typename CircularKernel::Circular_arc_point_2;
|
||||
using Point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
|
||||
Construct_min_vertex_2 construct_min_vertex_2_object() const
|
||||
{ return Construct_min_vertex_2(); }
|
||||
using Multiplicity = std::size_t;
|
||||
|
||||
Construct_max_vertex_2 construct_max_vertex_2_object() const
|
||||
{ return Construct_max_vertex_2(); }
|
||||
using Has_left_category = CGAL::Tag_false;
|
||||
using Has_merge_category = CGAL::Tag_false;
|
||||
using Has_do_intersect_category = CGAL::Tag_false;
|
||||
|
||||
Is_vertical_2 is_vertical_2_object() const
|
||||
{ return Is_vertical_2();}
|
||||
using Left_side_category = Arr_oblivious_side_tag;
|
||||
using Bottom_side_category = Arr_oblivious_side_tag;
|
||||
using Top_side_category = Arr_oblivious_side_tag;
|
||||
using Right_side_category = Arr_oblivious_side_tag;
|
||||
|
||||
using Not_X_Monotone = internal_Argt_traits::Not_X_Monotone;
|
||||
|
||||
using Curve_2 = std::variant<Arc1, Arc2, Not_X_Monotone>;
|
||||
using X_monotone_curve_2 = std::variant<Arc1, Arc2>;
|
||||
|
||||
private:
|
||||
CircularKernel ck;
|
||||
|
||||
public:
|
||||
Arr_circular_line_arc_traits_2(const CircularKernel& k = CircularKernel()) : ck(k) {}
|
||||
|
||||
using Compare_x_2 = typename CircularKernel::Compare_x_2;
|
||||
using Compare_xy_2 = typename CircularKernel::Compare_xy_2;
|
||||
using Construct_min_vertex_2 = typename VariantFunctors::Construct_min_vertex_2<CircularKernel, Arc1, Arc2>;
|
||||
using Construct_max_vertex_2 = VariantFunctors::Construct_max_vertex_2<CircularKernel, Arc1, Arc2>;
|
||||
using Is_vertical_2 = VariantFunctors::Is_vertical_2<CircularKernel, Arc1, Arc2>;
|
||||
using Compare_y_at_x_2 = VariantFunctors::Compare_y_at_x_2<CircularKernel, Arc1, Arc2>;
|
||||
using Compare_y_at_x_right_2 = VariantFunctors::Compare_y_to_right_2<CircularKernel, Arc1, Arc2>;
|
||||
using Equal_2 = VariantFunctors::Equal_2<CircularKernel, Arc1, Arc2>;
|
||||
using Make_x_monotone_2 = VariantFunctors::Make_x_monotone_2<CircularKernel, Arc1, Arc2>;
|
||||
using Split_2 = VariantFunctors::Split_2<CircularKernel, Arc1, Arc2>;
|
||||
using Intersect_2 = VariantFunctors::Intersect_2<CircularKernel, Arc1, Arc2>;
|
||||
|
||||
Compare_x_2 compare_x_2_object() const
|
||||
{ return ck.compare_x_2_object(); }
|
||||
|
||||
Compare_xy_2 compare_xy_2_object() const
|
||||
{ return ck.compare_xy_2_object(); }
|
||||
|
||||
Compare_y_at_x_2 compare_y_at_x_2_object() const
|
||||
{ return Compare_y_at_x_2(); }
|
||||
|
||||
Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const
|
||||
{ return Compare_y_at_x_right_2(); }
|
||||
|
||||
Equal_2 equal_2_object() const
|
||||
{ return Equal_2(); }
|
||||
|
||||
Make_x_monotone_2 make_x_monotone_2_object() const
|
||||
{ return Make_x_monotone_2(); }
|
||||
|
||||
Split_2 split_2_object() const
|
||||
{ return Split_2(); }
|
||||
|
||||
Intersect_2 intersect_2_object() const
|
||||
{ return Intersect_2(); }
|
||||
|
||||
Construct_min_vertex_2 construct_min_vertex_2_object() const
|
||||
{ return Construct_min_vertex_2(); }
|
||||
|
||||
Construct_max_vertex_2 construct_max_vertex_2_object() const
|
||||
{ return Construct_max_vertex_2(); }
|
||||
|
||||
Is_vertical_2 is_vertical_2_object() const
|
||||
{ return Is_vertical_2();}
|
||||
};
|
||||
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/tags.h>
|
||||
#include <CGAL/Arr_tags.h>
|
||||
#include <CGAL/Arr_enums.h>
|
||||
|
|
@ -59,37 +59,37 @@ namespace CGAL {
|
|||
template <typename RatKernel, typename AlgKernel, typename NtTraits>
|
||||
class Arr_conic_traits_2 {
|
||||
public:
|
||||
typedef RatKernel Rat_kernel;
|
||||
typedef AlgKernel Alg_kernel;
|
||||
typedef NtTraits Nt_traits;
|
||||
using Rat_kernel = RatKernel;
|
||||
using Alg_kernel = AlgKernel;
|
||||
using Nt_traits = NtTraits;
|
||||
|
||||
typedef typename Rat_kernel::FT Rational;
|
||||
typedef typename Rat_kernel::Point_2 Rat_point_2;
|
||||
typedef typename Rat_kernel::Segment_2 Rat_segment_2;
|
||||
typedef typename Rat_kernel::Line_2 Rat_line_2;
|
||||
typedef typename Rat_kernel::Circle_2 Rat_circle_2;
|
||||
using Rational = typename Rat_kernel::FT;
|
||||
using Rat_point_2 = typename Rat_kernel::Point_2;
|
||||
using Rat_segment_2 = typename Rat_kernel::Segment_2;
|
||||
using Rat_line_2 = typename Rat_kernel::Line_2;
|
||||
using Rat_circle_2 = typename Rat_kernel::Circle_2;
|
||||
|
||||
typedef typename Alg_kernel::FT Algebraic;
|
||||
typedef typename Alg_kernel::Point_2 Alg_point_2;
|
||||
using Algebraic = typename Alg_kernel::FT;
|
||||
using Alg_point_2 = typename Alg_kernel::Point_2;
|
||||
|
||||
typedef typename Nt_traits::Integer Integer;
|
||||
using Integer = typename Nt_traits::Integer;
|
||||
|
||||
// Category tags:
|
||||
typedef Tag_true Has_left_category;
|
||||
typedef Tag_true Has_merge_category;
|
||||
typedef Tag_false Has_do_intersect_category;
|
||||
using Has_left_category = Tag_true;
|
||||
using Has_merge_category = Tag_true;
|
||||
using Has_do_intersect_category = Tag_false;
|
||||
//typedef std::true_type Has_line_segment_constructor;
|
||||
|
||||
typedef Arr_oblivious_side_tag Left_side_category;
|
||||
typedef Arr_oblivious_side_tag Bottom_side_category;
|
||||
typedef Arr_oblivious_side_tag Top_side_category;
|
||||
typedef Arr_oblivious_side_tag Right_side_category;
|
||||
using Left_side_category = Arr_oblivious_side_tag;
|
||||
using Bottom_side_category = Arr_oblivious_side_tag;
|
||||
using Top_side_category = Arr_oblivious_side_tag;
|
||||
using Right_side_category = Arr_oblivious_side_tag;
|
||||
|
||||
// Traits objects:
|
||||
typedef Conic_arc_2<Rat_kernel, Alg_kernel, Nt_traits> Curve_2;
|
||||
typedef Conic_x_monotone_arc_2<Curve_2> X_monotone_curve_2;
|
||||
typedef Conic_point_2<Alg_kernel> Point_2;
|
||||
typedef size_t Multiplicity;
|
||||
using Curve_2 = Conic_arc_2<Rat_kernel, Alg_kernel, Nt_traits>;
|
||||
using X_monotone_curve_2 = Conic_x_monotone_arc_2<Curve_2>;
|
||||
using Point_2 = Conic_point_2<Alg_kernel>;
|
||||
using Multiplicity = std::size_t;
|
||||
|
||||
private:
|
||||
// Type definition for the intersection points mapping.
|
||||
|
|
@ -106,16 +106,14 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
typedef std::pair<Point_2, Multiplicity> Intersection_point;
|
||||
typedef std::list<Intersection_point> Intersection_list;
|
||||
typedef std::map<Conic_pair, Intersection_list, Less_conic_pair>
|
||||
Intersection_map;
|
||||
typedef typename Intersection_map::iterator Intersection_map_iterator;
|
||||
using Intersection_point = std::pair<Point_2, Multiplicity>;
|
||||
using Intersection_list = std::list<Intersection_point>;
|
||||
using Intersection_map = std::map<Conic_pair, Intersection_list, Less_conic_pair>;
|
||||
using Intersection_map_iterator = typename Intersection_map::iterator;
|
||||
|
||||
|
||||
typedef std::shared_ptr<Rat_kernel> Shared_rat_kernel;
|
||||
typedef std::shared_ptr<Alg_kernel> Shared_alg_kernel;
|
||||
typedef std::shared_ptr<Nt_traits> Shared_nt_traits;
|
||||
using Shared_rat_kernel = std::shared_ptr<Rat_kernel>;
|
||||
using Shared_alg_kernel = std::shared_ptr<Alg_kernel>;
|
||||
using Shared_nt_traits = std::shared_ptr<Nt_traits>;
|
||||
|
||||
const Shared_rat_kernel m_rat_kernel;
|
||||
const Shared_alg_kernel m_alg_kernel;
|
||||
|
|
@ -127,10 +125,10 @@ private:
|
|||
public:
|
||||
/*! constructs default.
|
||||
*/
|
||||
Arr_conic_traits_2()
|
||||
: m_rat_kernel(std::make_shared<Rat_kernel>()),
|
||||
m_alg_kernel(std::make_shared<Alg_kernel>()),
|
||||
m_nt_traits(std::make_shared<Nt_traits>())
|
||||
Arr_conic_traits_2() :
|
||||
m_rat_kernel(std::make_shared<Rat_kernel>()),
|
||||
m_alg_kernel(std::make_shared<Alg_kernel>()),
|
||||
m_nt_traits(std::make_shared<Nt_traits>())
|
||||
{}
|
||||
|
||||
/*! constructs from resources.
|
||||
|
|
@ -360,8 +358,7 @@ public:
|
|||
*/
|
||||
Comparison_result operator()(const X_monotone_curve_2& xcv1,
|
||||
const X_monotone_curve_2& xcv2,
|
||||
const Point_2& p) const
|
||||
{
|
||||
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(m_traits.contains_point(xcv1, p) &&
|
||||
|
|
@ -538,8 +535,7 @@ public:
|
|||
*/
|
||||
Comparison_result operator()(const X_monotone_curve_2& xcv1,
|
||||
const X_monotone_curve_2& xcv2,
|
||||
const Point_2& p) const
|
||||
{
|
||||
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(m_traits.contains_point(xcv1, p) &&
|
||||
|
|
@ -703,8 +699,7 @@ public:
|
|||
* \return `true` if the two curves are the same; `false` otherwise.
|
||||
*/
|
||||
bool operator()(const X_monotone_curve_2& xcv1,
|
||||
const X_monotone_curve_2& xcv2) const
|
||||
{
|
||||
const X_monotone_curve_2& xcv2) const {
|
||||
if (&xcv1 == &xcv2) return true;
|
||||
return equals(xcv1, xcv2);
|
||||
}
|
||||
|
|
@ -924,8 +919,7 @@ public:
|
|||
|
||||
if (((cv.orientation() == COUNTERCLOCKWISE) &&
|
||||
(start_pos == order_vpts)) ||
|
||||
((cv.orientation() == CLOCKWISE) && (start_pos != order_vpts)))
|
||||
{
|
||||
((cv.orientation() == CLOCKWISE) && (start_pos != order_vpts))) {
|
||||
ind_first = 1;
|
||||
ind_second = 0;
|
||||
}
|
||||
|
|
@ -1101,8 +1095,7 @@ public:
|
|||
else if (m_traits.is_between_endpoints(xcv2, xcv1.source()) &&
|
||||
m_traits.is_between_endpoints(xcv2, xcv1.target()) &&
|
||||
(m_traits.is_strictly_between_endpoints(xcv2, xcv1.source()) ||
|
||||
m_traits.is_strictly_between_endpoints(xcv2, xcv1.target())))
|
||||
{
|
||||
m_traits.is_strictly_between_endpoints(xcv2, xcv1.target()))) {
|
||||
// Case 4 - *this: +----------->
|
||||
// arc: +================>
|
||||
overlap = xcv1;
|
||||
|
|
@ -1285,8 +1278,7 @@ public:
|
|||
for (i = 0; i < n_xs; ++i) {
|
||||
for (j = 0; j < n_ys; ++j) {
|
||||
if (xcv1.is_on_supporting_conic(xs[i], ys[j]) &&
|
||||
xcv2.is_on_supporting_conic(xs[i], ys[j]))
|
||||
{
|
||||
xcv2.is_on_supporting_conic(xs[i], ys[j])) {
|
||||
// Create the intersection point and set its generating conics.
|
||||
Point_2 ip(xs[i], ys[j]);
|
||||
|
||||
|
|
@ -1314,8 +1306,7 @@ public:
|
|||
OutputIterator intersect(const X_monotone_curve_2& xcv1,
|
||||
const X_monotone_curve_2& xcv2,
|
||||
Intersection_map& inter_map,
|
||||
OutputIterator oi) const
|
||||
{
|
||||
OutputIterator oi) const {
|
||||
if (m_traits.has_same_supporting_conic(xcv1, xcv2)) {
|
||||
// Check for overlaps between the two arcs.
|
||||
X_monotone_curve_2 overlap;
|
||||
|
|
@ -1392,8 +1383,7 @@ public:
|
|||
// both \f$x\f$-monotone arcs.
|
||||
for (auto iter = inter_list.begin(); iter != inter_list.end(); ++iter) {
|
||||
if (m_traits.is_between_endpoints(xcv1, (*iter).first) &&
|
||||
m_traits.is_between_endpoints(xcv2, (*iter).first))
|
||||
{
|
||||
m_traits.is_between_endpoints(xcv2, (*iter).first)) {
|
||||
*oi++ = *iter;
|
||||
}
|
||||
}
|
||||
|
|
@ -1481,8 +1471,7 @@ public:
|
|||
*/
|
||||
void operator()(const X_monotone_curve_2& xcv1,
|
||||
const X_monotone_curve_2& xcv2,
|
||||
X_monotone_curve_2& xcv) const
|
||||
{
|
||||
X_monotone_curve_2& xcv) const {
|
||||
CGAL_precondition(m_traits.are_mergeable_2_object()(xcv2, xcv1));
|
||||
xcv = xcv1;
|
||||
merge(xcv, xcv2);
|
||||
|
|
@ -1523,9 +1512,9 @@ public:
|
|||
* point-location strategy and the drawing function.
|
||||
*/
|
||||
//@{
|
||||
typedef double Approximate_number_type;
|
||||
typedef CGAL::Cartesian<Approximate_number_type> Approximate_kernel;
|
||||
typedef Approximate_kernel::Point_2 Approximate_point_2;
|
||||
using Approximate_number_type = double;
|
||||
using Approximate_kernel = CGAL::Simple_cartesian<Approximate_number_type>;
|
||||
using Approximate_point_2 = Approximate_kernel::Point_2;
|
||||
|
||||
class Approximate_curve_length_2 {
|
||||
protected:
|
||||
|
|
@ -1901,8 +1890,7 @@ public:
|
|||
template <typename OutputIterator>
|
||||
OutputIterator approximate_parabola(const X_monotone_curve_2& xcv,
|
||||
double error, OutputIterator oi,
|
||||
bool l2r = true)
|
||||
const {
|
||||
bool l2r = true) const {
|
||||
// std::cout << "PARABOLA\n";
|
||||
auto min_vertex = m_traits.construct_min_vertex_2_object();
|
||||
auto max_vertex = m_traits.construct_max_vertex_2_object();
|
||||
|
|
@ -2104,8 +2092,7 @@ public:
|
|||
*/
|
||||
X_monotone_curve_2 operator()(const Curve_2& cv,
|
||||
const Point_2& source, const Point_2& target,
|
||||
const Conic_id& id) const
|
||||
{
|
||||
const Conic_id& id) const {
|
||||
// Set the two endpoints.
|
||||
X_monotone_curve_2 xcv(cv, id);
|
||||
xcv.set_source(source);
|
||||
|
|
@ -2122,8 +2109,7 @@ public:
|
|||
* \return A segment connecting `source` and `target`.
|
||||
*/
|
||||
X_monotone_curve_2 operator()(const Point_2& source, const Point_2& target)
|
||||
const
|
||||
{
|
||||
const {
|
||||
X_monotone_curve_2 xcv;
|
||||
|
||||
// Set the basic properties.
|
||||
|
|
@ -2157,8 +2143,7 @@ public:
|
|||
X_monotone_curve_2 operator()(const Algebraic& a, const Algebraic& b,
|
||||
const Algebraic& c,
|
||||
const Point_2& source, const Point_2& target)
|
||||
const
|
||||
{
|
||||
const {
|
||||
auto cmp_xy = m_traits.m_alg_kernel->compare_xy_2_object();
|
||||
Comparison_result res = cmp_xy(source, target);
|
||||
CGAL_precondition(res != EQUAL);
|
||||
|
|
@ -2238,8 +2223,7 @@ public:
|
|||
*/
|
||||
Curve_2 operator()(const Rational& r, const Rational& s, const Rational& t,
|
||||
const Rational& u, const Rational& v, const Rational& w)
|
||||
const
|
||||
{
|
||||
const {
|
||||
// Ensure that the given curve is an ellipse (4rs - t^2 is positive).
|
||||
CGAL_precondition(CGAL::sign(4*r*s - t*t) == POSITIVE);
|
||||
|
||||
|
|
@ -2445,8 +2429,7 @@ public:
|
|||
|
||||
if (! m_traits.is_strictly_between_endpoints(arc, mp2) ||
|
||||
! m_traits.is_strictly_between_endpoints(arc, mp3) ||
|
||||
! m_traits.is_strictly_between_endpoints(arc, mp4))
|
||||
{
|
||||
! m_traits.is_strictly_between_endpoints(arc, mp4)) {
|
||||
arc.reset_flags(); // invalid arc
|
||||
return arc;
|
||||
}
|
||||
|
|
@ -2853,8 +2836,7 @@ public:
|
|||
* \pre both points must be interior and must lie on \c cv
|
||||
*/
|
||||
X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv,
|
||||
const Point_2& src, const Point_2& tgt) const
|
||||
{
|
||||
const Point_2& src, const Point_2& tgt) const {
|
||||
// make functor objects
|
||||
CGAL_precondition_code(Compare_y_at_x_2 compare_y_at_x_2 =
|
||||
m_traits.compare_y_at_x_2_object());
|
||||
|
|
@ -3084,16 +3066,14 @@ public:
|
|||
const auto& target = cv.target();
|
||||
// Make sure both endpoint lie on the supporting conic.
|
||||
if (! is_on_supporting_conic(cv, source) ||
|
||||
! is_on_supporting_conic(cv, target))
|
||||
{
|
||||
! is_on_supporting_conic(cv, target)) {
|
||||
cv.reset_flags(); // invalid arc
|
||||
return;
|
||||
}
|
||||
|
||||
// Check whether we have a degree 2 curve.
|
||||
if ((CGAL::sign(r) != ZERO) || (CGAL::sign(s) != ZERO) ||
|
||||
(CGAL::sign(t) != ZERO))
|
||||
{
|
||||
(CGAL::sign(t) != ZERO)) {
|
||||
if (cv.orientation() == COLLINEAR) {
|
||||
// Make sure the midpoint is on the line pair (thus making sure that
|
||||
// the two points are not taken from different lines).
|
||||
|
|
@ -3105,8 +3085,7 @@ public:
|
|||
m_nt_traits->convert(u)) * p_mid.x() +
|
||||
(m_nt_traits->convert(s)*p_mid.y() +
|
||||
m_nt_traits->convert(v)) * p_mid.y() +
|
||||
m_nt_traits->convert(w)) != ZERO)
|
||||
{
|
||||
m_nt_traits->convert(w)) != ZERO) {
|
||||
cv.reset_flags(); // invalid arc
|
||||
return;
|
||||
}
|
||||
|
|
@ -3645,8 +3624,7 @@ public:
|
|||
// Compute the degree of the underlying conic.
|
||||
if ((CGAL::sign(xcv.r()) != ZERO) ||
|
||||
(CGAL::sign(xcv.s()) != ZERO) ||
|
||||
(CGAL::sign(xcv.t()) != ZERO))
|
||||
{
|
||||
(CGAL::sign(xcv.t()) != ZERO)) {
|
||||
xcv.set_flag(X_monotone_curve_2::DEGREE_2);
|
||||
xcv.set_flag(X_monotone_curve_2::IS_SPECIAL_SEGMENT);
|
||||
}
|
||||
|
|
@ -3856,8 +3834,7 @@ public:
|
|||
for (int j = 0; j < n_ys; ++j) {
|
||||
if (CGAL::compare(m_nt_traits->convert(Integer(two*s)) * ys[j],
|
||||
-(m_nt_traits->convert(t) * xs[i] +
|
||||
m_nt_traits->convert(v))) == EQUAL)
|
||||
{
|
||||
m_nt_traits->convert(v))) == EQUAL) {
|
||||
ps[n++] = Point_2(xs[i], ys[j]);
|
||||
break;
|
||||
}
|
||||
|
|
@ -4128,8 +4105,7 @@ public:
|
|||
double& xs_t, double& ys_t, double& ts,
|
||||
double& xt_t, double& yt_t, double& tt,
|
||||
double& a, double& b, double& cx, double& cy,
|
||||
bool l2r = true)
|
||||
const {
|
||||
bool l2r = true) const {
|
||||
auto min_vertex = construct_min_vertex_2_object();
|
||||
auto max_vertex = construct_max_vertex_2_object();
|
||||
const auto& src = (l2r) ? min_vertex(xcv) : max_vertex(xcv);
|
||||
|
|
@ -4206,8 +4182,7 @@ public:
|
|||
double& xs_t, double& ys_t, double& ts,
|
||||
double& xt_t, double& yt_t, double& tt,
|
||||
double& a, double& b, double& cx, double& cy,
|
||||
bool l2r = true)
|
||||
const {
|
||||
bool l2r = true) const {
|
||||
auto min_vertex = construct_min_vertex_2_object();
|
||||
auto max_vertex = construct_max_vertex_2_object();
|
||||
const auto& src = (l2r) ? min_vertex(xcv) : max_vertex(xcv);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include <variant>
|
||||
|
||||
#include <CGAL/config.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/tags.h>
|
||||
#include <CGAL/tss.h>
|
||||
#include <CGAL/intersections.h>
|
||||
|
|
@ -2856,7 +2856,7 @@ public:
|
|||
/// \name Functor definitions for the landmarks point-location strategy.
|
||||
//@{
|
||||
using Approximate_number_type = double;
|
||||
using Approximate_kernel = CGAL::Cartesian<Approximate_number_type>;
|
||||
using Approximate_kernel = CGAL::Simple_cartesian<Approximate_number_type>;
|
||||
using Approximate_point_2 = Arr_extended_direction_3<Approximate_kernel>;
|
||||
using Approximate_kernel_vector_3 = Approximate_kernel::Vector_3;
|
||||
using Approximate_kernel_direction_3 = Approximate_kernel::Direction_3;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -41,9 +41,9 @@ class _One_root_point_2_rep {
|
|||
friend class _One_root_point_2<NumberType_, Filter_>;
|
||||
|
||||
public:
|
||||
typedef NumberType_ NT;
|
||||
typedef _One_root_point_2_rep<NT, Filter_> Self;
|
||||
typedef Sqrt_extension<NT, NT, Tag_true,Boolean_tag<Filter_> > CoordNT;
|
||||
using NT = NumberType_;
|
||||
using Self = _One_root_point_2_rep<NT, Filter_>;
|
||||
using CoordNT = Sqrt_extension<NT, NT, Tag_true,Boolean_tag<Filter_> >;
|
||||
|
||||
private:
|
||||
CoordNT _x; // The coordinates.
|
||||
|
|
@ -70,18 +70,17 @@ public:
|
|||
*/
|
||||
template <typename NumberType_, bool Filter_>
|
||||
class _One_root_point_2 :
|
||||
public Handle_for<_One_root_point_2_rep<NumberType_, Filter_> >
|
||||
{
|
||||
public Handle_for<_One_root_point_2_rep<NumberType_, Filter_>> {
|
||||
public:
|
||||
typedef NumberType_ NT;
|
||||
typedef _One_root_point_2<NT, Filter_> Self;
|
||||
using NT = NumberType_;
|
||||
using Self = _One_root_point_2<NT, Filter_>;
|
||||
|
||||
private:
|
||||
typedef _One_root_point_2_rep<NT, Filter_> Point_rep;
|
||||
typedef Handle_for<Point_rep> Point_handle;
|
||||
using Point_rep = _One_root_point_2_rep<NT, Filter_>;
|
||||
using Point_handle = Handle_for<Point_rep>;
|
||||
|
||||
public:
|
||||
typedef typename Point_rep::CoordNT CoordNT;
|
||||
using CoordNT = typename Point_rep::CoordNT;
|
||||
|
||||
/*! constructs default. */
|
||||
_One_root_point_2() : Point_handle(Point_rep()) {}
|
||||
|
|
@ -106,8 +105,7 @@ public:
|
|||
const CoordNT& y() const { return (this->ptr()->_y); }
|
||||
|
||||
/*! checks for equality. */
|
||||
bool equals(const Self& p) const
|
||||
{
|
||||
bool equals(const Self& p) const {
|
||||
if (this->identical(p)) return (true);
|
||||
|
||||
return (CGAL::compare(this->ptr()->_x, p.ptr()->_x) == EQUAL &&
|
||||
|
|
@ -119,8 +117,7 @@ public:
|
|||
bool operator == (const Self& p) const { return equals(p); }
|
||||
|
||||
/*! sets the point coordinates. */
|
||||
void set(const NT& x, const NT& y)
|
||||
{
|
||||
void set(const NT& x, const NT& y) {
|
||||
this->copy_on_write();
|
||||
this->ptr()->_x = CoordNT(x);
|
||||
this->ptr()->_y = CoordNT(y);
|
||||
|
|
@ -128,8 +125,7 @@ public:
|
|||
}
|
||||
|
||||
/*! sets the point coordinates. */
|
||||
void set(const CoordNT& x, const CoordNT& y)
|
||||
{
|
||||
void set(const CoordNT& x, const CoordNT& y) {
|
||||
this->copy_on_write();
|
||||
this->ptr()->_x = x;
|
||||
this->ptr()->_y = y;
|
||||
|
|
@ -141,8 +137,7 @@ public:
|
|||
*/
|
||||
template <typename NT, bool Filter>
|
||||
std::ostream& operator<<(std::ostream& os,
|
||||
const _One_root_point_2<NT, Filter>& p)
|
||||
{
|
||||
const _One_root_point_2<NT, Filter>& p) {
|
||||
os << CGAL::to_double(p.x()) << ' ' << CGAL::to_double(p.y());
|
||||
return (os);
|
||||
}
|
||||
|
|
@ -165,15 +160,15 @@ std::istream & operator >> (std::istream & is,
|
|||
template <typename Kernel_, bool Filter_>
|
||||
class _Circle_segment_2 {
|
||||
public:
|
||||
typedef Kernel_ Kernel;
|
||||
typedef typename Kernel::FT NT;
|
||||
typedef _One_root_point_2<NT, Filter_> Point_2;
|
||||
typedef typename Kernel::Circle_2 Circle_2;
|
||||
typedef typename Kernel::Segment_2 Segment_2;
|
||||
typedef typename Kernel::Line_2 Line_2;
|
||||
using Kernel = Kernel_;
|
||||
using NT = typename Kernel::FT;
|
||||
using Point_2 = _One_root_point_2<NT, Filter_>;
|
||||
using Circle_2 = typename Kernel::Circle_2;
|
||||
using Segment_2 = typename Kernel::Segment_2;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
|
||||
protected:
|
||||
typedef typename Point_2::CoordNT CoordNT;
|
||||
using CoordNT = typename Point_2::CoordNT;
|
||||
|
||||
// Data members:
|
||||
Line_2 m_line; // The supporting line (for line segments).
|
||||
|
|
@ -234,8 +229,7 @@ public:
|
|||
m_has_radius(false),
|
||||
m_source(source),
|
||||
m_target(target),
|
||||
m_orient(COLLINEAR)
|
||||
{
|
||||
m_orient(COLLINEAR) {
|
||||
CGAL_precondition(CGAL::compare(source.x() * line.a() + line.c(),
|
||||
-source.y() * line.b()) == EQUAL);
|
||||
|
||||
|
|
@ -282,8 +276,7 @@ public:
|
|||
m_has_radius(false),
|
||||
m_source(source),
|
||||
m_target(target),
|
||||
m_orient(circ.orientation())
|
||||
{
|
||||
m_orient(circ.orientation()) {
|
||||
CGAL_assertion(m_orient != COLLINEAR);
|
||||
|
||||
CGAL_precondition
|
||||
|
|
@ -315,8 +308,7 @@ public:
|
|||
m_radius(r),
|
||||
m_source(source),
|
||||
m_target(target),
|
||||
m_orient(orient)
|
||||
{
|
||||
m_orient(orient) {
|
||||
CGAL_assertion(orient != COLLINEAR);
|
||||
|
||||
CGAL_precondition
|
||||
|
|
@ -343,8 +335,7 @@ public:
|
|||
m_is_full(false),
|
||||
m_has_radius(false),
|
||||
m_source(p1.x(), p1.y()),
|
||||
m_target(p3.x(), p3.y())
|
||||
{
|
||||
m_target(p3.x(), p3.y()) {
|
||||
// Set the source and target.
|
||||
NT x1 = p1.x();
|
||||
NT y1 = p1.y();
|
||||
|
|
@ -359,7 +350,7 @@ public:
|
|||
// Compute the lines: A1*x + B1*y + C1 = 0,
|
||||
// and: A2*x + B2*y + C2 = 0,
|
||||
// where:
|
||||
const NT _two = 2;
|
||||
const NT _two = 2;
|
||||
|
||||
const NT A1 = _two*(x1 - x2);
|
||||
const NT B1 = _two*(y1 - y2);
|
||||
|
|
@ -423,8 +414,7 @@ public:
|
|||
/*! obtains the supporting line.
|
||||
* \pre The curve orientation is COLLINEAR.
|
||||
*/
|
||||
const Line_2& supporting_line() const
|
||||
{
|
||||
const Line_2& supporting_line() const {
|
||||
CGAL_precondition(m_orient == COLLINEAR);
|
||||
return m_line;
|
||||
}
|
||||
|
|
@ -432,8 +422,7 @@ public:
|
|||
/*! obtains the supporting circle.
|
||||
* \pre The curve orientation is not COLLINEAR.
|
||||
*/
|
||||
const Circle_2& supporting_circle() const
|
||||
{
|
||||
const Circle_2& supporting_circle() const {
|
||||
CGAL_precondition(m_orient != COLLINEAR);
|
||||
return m_circ;
|
||||
}
|
||||
|
|
@ -444,8 +433,7 @@ public:
|
|||
/*! obtains the source point.
|
||||
* \pre The curve is not a full circle.
|
||||
*/
|
||||
const Point_2& source() const
|
||||
{
|
||||
const Point_2& source() const {
|
||||
CGAL_precondition(! m_is_full);
|
||||
return (m_source);
|
||||
}
|
||||
|
|
@ -453,8 +441,7 @@ public:
|
|||
/*! obtains the target point.
|
||||
* \pre The curve is not a full circle.
|
||||
*/
|
||||
const Point_2& target() const
|
||||
{
|
||||
const Point_2& target() const {
|
||||
CGAL_precondition(! m_is_full);
|
||||
return (m_target);
|
||||
}
|
||||
|
|
@ -464,8 +451,7 @@ public:
|
|||
* \pre The curve is circular.
|
||||
* \return The number of points (0, 1, or 2).
|
||||
*/
|
||||
unsigned int vertical_tangency_points(Point_2* vpts) const
|
||||
{
|
||||
unsigned int vertical_tangency_points(Point_2* vpts) const {
|
||||
CGAL_precondition(m_orient != COLLINEAR);
|
||||
unsigned int n_vpts = 0;
|
||||
|
||||
|
|
@ -519,8 +505,7 @@ private:
|
|||
*/
|
||||
unsigned int _ccw_vertical_tangency_points(const Point_2& src,
|
||||
const Point_2& trg,
|
||||
Point_2* vpts) const
|
||||
{
|
||||
Point_2* vpts) const {
|
||||
unsigned int n_vpts = 0;
|
||||
const NT& x0 = m_circ.center().x();
|
||||
const NT& y0 = m_circ.center().y();
|
||||
|
|
@ -547,8 +532,7 @@ private:
|
|||
if ((qs % 4) == 1) {
|
||||
// We collect the left tangency point when going from Q[1] to Q[2]:
|
||||
if (CGAL::compare(x0, trg.x()) != LARGER ||
|
||||
CGAL::compare(y0, trg.y()) != EQUAL)
|
||||
{
|
||||
CGAL::compare(y0, trg.y()) != EQUAL) {
|
||||
if (m_has_radius)
|
||||
vpts[n_vpts] = Point_2(CoordNT(x0 - m_radius), y0);
|
||||
else
|
||||
|
|
@ -561,8 +545,7 @@ private:
|
|||
else if ((qs % 4) == 3) {
|
||||
// We collect the right tangency point when going from Q[3] to Q[0]:
|
||||
if (CGAL::compare(x0, trg.x()) != SMALLER ||
|
||||
CGAL::compare(y0, trg.y()) != EQUAL)
|
||||
{
|
||||
CGAL::compare(y0, trg.y()) != EQUAL) {
|
||||
if (m_has_radius)
|
||||
vpts[n_vpts] = Point_2(CoordNT(x0 + m_radius), y0);
|
||||
else
|
||||
|
|
@ -581,8 +564,7 @@ private:
|
|||
/*! obtains the index of the quarter-plane containing the given point,
|
||||
* where the circle center is considered to be the origin.
|
||||
*/
|
||||
int _quart_index(const Point_2& p) const
|
||||
{
|
||||
int _quart_index(const Point_2& p) const {
|
||||
// The plane looks like:
|
||||
//
|
||||
// Q[1] : | Q[0]:
|
||||
|
|
@ -608,8 +590,7 @@ private:
|
|||
*/
|
||||
template <typename Kernel, bool Filter>
|
||||
std::ostream&
|
||||
operator<<(std::ostream& os, const _Circle_segment_2<Kernel, Filter>& c)
|
||||
{
|
||||
operator<<(std::ostream& os, const _Circle_segment_2<Kernel, Filter>& c) {
|
||||
if (c.orientation() == COLLINEAR) {
|
||||
os<< "segment: " << c.source() << " -> " << c.target();
|
||||
}
|
||||
|
|
@ -632,35 +613,33 @@ operator<<(std::ostream& os, const _Circle_segment_2<Kernel, Filter>& c)
|
|||
template <typename Kernel_, bool Filter_>
|
||||
class _X_monotone_circle_segment_2 {
|
||||
public:
|
||||
typedef Kernel_ Kernel;
|
||||
typedef _X_monotone_circle_segment_2<Kernel, Filter_> Self;
|
||||
typedef typename Kernel::FT NT;
|
||||
typedef _One_root_point_2<NT, Filter_> Point_2;
|
||||
typedef typename Kernel::Circle_2 Circle_2;
|
||||
typedef typename Kernel::Line_2 Line_2;
|
||||
typedef typename Point_2::CoordNT CoordNT;
|
||||
using Kernel = Kernel_;
|
||||
using Self = _X_monotone_circle_segment_2<Kernel, Filter_>;
|
||||
using NT = typename Kernel::FT;
|
||||
using Point_2 = _One_root_point_2<NT, Filter_>;
|
||||
using Circle_2 = typename Kernel::Circle_2;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
using CoordNT = typename Point_2::CoordNT;
|
||||
|
||||
// Type definition for the intersection points mapping.
|
||||
typedef std::pair<unsigned int, unsigned int> Curve_id_pair;
|
||||
typedef unsigned int Multiplicity;
|
||||
typedef std::pair<Point_2, Multiplicity> Intersection_point;
|
||||
typedef std::list<Intersection_point> Intersection_list;
|
||||
using Curve_id_pair = std::pair<unsigned int, unsigned int>;
|
||||
using Multiplicity = std::size_t;
|
||||
using Intersection_point = std::pair<Point_2, Multiplicity>;
|
||||
using Intersection_list = std::list<Intersection_point>;
|
||||
|
||||
/*! \struct Less functor for Curve_id_pair.
|
||||
*/
|
||||
struct Less_id_pair {
|
||||
bool operator()(const Curve_id_pair& ip1, const Curve_id_pair& ip2) const
|
||||
{
|
||||
bool operator()(const Curve_id_pair& ip1, const Curve_id_pair& ip2) const {
|
||||
// Compare the pairs of IDs lexicographically.
|
||||
return (ip1.first < ip2.first ||
|
||||
(ip1.first == ip2.first && ip1.second < ip2.second));
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map<Curve_id_pair, Intersection_list, Less_id_pair>
|
||||
Intersection_map;
|
||||
typedef typename Intersection_map::value_type Intersection_map_entry;
|
||||
typedef typename Intersection_map::iterator Intersection_map_iterator;
|
||||
using Intersection_map = std::map<Curve_id_pair, Intersection_list, Less_id_pair>;
|
||||
using Intersection_map_entry = typename Intersection_map::value_type;
|
||||
using Intersection_map_iterator = typename Intersection_map::iterator;
|
||||
|
||||
protected:
|
||||
NT m_first; // The x-coordinate of the circle center.
|
||||
|
|
@ -713,8 +692,7 @@ public:
|
|||
m_third(line.c()),
|
||||
m_source(source),
|
||||
m_target(target),
|
||||
m_info(index << INDEX_SHIFT_BITS)
|
||||
{
|
||||
m_info(index << INDEX_SHIFT_BITS) {
|
||||
// Check if the segment is directed left or right:
|
||||
Comparison_result res = CGAL::compare(source.x(), target.x());
|
||||
|
||||
|
|
@ -740,8 +718,7 @@ public:
|
|||
const typename Kernel::Point_2& target) :
|
||||
m_source(source.x(), source.y()),
|
||||
m_target(target.x(), target.y()),
|
||||
m_info(0)
|
||||
{
|
||||
m_info(0) {
|
||||
Line_2 line(source, target);
|
||||
m_first = line.a();
|
||||
m_second = line.b();
|
||||
|
|
@ -778,8 +755,7 @@ public:
|
|||
m_third(circ.squared_radius()),
|
||||
m_source(source),
|
||||
m_target(target),
|
||||
m_info(index << INDEX_SHIFT_BITS)
|
||||
{
|
||||
m_info(index << INDEX_SHIFT_BITS) {
|
||||
// Check if the segment is directed left or right:
|
||||
Comparison_result res = CGAL::compare (source.x(), target.x());
|
||||
|
||||
|
|
@ -802,8 +778,7 @@ public:
|
|||
/*! obtains the supporting line.
|
||||
* \pre The arc is linear (a line segment).
|
||||
*/
|
||||
Line_2 supporting_line() const
|
||||
{
|
||||
Line_2 supporting_line() const {
|
||||
CGAL_precondition (is_linear());
|
||||
return (Line_2 (a(), b(), c()));
|
||||
}
|
||||
|
|
@ -811,8 +786,7 @@ public:
|
|||
/*! obtains the supporting circle.
|
||||
* \pre The arc is circular.
|
||||
*/
|
||||
Circle_2 supporting_circle() const
|
||||
{
|
||||
Circle_2 supporting_circle() const {
|
||||
CGAL_precondition (is_circular());
|
||||
|
||||
typename Kernel::Point_2 center(x0(), y0());
|
||||
|
|
@ -843,8 +817,7 @@ public:
|
|||
|
||||
/*! checks whether the given point is in the x-range of the arc.
|
||||
*/
|
||||
bool is_in_x_range(const Point_2& p) const
|
||||
{
|
||||
bool is_in_x_range(const Point_2& p) const {
|
||||
Comparison_result res = CGAL::compare (p.x(), left().x());
|
||||
|
||||
if (res == SMALLER) return false;
|
||||
|
|
@ -858,8 +831,7 @@ public:
|
|||
{ return ((m_info & IS_VERTICAL_SEGMENT_MASK) != 0); }
|
||||
|
||||
/*! obtains the orientation of the arc. */
|
||||
inline Orientation orientation() const
|
||||
{
|
||||
inline Orientation orientation() const {
|
||||
unsigned int or_ = (m_info & ORIENTATION_MASK);
|
||||
if (or_ == COUNTERCLOCKWISE_CODE) return (CGAL::COUNTERCLOCKWISE);
|
||||
else if (or_ == CLOCKWISE_CODE) return (CGAL::CLOCKWISE);
|
||||
|
|
@ -870,16 +842,14 @@ public:
|
|||
|
||||
/*! checks the position of a given point with respect to the arc.
|
||||
*/
|
||||
Comparison_result point_position(const Point_2& p) const
|
||||
{
|
||||
Comparison_result point_position(const Point_2& p) const {
|
||||
if (is_linear()) return (_line_point_position(p));
|
||||
else return (_circ_point_position (p));
|
||||
}
|
||||
|
||||
/*! compares the two arcs to the right of their intersection point.
|
||||
*/
|
||||
Comparison_result compare_to_right(const Self& cv, const Point_2& p) const
|
||||
{
|
||||
Comparison_result compare_to_right(const Self& cv, const Point_2& p) const {
|
||||
if (is_linear()) {
|
||||
if (cv.is_linear()) return (_lines_compare_to_right (cv, p));
|
||||
Comparison_result res = cv._circ_line_compare_to_right (*this, p);
|
||||
|
|
@ -894,8 +864,7 @@ public:
|
|||
|
||||
/*! compares the two arcs to the left of their intersection point.
|
||||
*/
|
||||
Comparison_result compare_to_left(const Self& cv, const Point_2& p) const
|
||||
{
|
||||
Comparison_result compare_to_left(const Self& cv, const Point_2& p) const {
|
||||
if (is_linear()) {
|
||||
if (cv.is_linear()) return (_lines_compare_to_left (cv, p));
|
||||
Comparison_result res = cv._circ_line_compare_to_left(*this, p);
|
||||
|
|
@ -910,8 +879,7 @@ public:
|
|||
|
||||
/*! checks whether the two arcs have the same supporting curve.
|
||||
*/
|
||||
bool has_same_supporting_curve(const Self& cv) const
|
||||
{
|
||||
bool has_same_supporting_curve(const Self& cv) const {
|
||||
// Check if the curve indices are the same.
|
||||
if (_index() != 0 && _index() == cv._index()) return true;
|
||||
|
||||
|
|
@ -950,8 +918,7 @@ public:
|
|||
|
||||
/*! checks whether the two curves are equal.
|
||||
*/
|
||||
bool equals(const Self& cv) const
|
||||
{
|
||||
bool equals(const Self& cv) const {
|
||||
if (! this->has_same_supporting_curve(cv)) return false;
|
||||
|
||||
if (is_linear()) {
|
||||
|
|
@ -969,8 +936,7 @@ public:
|
|||
|
||||
/*! splits the curve at a given point into two sub-arcs.
|
||||
*/
|
||||
void split(const Point_2& p, Self& c1, Self& c2) const
|
||||
{
|
||||
void split(const Point_2& p, Self& c1, Self& c2) const {
|
||||
// Copy the properties of this arc to the sub-arcs.
|
||||
c1 = *this;
|
||||
c2 = *this;
|
||||
|
|
@ -990,8 +956,7 @@ public:
|
|||
*/
|
||||
template <typename OutputIterator>
|
||||
OutputIterator intersect(const Self& cv, OutputIterator oi,
|
||||
Intersection_map* inter_map = nullptr) const
|
||||
{
|
||||
Intersection_map* inter_map = nullptr) const {
|
||||
// First check whether the two arcs have the same supporting curve.
|
||||
if (has_same_supporting_curve(cv)) {
|
||||
// Check for overlaps between the two arcs.
|
||||
|
|
@ -1064,8 +1029,7 @@ public:
|
|||
// Report only the intersection points that lie on both arcs.
|
||||
for (auto iter = inter_list.begin(); iter != inter_list.end(); ++iter) {
|
||||
if (this->_is_between_endpoints (iter->first) &&
|
||||
cv._is_between_endpoints (iter->first))
|
||||
{
|
||||
cv._is_between_endpoints (iter->first)) {
|
||||
*oi++ = *iter;
|
||||
}
|
||||
}
|
||||
|
|
@ -1075,8 +1039,7 @@ public:
|
|||
|
||||
/*! checks whether it is possible to merge our arc with the given arc.
|
||||
*/
|
||||
bool can_merge_with(const Self& cv) const
|
||||
{
|
||||
bool can_merge_with(const Self& cv) const {
|
||||
// In order to merge the two arcs, they should have the same supporting
|
||||
// curve.
|
||||
if (! this->has_same_supporting_curve(cv)) return false;
|
||||
|
|
@ -1089,8 +1052,7 @@ public:
|
|||
/*! merges our arc with the given arc.
|
||||
* \pre The two arcs are mergeable.
|
||||
*/
|
||||
void merge(const Self& cv)
|
||||
{
|
||||
void merge(const Self& cv) {
|
||||
CGAL_precondition(this->can_merge_with (cv));
|
||||
|
||||
// Check if we should extend the arc to the left or to the right.
|
||||
|
|
@ -1109,8 +1071,7 @@ public:
|
|||
}
|
||||
|
||||
/*! constructs an opposite arc. */
|
||||
Self construct_opposite() const
|
||||
{
|
||||
Self construct_opposite() const {
|
||||
Self opp_cv;
|
||||
opp_cv.m_first = this->m_first;
|
||||
opp_cv.m_second = this->m_second;
|
||||
|
|
@ -1127,8 +1088,7 @@ public:
|
|||
return (opp_cv);
|
||||
}
|
||||
|
||||
Bbox_2 bbox() const
|
||||
{
|
||||
Bbox_2 bbox() const {
|
||||
double x_min = to_double(left().x());
|
||||
double x_max = to_double(right().x());
|
||||
double y_min = to_double(left().y());
|
||||
|
|
@ -1167,8 +1127,7 @@ protected:
|
|||
|
||||
/*! checks if the circular arc lies on the upper half of the supporting circle.
|
||||
*/
|
||||
inline bool _is_upper() const
|
||||
{
|
||||
inline bool _is_upper() const {
|
||||
Orientation orient = orientation();
|
||||
bool dir_right = ((m_info & IS_DIRECTED_RIGHT_MASK) != 0);
|
||||
|
||||
|
|
@ -1197,8 +1156,7 @@ protected:
|
|||
|
||||
/*! checks the position of a given point with respect to a line segment.
|
||||
*/
|
||||
Comparison_result _line_point_position(const Point_2& p) const
|
||||
{
|
||||
Comparison_result _line_point_position(const Point_2& p) const {
|
||||
// Check if we have a vertical segment.
|
||||
|
||||
CGAL_precondition(is_in_x_range(p));
|
||||
|
|
@ -1229,20 +1187,17 @@ protected:
|
|||
|
||||
/*! checks the position of a given point with respect to a circular arc.
|
||||
*/
|
||||
Comparison_result _circ_point_position(const Point_2& p) const
|
||||
{
|
||||
Comparison_result _circ_point_position(const Point_2& p) const {
|
||||
|
||||
Comparison_result c_res = CGAL::compare (p.y(), y0());
|
||||
|
||||
if (_is_upper()) {
|
||||
// Check if p lies below the "equator" (while the arc lies above it):
|
||||
if (c_res == SMALLER)
|
||||
return (SMALLER);
|
||||
if (c_res == SMALLER) return (SMALLER);
|
||||
}
|
||||
else {
|
||||
// Check if p lies above the "equator" (while the arc lies below it):
|
||||
if (c_res == LARGER)
|
||||
return (LARGER);
|
||||
if (c_res == LARGER) return (LARGER);
|
||||
}
|
||||
|
||||
// Check if p lies inside the supporting circle, namely we have to check
|
||||
|
|
@ -1271,8 +1226,7 @@ protected:
|
|||
/*! compares two line segments to the right of their intersection point.
|
||||
*/
|
||||
Comparison_result _lines_compare_to_right(const Self& cv,
|
||||
const Point_2& /* p */) const
|
||||
{
|
||||
const Point_2& /* p */) const {
|
||||
if (_index() != 0 && _index() == cv._index()) return (EQUAL);
|
||||
|
||||
// Special treatment for vertical segments: a vertical segment is larger
|
||||
|
|
@ -1292,8 +1246,7 @@ protected:
|
|||
* their intersection point.
|
||||
*/
|
||||
Comparison_result _circ_line_compare_to_right(const Self& cv,
|
||||
const Point_2& p) const
|
||||
{
|
||||
const Point_2& p) const {
|
||||
// A vertical segment lies above any other circle to the right of p:
|
||||
if (cv.is_vertical()) return (SMALLER);
|
||||
|
||||
|
|
@ -1334,8 +1287,7 @@ protected:
|
|||
/*! compares two circular arcs to the right of their intersection point.
|
||||
*/
|
||||
Comparison_result _circs_compare_to_right(const Self& cv,
|
||||
const Point_2& p) const
|
||||
{
|
||||
const Point_2& p) const {
|
||||
if (_index() != 0 && _index() == cv._index()) {
|
||||
// Check the case of comparing two circular arcs that originate from the
|
||||
// same supporting circle. Their comparison result is not EQUAL only if
|
||||
|
|
@ -1413,13 +1365,11 @@ protected:
|
|||
// Compare the slopes of the two tangents to the circles.
|
||||
Comparison_result slope_res;
|
||||
|
||||
if (sign_slope1 == ZERO && sign_slope2 == ZERO)
|
||||
{
|
||||
if (sign_slope1 == ZERO && sign_slope2 == ZERO) {
|
||||
// Special case were both circles have a horizontal tangent:
|
||||
slope_res = EQUAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// Actually compare the slopes.
|
||||
const bool swap_res = (sign_denom1 != sign_denom2);
|
||||
const CoordNT A = NT(cv.y0() - y0())*p.x() + (y0()*cv.x0() - cv.y0()*x0());
|
||||
|
|
@ -1466,8 +1416,7 @@ protected:
|
|||
/*! compares two line segments to the left of their intersection point.
|
||||
*/
|
||||
Comparison_result _lines_compare_to_left(const Self& cv,
|
||||
const Point_2& ) const
|
||||
{
|
||||
const Point_2& ) const {
|
||||
if (_index() != 0 && _index() == cv._index()) return (EQUAL);
|
||||
|
||||
// Special treatment for vertical segments: a vertical segment is smaller
|
||||
|
|
@ -1489,8 +1438,7 @@ protected:
|
|||
* their intersection point.
|
||||
*/
|
||||
Comparison_result _circ_line_compare_to_left(const Self& cv,
|
||||
const Point_2& p) const
|
||||
{
|
||||
const Point_2& p) const {
|
||||
// A vertical segment lies below any other circle to the left of p:
|
||||
if (cv.is_vertical()) return (LARGER);
|
||||
|
||||
|
|
@ -1534,8 +1482,7 @@ protected:
|
|||
/*! compares the two arcs to the left of their intersection point.
|
||||
*/
|
||||
Comparison_result _circs_compare_to_left(const Self& cv,
|
||||
const Point_2& p) const
|
||||
{
|
||||
const Point_2& p) const {
|
||||
if (_index() != 0 && _index() == cv._index()) {
|
||||
// Check the case of comparing two circular arcs that originate from the
|
||||
// same supporting circle. Their comparison result is not EQUAL only if
|
||||
|
|
@ -1614,8 +1561,7 @@ protected:
|
|||
// Compare the slopes of the two tangents to the circles.
|
||||
Comparison_result slope_res;
|
||||
|
||||
if (sign_slope1 == ZERO && sign_slope2 == ZERO)
|
||||
{
|
||||
if (sign_slope1 == ZERO && sign_slope2 == ZERO) {
|
||||
// Special case were both circles have a horizontal tangent:
|
||||
slope_res = EQUAL;
|
||||
}
|
||||
|
|
@ -1668,8 +1614,7 @@ protected:
|
|||
/*! computes the intersections between two line segments.
|
||||
*/
|
||||
void _lines_intersect(const Self& cv,
|
||||
Intersection_list& inter_list) const
|
||||
{
|
||||
Intersection_list& inter_list) const {
|
||||
// The intersection of the lines:
|
||||
// a1*x + b1*y + c1 = 0 and a2*x + b2*y + c2 = 0 ,
|
||||
// is given by:
|
||||
|
|
@ -1695,8 +1640,7 @@ protected:
|
|||
* the supporting line of the segment cv.
|
||||
*/
|
||||
void _circ_line_intersect(const Self& cv,
|
||||
Intersection_list& inter_list) const
|
||||
{
|
||||
Intersection_list& inter_list) const {
|
||||
Point_2 p;
|
||||
unsigned int mult;
|
||||
|
||||
|
|
@ -1818,8 +1762,7 @@ protected:
|
|||
|
||||
/*! computes the intersections between two circles.
|
||||
*/
|
||||
void _circs_intersect(const Self& cv, Intersection_list& inter_list) const
|
||||
{
|
||||
void _circs_intersect(const Self& cv, Intersection_list& inter_list) const {
|
||||
Point_2 p;
|
||||
unsigned int mult;
|
||||
|
||||
|
|
@ -1884,8 +1827,7 @@ protected:
|
|||
/*! checks if the given point lies on the arc.
|
||||
* \pre p lies on the supporting curve.
|
||||
*/
|
||||
bool _is_between_endpoints(const Point_2& p) const
|
||||
{
|
||||
bool _is_between_endpoints(const Point_2& p) const {
|
||||
if (is_linear()) {
|
||||
if (is_vertical()) {
|
||||
// Check if the point is in the y-range of the arc.
|
||||
|
|
@ -1908,8 +1850,7 @@ protected:
|
|||
// Check whether p lies on the upper or on the lower part of the circle.
|
||||
Comparison_result c_res = CGAL::compare(p.y(), y0());
|
||||
|
||||
if ((_is_upper() && c_res == SMALLER) || (! _is_upper() && c_res == LARGER))
|
||||
{
|
||||
if ((_is_upper() && c_res == SMALLER) || (! _is_upper() && c_res == LARGER)) {
|
||||
// The point lies on the other half of the circle:
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1921,8 +1862,7 @@ protected:
|
|||
/*! checks whether the given point lies in the interior of the arc.
|
||||
* \pre p lies on the supporting curve.
|
||||
*/
|
||||
bool _is_strictly_between_endpoints(const Point_2& p) const
|
||||
{
|
||||
bool _is_strictly_between_endpoints(const Point_2& p) const {
|
||||
if (p.equals (m_source) || p.equals (m_target)) return false;
|
||||
return (_is_between_endpoints(p));
|
||||
}
|
||||
|
|
@ -1932,8 +1872,7 @@ protected:
|
|||
* \param overlap Output: The overlapping arc (if any).
|
||||
* \return Whether we found an overlap.
|
||||
*/
|
||||
bool _compute_overlap(const Self& cv, Self& overlap) const
|
||||
{
|
||||
bool _compute_overlap(const Self& cv, Self& overlap) const {
|
||||
// Check if the two arcs are identical.
|
||||
if (is_linear()) {
|
||||
// In case of line segments we can swap the source and target:
|
||||
|
|
@ -1999,10 +1938,9 @@ protected:
|
|||
return false;
|
||||
}
|
||||
|
||||
public:
|
||||
public:
|
||||
template <class OutputIterator>
|
||||
void approximate(OutputIterator oi, unsigned int n) const
|
||||
{
|
||||
void approximate(OutputIterator oi, unsigned int n) const {
|
||||
const double x_left = CGAL::to_double(this->source().x());
|
||||
const double y_left = CGAL::to_double(this->source().y());
|
||||
|
||||
|
|
@ -2045,8 +1983,7 @@ protected:
|
|||
* \pre Both ps and pt lies on the arc and must conform with the current
|
||||
* direction of the arc.
|
||||
*/
|
||||
Self trim(const Point_2& ps, const Point_2& pt) const
|
||||
{
|
||||
Self trim(const Point_2& ps, const Point_2& pt) const {
|
||||
Self arc = *this;
|
||||
|
||||
arc.m_source = ps;
|
||||
|
|
@ -2063,8 +2000,7 @@ protected:
|
|||
template <class Kernel, bool Filter>
|
||||
std::ostream&
|
||||
operator<<(std::ostream& os,
|
||||
const _X_monotone_circle_segment_2<Kernel, Filter> & arc)
|
||||
{
|
||||
const _X_monotone_circle_segment_2<Kernel, Filter>& arc) {
|
||||
if (! arc.is_linear())
|
||||
os << "(" << arc.supporting_circle() << ") ";
|
||||
|
||||
|
|
|
|||
|
|
@ -43,46 +43,41 @@ namespace CGAL {
|
|||
// Traits class for CGAL::Arrangement_2 (and similar) based on a
|
||||
// CircularKernel.
|
||||
|
||||
template < typename CircularKernel >
|
||||
template <typename CircularKernel>
|
||||
class Arr_line_arc_traits_2 {
|
||||
|
||||
CircularKernel ck;
|
||||
|
||||
public:
|
||||
using Kernel = CircularKernel;
|
||||
using Curve_2 = typename CircularKernel::Line_arc_2;
|
||||
using X_monotone_curve_2 = typename CircularKernel::Line_arc_2;
|
||||
using Multiplicity = std::size_t;
|
||||
|
||||
typedef CircularKernel Kernel;
|
||||
typedef typename CircularKernel::Line_arc_2 Curve_2;
|
||||
typedef typename CircularKernel::Line_arc_2 X_monotone_curve_2;
|
||||
typedef unsigned int Multiplicity;
|
||||
using Point = typename CircularKernel::Circular_arc_point_2;
|
||||
using Point_2 = typename CircularKernel::Circular_arc_point_2;
|
||||
|
||||
typedef typename CircularKernel::Circular_arc_point_2 Point;
|
||||
typedef typename CircularKernel::Circular_arc_point_2 Point_2;
|
||||
using Has_left_category = CGAL::Tag_false;
|
||||
using Has_merge_category = CGAL::Tag_false;
|
||||
using Has_do_intersect_category = CGAL::Tag_false;
|
||||
|
||||
typedef CGAL::Tag_false Has_left_category;
|
||||
typedef CGAL::Tag_false Has_merge_category;
|
||||
typedef CGAL::Tag_false Has_do_intersect_category;
|
||||
using Left_side_category = Arr_oblivious_side_tag;
|
||||
using Bottom_side_category = Arr_oblivious_side_tag;
|
||||
using Top_side_category = Arr_oblivious_side_tag;
|
||||
using Right_side_category = Arr_oblivious_side_tag;
|
||||
|
||||
typedef Arr_oblivious_side_tag Left_side_category;
|
||||
typedef Arr_oblivious_side_tag Bottom_side_category;
|
||||
typedef Arr_oblivious_side_tag Top_side_category;
|
||||
typedef Arr_oblivious_side_tag Right_side_category;
|
||||
Arr_line_arc_traits_2(const CircularKernel& k = CircularKernel()) : ck(k) {}
|
||||
|
||||
Arr_line_arc_traits_2(const CircularKernel &k = CircularKernel())
|
||||
: ck(k) {}
|
||||
|
||||
typedef typename CircularKernel::Compare_x_2 Compare_x_2;
|
||||
typedef typename CircularKernel::Compare_xy_2 Compare_xy_2;
|
||||
typedef typename CircularKernel::Compare_y_at_x_2 Compare_y_at_x_2;
|
||||
typedef typename CircularKernel::Compare_y_to_right_2 Compare_y_at_x_right_2;
|
||||
typedef typename CircularKernel::Equal_2 Equal_2;
|
||||
// typedef typename CircularKernel::Make_x_monotone_2 Make_x_monotone_2;
|
||||
typedef typename CircularKernel::Split_2 Split_2;
|
||||
typedef typename CircularKernel::Construct_circular_min_vertex_2
|
||||
Construct_min_vertex_2;
|
||||
typedef typename CircularKernel::Construct_circular_max_vertex_2
|
||||
Construct_max_vertex_2;
|
||||
typedef typename CircularKernel::Is_vertical_2 Is_vertical_2;
|
||||
typedef typename CircularKernel::Intersect_2 Intersect_2;
|
||||
using Compare_x_2 = typename CircularKernel::Compare_x_2;
|
||||
using Compare_xy_2 = typename CircularKernel::Compare_xy_2;
|
||||
using Compare_y_at_x_2 = typename CircularKernel::Compare_y_at_x_2;
|
||||
using Compare_y_at_x_right_2 = typename CircularKernel::Compare_y_to_right_2;
|
||||
using Equal_2 = typename CircularKernel::Equal_2;
|
||||
// using Make_x_monotone_2 = typename CircularKernel::Make_x_monotone_2;
|
||||
using Split_2 = typename CircularKernel::Split_2;
|
||||
using Construct_min_vertex_2 = typename CircularKernel::Construct_circular_min_vertex_2;
|
||||
using Construct_max_vertex_2 = typename CircularKernel::Construct_circular_max_vertex_2;
|
||||
using Is_vertical_2 = typename CircularKernel::Is_vertical_2;
|
||||
using Intersect_2 = typename CircularKernel::Intersect_2;
|
||||
|
||||
Compare_x_2 compare_x_2_object() const
|
||||
{ return ck.compare_x_2_object(); }
|
||||
|
|
@ -106,7 +101,7 @@ public:
|
|||
{ return ck.split_2_object(); }
|
||||
|
||||
Intersect_2 intersect_2_object() const
|
||||
{ return ck.intersect_2_object(); }
|
||||
{ return ck.intersect_2_object(); }
|
||||
|
||||
Construct_min_vertex_2 construct_min_vertex_2_object() const
|
||||
{ return ck.construct_circular_min_vertex_2_object(); }
|
||||
|
|
@ -121,9 +116,8 @@ public:
|
|||
class Make_x_monotone_2 {
|
||||
public:
|
||||
template <typename OutputIterator>
|
||||
OutputIterator operator()(const Curve_2& line, OutputIterator oi) const
|
||||
{
|
||||
typedef std::variant<Point_2, X_monotone_curve_2> Make_x_monotone_result;
|
||||
OutputIterator operator()(const Curve_2& line, OutputIterator oi) const {
|
||||
using Make_x_monotone_result = std::variant<Point_2, X_monotone_curve_2>;
|
||||
*oi++ = Make_x_monotone_result(line);
|
||||
return oi;
|
||||
}
|
||||
|
|
@ -137,4 +131,4 @@ public:
|
|||
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
||||
#endif // CGAL_CIRCULAR_KERNEL_LINE_ARC_TRAITS_H
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <variant>
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/tags.h>
|
||||
#include <CGAL/intersections.h>
|
||||
#include <CGAL/Arr_tags.h>
|
||||
|
|
@ -49,58 +49,55 @@ class Arr_linear_traits_2 : public Kernel_ {
|
|||
friend class Arr_linear_object_2<Kernel_>;
|
||||
|
||||
public:
|
||||
typedef Kernel_ Kernel;
|
||||
typedef typename Kernel::FT FT;
|
||||
using Kernel = Kernel_;
|
||||
using FT = typename Kernel::FT;
|
||||
|
||||
typedef typename Algebraic_structure_traits<FT>::Is_exact
|
||||
Has_exact_division;
|
||||
using Has_exact_division = typename Algebraic_structure_traits<FT>::Is_exact;
|
||||
|
||||
// Category tags:
|
||||
typedef Tag_true Has_left_category;
|
||||
typedef Tag_true Has_merge_category;
|
||||
typedef Tag_false Has_do_intersect_category;
|
||||
using Has_left_category = Tag_true;
|
||||
using Has_merge_category = Tag_true;
|
||||
using Has_do_intersect_category = Tag_false;
|
||||
|
||||
typedef Arr_open_side_tag Left_side_category;
|
||||
typedef Arr_open_side_tag Bottom_side_category;
|
||||
typedef Arr_open_side_tag Top_side_category;
|
||||
typedef Arr_open_side_tag Right_side_category;
|
||||
using Left_side_category = Arr_open_side_tag;
|
||||
using Bottom_side_category = Arr_open_side_tag;
|
||||
using Top_side_category = Arr_open_side_tag;
|
||||
using Right_side_category = Arr_open_side_tag;
|
||||
|
||||
typedef typename Kernel::Line_2 Line_2;
|
||||
typedef typename Kernel::Ray_2 Ray_2;
|
||||
typedef typename Kernel::Segment_2 Segment_2;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
using Ray_2 = typename Kernel::Ray_2;
|
||||
using Segment_2 = typename Kernel::Segment_2;
|
||||
|
||||
typedef CGAL::Segment_assertions<Arr_linear_traits_2<Kernel> >
|
||||
Segment_assertions;
|
||||
using Segment_assertions = CGAL::Segment_assertions<Arr_linear_traits_2<Kernel>>;
|
||||
|
||||
/*! \class Representation of a linear with cached data.
|
||||
*/
|
||||
class _Linear_object_cached_2 {
|
||||
public:
|
||||
typedef typename Kernel::Line_2 Line_2;
|
||||
typedef typename Kernel::Ray_2 Ray_2;
|
||||
typedef typename Kernel::Segment_2 Segment_2;
|
||||
typedef typename Kernel::Point_2 Point_2;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
using Ray_2 = typename Kernel::Ray_2;
|
||||
using Segment_2 = typename Kernel::Segment_2;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
|
||||
protected:
|
||||
Line_2 l; // The supporting line.
|
||||
Point_2 ps; // The source point (if exists).
|
||||
Point_2 pt; // The target point (if exists).
|
||||
bool has_source; // Is the source point valid
|
||||
Line_2 l; // The supporting line.
|
||||
Point_2 ps; // The source point (if exists).
|
||||
Point_2 pt; // The target point (if exists).
|
||||
bool has_source; // Is the source point valid
|
||||
// (false for a line).
|
||||
bool has_target; // Is the target point valid
|
||||
bool has_target; // Is the target point valid
|
||||
// (false for a line and for a ray).
|
||||
bool is_right; // Is the object directed to the right
|
||||
bool is_right; // Is the object directed to the right
|
||||
// (for segments and rays).
|
||||
bool is_vert; // Is this a vertical object.
|
||||
bool is_horiz; // Is this a horizontal object.
|
||||
bool has_pos_slope; // Does the supporting line has a positive
|
||||
bool is_vert; // Is this a vertical object.
|
||||
bool is_horiz; // Is this a horizontal object.
|
||||
bool has_pos_slope; // Does the supporting line has a positive
|
||||
// slope (if all three flags is_vert, is_horiz
|
||||
// and has_pos_slope are false, then the line
|
||||
// has a negative slope).
|
||||
bool is_degen; // Is the object degenerate (a single point).
|
||||
bool is_degen; // Is the object degenerate (a single point).
|
||||
|
||||
public:
|
||||
|
||||
/*! constructs default.
|
||||
*/
|
||||
_Linear_object_cached_2() :
|
||||
|
|
@ -121,8 +118,7 @@ public:
|
|||
ps(source),
|
||||
pt(target),
|
||||
has_source(true),
|
||||
has_target(true)
|
||||
{
|
||||
has_target(true) {
|
||||
Kernel kernel;
|
||||
|
||||
Comparison_result res = kernel.compare_xy_2_object()(source, target);
|
||||
|
|
@ -144,8 +140,7 @@ public:
|
|||
*/
|
||||
_Linear_object_cached_2(const Segment_2& seg) :
|
||||
has_source(true),
|
||||
has_target(true)
|
||||
{
|
||||
has_target(true) {
|
||||
Kernel kernel;
|
||||
|
||||
CGAL_assertion_msg(! kernel.is_degenerate_2_object()(seg),
|
||||
|
|
@ -172,8 +167,7 @@ public:
|
|||
*/
|
||||
_Linear_object_cached_2(const Ray_2& ray) :
|
||||
has_source(true),
|
||||
has_target(false)
|
||||
{
|
||||
has_target(false) {
|
||||
Kernel kernel;
|
||||
|
||||
CGAL_assertion_msg(! kernel.is_degenerate_2_object()(ray),
|
||||
|
|
@ -201,8 +195,7 @@ public:
|
|||
_Linear_object_cached_2(const Line_2& ln) :
|
||||
l(ln),
|
||||
has_source(false),
|
||||
has_target(false)
|
||||
{
|
||||
has_target(false) {
|
||||
Kernel kernel;
|
||||
|
||||
CGAL_assertion_msg(! kernel.is_degenerate_2_object()(ln),
|
||||
|
|
@ -226,8 +219,7 @@ public:
|
|||
* \return `ARR_LEFT_BOUNDARY` if the left point is near the boundary;
|
||||
* `ARR_INTERIOR` if the \f$x\f$-coordinate is finite.
|
||||
*/
|
||||
Arr_parameter_space left_infinite_in_x() const
|
||||
{
|
||||
Arr_parameter_space left_infinite_in_x() const {
|
||||
if (is_vert || is_degen) return (ARR_INTERIOR);
|
||||
|
||||
return (is_right) ?
|
||||
|
|
@ -240,8 +232,7 @@ public:
|
|||
* `ARR_INTERIOR` if the \f$y\f$-coordinate is finite.
|
||||
* `ARR_TOP_BOUNDARY` if the left point is at \f$y = +\infty\f$;
|
||||
*/
|
||||
Arr_parameter_space left_infinite_in_y() const
|
||||
{
|
||||
Arr_parameter_space left_infinite_in_y() const {
|
||||
if (is_horiz || is_degen) return ARR_INTERIOR;
|
||||
|
||||
if (is_vert) {
|
||||
|
|
@ -263,8 +254,7 @@ public:
|
|||
/*! obtains the (lexicographically) left endpoint.
|
||||
* \pre The left point is finite.
|
||||
*/
|
||||
const Point_2& left() const
|
||||
{
|
||||
const Point_2& left() const {
|
||||
CGAL_precondition(has_left());
|
||||
return (is_right ? ps : pt);
|
||||
}
|
||||
|
|
@ -274,8 +264,7 @@ public:
|
|||
* \pre p lies on the supporting line to the left of the right endpoint.
|
||||
*/
|
||||
void set_left(const Point_2& p,
|
||||
bool CGAL_assertion_code(check_validity) = true)
|
||||
{
|
||||
bool CGAL_assertion_code(check_validity) = true) {
|
||||
CGAL_precondition(! is_degen);
|
||||
|
||||
CGAL_precondition_code(Kernel kernel);
|
||||
|
|
@ -296,8 +285,7 @@ public:
|
|||
|
||||
/*! sets the (lexicographically) left endpoint as infinite.
|
||||
*/
|
||||
void set_left()
|
||||
{
|
||||
void set_left() {
|
||||
CGAL_precondition(! is_degen);
|
||||
|
||||
if (is_right) has_source = false;
|
||||
|
|
@ -308,8 +296,7 @@ public:
|
|||
* \return `ARR_RIGHT_BOUNDARY` if the right point is near the boundary;
|
||||
* `ARR_INTERIOR` if the \f$x\f$-coordinate is finite.
|
||||
*/
|
||||
Arr_parameter_space right_infinite_in_x() const
|
||||
{
|
||||
Arr_parameter_space right_infinite_in_x() const {
|
||||
if (is_vert || is_degen) return ARR_INTERIOR;
|
||||
|
||||
return (is_right) ?
|
||||
|
|
@ -322,8 +309,7 @@ public:
|
|||
* `ARR_INTERIOR` if the \f$y\f$-coordinate is finite.
|
||||
* `ARR_TOP_BOUNDARY` if the right point is at \f$y = +\infty\f$;
|
||||
*/
|
||||
Arr_parameter_space right_infinite_in_y() const
|
||||
{
|
||||
Arr_parameter_space right_infinite_in_y() const {
|
||||
if (is_horiz || is_degen) return ARR_INTERIOR;
|
||||
|
||||
if (is_vert) {
|
||||
|
|
@ -345,8 +331,7 @@ public:
|
|||
/*! obtains the (lexicographically) right endpoint.
|
||||
* \pre The right endpoint is finite.
|
||||
*/
|
||||
const Point_2& right() const
|
||||
{
|
||||
const Point_2& right() const {
|
||||
CGAL_precondition(has_right());
|
||||
return (is_right ? pt : ps);
|
||||
}
|
||||
|
|
@ -356,8 +341,7 @@ public:
|
|||
* \pre p lies on the supporting line to the right of the left endpoint.
|
||||
*/
|
||||
void set_right(const Point_2& p,
|
||||
bool CGAL_assertion_code(check_validity) = true)
|
||||
{
|
||||
bool CGAL_assertion_code(check_validity) = true) {
|
||||
CGAL_precondition(! is_degen);
|
||||
CGAL_precondition_code(Kernel kernel);
|
||||
CGAL_precondition
|
||||
|
|
@ -377,8 +361,7 @@ public:
|
|||
|
||||
/*! sets the (lexicographically) right endpoint as infinite.
|
||||
*/
|
||||
void set_right()
|
||||
{
|
||||
void set_right() {
|
||||
CGAL_precondition(! is_degen);
|
||||
|
||||
if (is_right) has_target = false;
|
||||
|
|
@ -387,16 +370,14 @@ public:
|
|||
|
||||
/*! obtains the supporting line.
|
||||
*/
|
||||
const Line_2& supp_line() const
|
||||
{
|
||||
const Line_2& supp_line() const {
|
||||
CGAL_precondition(! is_degen);
|
||||
return (l);
|
||||
}
|
||||
|
||||
/*! checks whether the curve is vertical.
|
||||
*/
|
||||
bool is_vertical() const
|
||||
{
|
||||
bool is_vertical() const {
|
||||
CGAL_precondition(! is_degen);
|
||||
return (is_vert);
|
||||
}
|
||||
|
|
@ -414,8 +395,7 @@ public:
|
|||
* \return (true) is in the \f$x\f$-range of the segment; (false) if it is
|
||||
* not.
|
||||
*/
|
||||
bool is_in_x_range(const Point_2& p) const
|
||||
{
|
||||
bool is_in_x_range(const Point_2& p) const {
|
||||
Kernel kernel;
|
||||
typename Kernel_::Compare_x_2 compare_x = kernel.compare_x_2_object();
|
||||
Comparison_result res1;
|
||||
|
|
@ -454,8 +434,7 @@ public:
|
|||
* \return (true) is in the \f$y\f$-range of the segment; (false) if it is
|
||||
* not.
|
||||
*/
|
||||
bool is_in_y_range(const Point_2& p) const
|
||||
{
|
||||
bool is_in_y_range(const Point_2& p) const {
|
||||
CGAL_precondition(is_vertical());
|
||||
|
||||
Kernel kernel;
|
||||
|
|
@ -483,8 +462,7 @@ public:
|
|||
private:
|
||||
/*! determines if the supporting line has a positive slope.
|
||||
*/
|
||||
bool _has_positive_slope() const
|
||||
{
|
||||
bool _has_positive_slope() const {
|
||||
if (is_vert) return true;
|
||||
if (is_horiz) return false;
|
||||
|
||||
|
|
@ -498,10 +476,10 @@ public:
|
|||
|
||||
public:
|
||||
// Traits objects
|
||||
typedef typename Kernel::Point_2 Point_2;
|
||||
typedef Arr_linear_object_2<Kernel> X_monotone_curve_2;
|
||||
typedef Arr_linear_object_2<Kernel> Curve_2;
|
||||
typedef unsigned int Multiplicity;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
using X_monotone_curve_2 = Arr_linear_object_2<Kernel>;
|
||||
using Curve_2 = Arr_linear_object_2<Kernel>;
|
||||
using Multiplicity = std::size_t;
|
||||
|
||||
public:
|
||||
/*! constructs default.
|
||||
|
|
@ -514,7 +492,7 @@ public:
|
|||
/*! A functor that compares the \f$x\f$-coordinates of two points */
|
||||
class Compare_x_2 {
|
||||
protected:
|
||||
typedef Arr_linear_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_linear_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -538,8 +516,7 @@ public:
|
|||
* 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 {
|
||||
const Kernel& kernel = m_traits;
|
||||
return (kernel.compare_x_2_object()(p1, p2));
|
||||
}
|
||||
|
|
@ -567,7 +544,7 @@ public:
|
|||
|
||||
class Trim_2 {
|
||||
protected:
|
||||
typedef Arr_linear_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_linear_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -586,10 +563,8 @@ public:
|
|||
public:
|
||||
X_monotone_curve_2 operator()(const X_monotone_curve_2 xcv,
|
||||
const Point_2 src,
|
||||
const Point_2 tgt)
|
||||
{
|
||||
/*
|
||||
* "Line_segment, line, and ray" will become line segments
|
||||
const Point_2 tgt) {
|
||||
/* "Line_segment, line, and ray" will become line segments
|
||||
* when trimmed.
|
||||
*/
|
||||
Equal_2 equal = Equal_2();
|
||||
|
|
@ -619,7 +594,7 @@ public:
|
|||
|
||||
class Construct_opposite_2{
|
||||
protected:
|
||||
typedef Arr_linear_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_linear_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -636,8 +611,7 @@ public:
|
|||
friend class Arr_linear_traits_2<Kernel>;
|
||||
|
||||
public:
|
||||
X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv) const
|
||||
{
|
||||
X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv) const {
|
||||
CGAL_precondition(! xcv.is_degenerate());
|
||||
|
||||
X_monotone_curve_2 opp_xcv;
|
||||
|
|
@ -667,8 +641,7 @@ public:
|
|||
* 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 {
|
||||
Kernel kernel;
|
||||
return (kernel.compare_xy_2_object()(p1, p2));
|
||||
}
|
||||
|
|
@ -685,8 +658,7 @@ public:
|
|||
* \pre The left end of cv is a valid (bounded) point.
|
||||
* \return The left endpoint.
|
||||
*/
|
||||
const Point_2& operator()(const X_monotone_curve_2& cv) const
|
||||
{
|
||||
const Point_2& operator()(const X_monotone_curve_2& cv) const {
|
||||
CGAL_precondition(! cv.is_degenerate());
|
||||
CGAL_precondition(cv.has_left());
|
||||
|
||||
|
|
@ -706,8 +678,7 @@ public:
|
|||
* \pre The right end of cv is a valid (bounded) point.
|
||||
* \return The right endpoint.
|
||||
*/
|
||||
const Point_2& operator()(const X_monotone_curve_2& cv) const
|
||||
{
|
||||
const Point_2& operator()(const X_monotone_curve_2& cv) const {
|
||||
CGAL_precondition(! cv.is_degenerate());
|
||||
CGAL_precondition(cv.has_right());
|
||||
|
||||
|
|
@ -726,8 +697,7 @@ public:
|
|||
* \param cv The curve.
|
||||
* \return (true) if the curve is a vertical segment; (false) otherwise.
|
||||
*/
|
||||
bool operator()(const X_monotone_curve_2& cv) const
|
||||
{
|
||||
bool operator()(const X_monotone_curve_2& cv) const {
|
||||
CGAL_precondition(! cv.is_degenerate());
|
||||
return (cv.is_vertical());
|
||||
}
|
||||
|
|
@ -741,7 +711,7 @@ public:
|
|||
*/
|
||||
class Compare_y_at_x_2 {
|
||||
protected:
|
||||
typedef Arr_linear_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_linear_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -767,8 +737,7 @@ public:
|
|||
* EQUAL if p lies on the curve.
|
||||
*/
|
||||
Comparison_result operator()(const Point_2& p,
|
||||
const X_monotone_curve_2& cv) const
|
||||
{
|
||||
const X_monotone_curve_2& cv) const {
|
||||
CGAL_precondition(! cv.is_degenerate());
|
||||
CGAL_precondition(cv.is_in_x_range(p));
|
||||
|
||||
|
|
@ -809,8 +778,7 @@ public:
|
|||
*/
|
||||
Comparison_result operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
const Point_2& CGAL_precondition_code(p)) const
|
||||
{
|
||||
const Point_2& CGAL_precondition_code(p)) const {
|
||||
CGAL_precondition(! cv1.is_degenerate());
|
||||
CGAL_precondition(! cv2.is_degenerate());
|
||||
|
||||
|
|
@ -861,8 +829,7 @@ public:
|
|||
*/
|
||||
Comparison_result operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
const Point_2& CGAL_precondition_code(p)) const
|
||||
{
|
||||
const Point_2& CGAL_precondition_code(p)) const {
|
||||
CGAL_precondition(! cv1.is_degenerate());
|
||||
CGAL_precondition(! cv2.is_degenerate());
|
||||
|
||||
|
|
@ -906,8 +873,7 @@ public:
|
|||
* \return (true) if the two curves are the same; (false) otherwise.
|
||||
*/
|
||||
bool operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2) const
|
||||
{
|
||||
const X_monotone_curve_2& cv2) const {
|
||||
CGAL_precondition(! cv1.is_degenerate());
|
||||
CGAL_precondition(! cv2.is_degenerate());
|
||||
|
||||
|
|
@ -918,17 +884,13 @@ public:
|
|||
if (! equal(cv1.supp_line(), cv2.supp_line()) &&
|
||||
! equal(cv1.supp_line(),
|
||||
kernel.construct_opposite_line_2_object()(cv2.supp_line())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that either the two left endpoints are at infinity, or they
|
||||
// are bounded and equal.
|
||||
if ((cv1.has_left() != cv2.has_left()) ||
|
||||
(cv1.has_left() && ! equal(cv1.left(), cv2.left())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that either the two right endpoints are at infinity, or they
|
||||
// are bounded and equal.
|
||||
|
|
@ -941,8 +903,7 @@ public:
|
|||
* \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
|
||||
{
|
||||
bool operator()(const Point_2& p1, const Point_2& p2) const {
|
||||
Kernel kernel;
|
||||
return (kernel.equal_2_object()(p1, p2));
|
||||
}
|
||||
|
|
@ -973,8 +934,7 @@ public:
|
|||
* the left at the line right end.
|
||||
*/
|
||||
Arr_parameter_space operator()(const X_monotone_curve_2 & xcv,
|
||||
Arr_curve_end ce) const
|
||||
{
|
||||
Arr_curve_end ce) const {
|
||||
CGAL_precondition(! xcv.is_degenerate());
|
||||
return (ce == ARR_MIN_END) ?
|
||||
xcv.left_infinite_in_x() : xcv.right_infinite_in_x();
|
||||
|
|
@ -1015,8 +975,7 @@ public:
|
|||
* right end.
|
||||
*/
|
||||
Arr_parameter_space operator()(const X_monotone_curve_2 & xcv,
|
||||
Arr_curve_end ce) const
|
||||
{
|
||||
Arr_curve_end ce) const {
|
||||
CGAL_precondition(! xcv.is_degenerate());
|
||||
|
||||
return (ce == ARR_MIN_END) ?
|
||||
|
|
@ -1040,7 +999,7 @@ public:
|
|||
*/
|
||||
class Compare_x_on_boundary_2 {
|
||||
protected:
|
||||
typedef Arr_linear_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_linear_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -1074,8 +1033,7 @@ public:
|
|||
*/
|
||||
Comparison_result operator()(const Point_2 & p,
|
||||
const X_monotone_curve_2 & xcv,
|
||||
Arr_curve_end ) const
|
||||
{
|
||||
Arr_curve_end ) const {
|
||||
CGAL_precondition(! xcv.is_degenerate());
|
||||
CGAL_precondition(xcv.is_vertical());
|
||||
|
||||
|
|
@ -1105,8 +1063,7 @@ public:
|
|||
Comparison_result operator()(const X_monotone_curve_2 & xcv1,
|
||||
Arr_curve_end /* ce1 */,
|
||||
const X_monotone_curve_2 & xcv2,
|
||||
Arr_curve_end /* ce2 */) const
|
||||
{
|
||||
Arr_curve_end /* ce2 */) const {
|
||||
CGAL_precondition(! xcv1.is_degenerate());
|
||||
CGAL_precondition(! xcv2.is_degenerate());
|
||||
CGAL_precondition(xcv1.is_vertical());
|
||||
|
|
@ -1152,8 +1109,7 @@ public:
|
|||
Comparison_result
|
||||
operator()(const X_monotone_curve_2& CGAL_precondition_code(xcv1),
|
||||
const X_monotone_curve_2& CGAL_precondition_code(xcv2),
|
||||
Arr_curve_end /* ce2 */) const
|
||||
{
|
||||
Arr_curve_end /* ce2 */) const {
|
||||
CGAL_precondition(! xcv1.is_degenerate());
|
||||
CGAL_precondition(! xcv2.is_degenerate());
|
||||
CGAL_precondition(xcv1.is_vertical());
|
||||
|
|
@ -1171,7 +1127,7 @@ public:
|
|||
*/
|
||||
class Compare_y_near_boundary_2 {
|
||||
protected:
|
||||
typedef Arr_linear_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_linear_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -1199,8 +1155,7 @@ public:
|
|||
*/
|
||||
Comparison_result operator()(const X_monotone_curve_2 & xcv1,
|
||||
const X_monotone_curve_2 & xcv2,
|
||||
Arr_curve_end ce) const
|
||||
{
|
||||
Arr_curve_end ce) const {
|
||||
// Make sure both curves are defined at \f$x = -\infty\f$ (or at
|
||||
// \f$x = +\infty\f$).
|
||||
CGAL_precondition(! xcv1.is_degenerate());
|
||||
|
|
@ -1252,11 +1207,9 @@ 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 {
|
||||
// Wrap the segment with a variant.
|
||||
typedef std::variant<Point_2, X_monotone_curve_2>
|
||||
Make_x_monotone_result;
|
||||
using Make_x_monotone_result = std::variant<Point_2, X_monotone_curve_2>;
|
||||
*oi++ = Make_x_monotone_result(cv);
|
||||
return oi;
|
||||
}
|
||||
|
|
@ -1277,8 +1230,7 @@ public:
|
|||
* \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,
|
||||
X_monotone_curve_2& c1, X_monotone_curve_2& c2) const
|
||||
{
|
||||
X_monotone_curve_2& c1, X_monotone_curve_2& c2) const {
|
||||
CGAL_precondition(! cv.is_degenerate());
|
||||
|
||||
// Make sure that p lies on the interior of the curve.
|
||||
|
|
@ -1306,7 +1258,7 @@ public:
|
|||
|
||||
class Intersect_2 {
|
||||
protected:
|
||||
typedef Arr_linear_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_linear_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -1330,9 +1282,8 @@ public:
|
|||
template <typename OutputIterator>
|
||||
OutputIterator operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
OutputIterator oi) const
|
||||
{
|
||||
typedef std::pair<Point_2, Multiplicity> Intersection_point;
|
||||
OutputIterator oi) const {
|
||||
using Intersection_point = std::pair<Point_2, Multiplicity>;
|
||||
|
||||
CGAL_precondition(! cv1.is_degenerate());
|
||||
CGAL_precondition(! cv2.is_degenerate());
|
||||
|
|
@ -1429,8 +1380,7 @@ public:
|
|||
* by the same line and share a common endpoint; (false) otherwise.
|
||||
*/
|
||||
bool operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2) const
|
||||
{
|
||||
const X_monotone_curve_2& cv2) const {
|
||||
CGAL_precondition(! cv1.is_degenerate());
|
||||
CGAL_precondition(! cv2.is_degenerate());
|
||||
|
||||
|
|
@ -1460,7 +1410,7 @@ public:
|
|||
*/
|
||||
class Merge_2 {
|
||||
protected:
|
||||
typedef Arr_linear_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_linear_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -1481,8 +1431,7 @@ public:
|
|||
*/
|
||||
void operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
X_monotone_curve_2& c) const
|
||||
{
|
||||
X_monotone_curve_2& c) const {
|
||||
CGAL_precondition(m_traits.are_mergeable_2_object()(cv2, cv1));
|
||||
|
||||
CGAL_precondition(!cv1.is_degenerate());
|
||||
|
|
@ -1492,8 +1441,7 @@ public:
|
|||
|
||||
// Check which curve extends to the right of the other.
|
||||
if (cv1.has_right() && cv2.has_left() &&
|
||||
equal(cv1.right(), cv2.left()))
|
||||
{
|
||||
equal(cv1.right(), cv2.left())) {
|
||||
// cv2 extends cv1 to the right.
|
||||
c = cv1;
|
||||
|
||||
|
|
@ -1519,9 +1467,9 @@ public:
|
|||
|
||||
/// \name Functor definitions for the landmarks point-location strategy.
|
||||
//@{
|
||||
typedef double Approximate_number_type;
|
||||
typedef CGAL::Cartesian<Approximate_number_type> Approximate_kernel;
|
||||
typedef Approximate_kernel::Point_2 Approximate_point_2;
|
||||
using Approximate_number_type = double;
|
||||
using Approximate_kernel = CGAL::Simple_cartesian<Approximate_number_type>;
|
||||
using Approximate_point_2 = Approximate_kernel::Point_2;
|
||||
|
||||
class Approximate_2 {
|
||||
protected:
|
||||
|
|
@ -1545,8 +1493,7 @@ public:
|
|||
* \return An approximation of `p`'s \f$x\f$-coordinate (if `i` == 0), or an
|
||||
* approximation of `p`'s \f$y\f$-coordinate (if `i` == 1).
|
||||
*/
|
||||
Approximate_number_type operator()(const Point_2& p, int i) const
|
||||
{
|
||||
Approximate_number_type operator()(const Point_2& p, int i) const {
|
||||
CGAL_precondition((i == 0) || (i == 1));
|
||||
return (i == 0) ? CGAL::to_double(p.x()) : CGAL::to_double(p.y());
|
||||
}
|
||||
|
|
@ -1580,8 +1527,7 @@ public:
|
|||
template <typename OutputIterator>
|
||||
OutputIterator operator()(const X_monotone_curve_2& xcv, double /* error */,
|
||||
OutputIterator oi, const Bbox_2& bbox,
|
||||
bool l2r = true) const
|
||||
{
|
||||
bool l2r = true) const {
|
||||
using Approx_pnt = Approximate_point_2;
|
||||
using Approx_seg = Approximate_kernel::Segment_2;
|
||||
using Approx_ray = Approximate_kernel::Ray_2;
|
||||
|
|
@ -1657,8 +1603,7 @@ public:
|
|||
* \pre p and q must not be the same.
|
||||
* \return A segment connecting `p` and `q`.
|
||||
*/
|
||||
X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q) const
|
||||
{
|
||||
X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q) const {
|
||||
Kernel kernel;
|
||||
Segment_2 seg = kernel.construct_segment_2_object()(p, q);
|
||||
|
||||
|
|
@ -1675,7 +1620,7 @@ public:
|
|||
//@{
|
||||
|
||||
//! Functor
|
||||
typedef Construct_x_monotone_curve_2 Construct_curve_2;
|
||||
using Construct_curve_2 = Construct_x_monotone_curve_2;
|
||||
|
||||
/*! obtains a `Construct_curve_2` functor object. */
|
||||
Construct_curve_2 construct_curve_2_object() const
|
||||
|
|
@ -1688,18 +1633,16 @@ public:
|
|||
*/
|
||||
template <typename Kernel_>
|
||||
class Arr_linear_object_2 :
|
||||
public Arr_linear_traits_2<Kernel_>::_Linear_object_cached_2
|
||||
{
|
||||
typedef typename Arr_linear_traits_2<Kernel_>::_Linear_object_cached_2
|
||||
Base;
|
||||
public Arr_linear_traits_2<Kernel_>::_Linear_object_cached_2 {
|
||||
using Base = typename Arr_linear_traits_2<Kernel_>::_Linear_object_cached_2;
|
||||
|
||||
public:
|
||||
typedef Kernel_ Kernel;
|
||||
using Kernel = Kernel_;
|
||||
|
||||
typedef typename Kernel::Point_2 Point_2;
|
||||
typedef typename Kernel::Segment_2 Segment_2;
|
||||
typedef typename Kernel::Ray_2 Ray_2;
|
||||
typedef typename Kernel::Line_2 Line_2;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
using Segment_2 = typename Kernel::Segment_2;
|
||||
using Ray_2 = typename Kernel::Ray_2;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
|
||||
public:
|
||||
/*! constructs default.
|
||||
|
|
@ -1739,8 +1682,7 @@ public:
|
|||
/*! casts to a segment.
|
||||
* \pre The linear object is really a segment.
|
||||
*/
|
||||
Segment_2 segment() const
|
||||
{
|
||||
Segment_2 segment() const {
|
||||
CGAL_precondition(is_segment());
|
||||
|
||||
Kernel kernel;
|
||||
|
|
@ -1756,8 +1698,7 @@ public:
|
|||
/*! casts to a ray.
|
||||
* \pre The linear object is really a ray.
|
||||
*/
|
||||
Ray_2 ray() const
|
||||
{
|
||||
Ray_2 ray() const {
|
||||
CGAL_precondition(is_ray());
|
||||
|
||||
Kernel kernel;
|
||||
|
|
@ -1776,8 +1717,7 @@ public:
|
|||
/*! casts to a line.
|
||||
* \pre The linear object is really a line.
|
||||
*/
|
||||
Line_2 line() const
|
||||
{
|
||||
Line_2 line() const {
|
||||
CGAL_precondition(is_line());
|
||||
return (this->l);
|
||||
}
|
||||
|
|
@ -1785,8 +1725,7 @@ public:
|
|||
/*! obtains the supporting line.
|
||||
* \pre The object is not a point.
|
||||
*/
|
||||
const Line_2& supporting_line() const
|
||||
{
|
||||
const Line_2& supporting_line() const {
|
||||
CGAL_precondition(! this->is_degen);
|
||||
return (this->l);
|
||||
}
|
||||
|
|
@ -1794,8 +1733,7 @@ public:
|
|||
/*! obtains the source point.
|
||||
* \pre The object is a point, a segment or a ray.
|
||||
*/
|
||||
const Point_2& source() const
|
||||
{
|
||||
const Point_2& source() const {
|
||||
CGAL_precondition(! is_line());
|
||||
|
||||
if (this->is_degen) return (this->ps); // For a point.
|
||||
|
|
@ -1806,16 +1744,14 @@ public:
|
|||
/*! obtains the target point.
|
||||
* \pre The object is a point or a segment.
|
||||
*/
|
||||
const Point_2& target() const
|
||||
{
|
||||
const Point_2& target() const {
|
||||
CGAL_precondition(! is_line() && ! is_ray());
|
||||
return (this->pt);
|
||||
}
|
||||
|
||||
/*! creates a bounding box for the linear object.
|
||||
*/
|
||||
Bbox_2 bbox() const
|
||||
{
|
||||
Bbox_2 bbox() const {
|
||||
CGAL_precondition(this->is_segment());
|
||||
Kernel kernel;
|
||||
Segment_2 seg = kernel.construct_segment_2_object()(this->ps, this->pt);
|
||||
|
|
@ -1834,8 +1770,7 @@ public:
|
|||
*/
|
||||
template <typename Kernel, typename OutputStream>
|
||||
OutputStream& operator<<(OutputStream& os,
|
||||
const Arr_linear_object_2<Kernel>& lobj)
|
||||
{
|
||||
const Arr_linear_object_2<Kernel>& lobj) {
|
||||
// Print a letter identifying the object type, then the object itself.
|
||||
if (lobj.is_segment()) os << " S " << lobj.segment();
|
||||
else if (lobj.is_ray()) os << " R " << lobj.ray();
|
||||
|
|
@ -1846,8 +1781,7 @@ OutputStream& operator<<(OutputStream& os,
|
|||
/*! Importer for the segment class used by the traits-class.
|
||||
*/
|
||||
template <typename Kernel, typename InputStream>
|
||||
InputStream& operator>>(InputStream& is, Arr_linear_object_2<Kernel>& lobj)
|
||||
{
|
||||
InputStream& operator>>(InputStream& is, Arr_linear_object_2<Kernel>& lobj) {
|
||||
// Read the object type.
|
||||
char c;
|
||||
do {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
* functors required by the concept it models.
|
||||
*/
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Algebraic_structure_traits.h>
|
||||
#include <CGAL/number_utils.h>
|
||||
#include <CGAL/tags.h>
|
||||
|
|
@ -44,34 +44,28 @@ namespace CGAL {
|
|||
* A model of the AosBasicTraits_2 concept that handles \f$x\f$-monotone
|
||||
* non-intersecting line segments.
|
||||
*/
|
||||
template <class T_Kernel>
|
||||
class Arr_non_caching_segment_basic_traits_2 : public T_Kernel
|
||||
{
|
||||
template <typename T_Kernel>
|
||||
class Arr_non_caching_segment_basic_traits_2 : public T_Kernel {
|
||||
public:
|
||||
|
||||
typedef T_Kernel Kernel;
|
||||
|
||||
typedef typename Kernel::FT FT;
|
||||
using Kernel = T_Kernel;
|
||||
using FT = typename Kernel::FT;
|
||||
|
||||
private:
|
||||
typedef Algebraic_structure_traits<FT> AST;
|
||||
typedef typename AST::Is_exact FT_is_exact;
|
||||
using AST = Algebraic_structure_traits<FT>;
|
||||
using FT_is_exact = typename AST::Is_exact;
|
||||
|
||||
public:
|
||||
|
||||
typedef Boolean_tag<FT_is_exact::value> Has_exact_division;
|
||||
|
||||
typedef
|
||||
CGAL::Segment_assertions<Arr_non_caching_segment_basic_traits_2<Kernel> >
|
||||
Segment_assertions;
|
||||
using Has_exact_division = Boolean_tag<FT_is_exact::value>;
|
||||
using Segment_assertions = CGAL::Segment_assertions<Arr_non_caching_segment_basic_traits_2<Kernel>>;
|
||||
|
||||
// Categories:
|
||||
typedef Tag_true Has_left_category;
|
||||
typedef Tag_false Has_do_intersect_category;
|
||||
using Has_left_category = Tag_true;
|
||||
using Has_do_intersect_category = Tag_false;
|
||||
|
||||
typedef Arr_oblivious_side_tag Left_side_category;
|
||||
typedef Arr_oblivious_side_tag Bottom_side_category;
|
||||
typedef Arr_oblivious_side_tag Top_side_category;
|
||||
typedef Arr_oblivious_side_tag Right_side_category;
|
||||
using Left_side_category = Arr_oblivious_side_tag;
|
||||
using Bottom_side_category = Arr_oblivious_side_tag;
|
||||
using Top_side_category = Arr_oblivious_side_tag;
|
||||
using Right_side_category = Arr_oblivious_side_tag;
|
||||
|
||||
/*! constructs default */
|
||||
Arr_non_caching_segment_basic_traits_2() {}
|
||||
|
|
@ -80,30 +74,30 @@ public:
|
|||
//@{
|
||||
|
||||
// Traits types:
|
||||
typedef typename Kernel::Point_2 Point_2;
|
||||
typedef typename Kernel::Segment_2 X_monotone_curve_2;
|
||||
typedef unsigned int Multiplicity;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
using X_monotone_curve_2 = typename Kernel::Segment_2;
|
||||
using Multiplicity = std::size_t;
|
||||
|
||||
/*! Compare the \f$x\f$-coordinates of two points. */
|
||||
typedef typename Kernel::Compare_x_2 Compare_x_2;
|
||||
/*! compares the \f$x\f$-coordinates of two points. */
|
||||
using Compare_x_2 = typename Kernel::Compare_x_2;
|
||||
|
||||
/*! Compare two points lexigoraphically; by \f$x\f$, then by \f$y\f$. */
|
||||
typedef typename Kernel::Compare_xy_2 Compare_xy_2;
|
||||
/*! compares two points lexigoraphically; by \f$x\f$, then by \f$y\f$. */
|
||||
using Compare_xy_2 = typename Kernel::Compare_xy_2;
|
||||
|
||||
/*! Obtain the left endpoint of a given segment. */
|
||||
typedef typename Kernel::Construct_min_vertex_2 Construct_min_vertex_2;
|
||||
/*! obtains the left endpoint of a given segment. */
|
||||
using Construct_min_vertex_2 = typename Kernel::Construct_min_vertex_2;
|
||||
|
||||
/*! Obtain the right endpoint of a given segment. */
|
||||
typedef typename Kernel::Construct_max_vertex_2 Construct_max_vertex_2;
|
||||
/*! obtains the right endpoint of a given segment. */
|
||||
using Construct_max_vertex_2 = typename Kernel::Construct_max_vertex_2;
|
||||
|
||||
/*! Check whether a given segment is vertical. */
|
||||
typedef typename Kernel::Is_vertical_2 Is_vertical_2;
|
||||
/*! checks whether a given segment is vertical. */
|
||||
using Is_vertical_2 = typename Kernel::Is_vertical_2;
|
||||
|
||||
/*! Return the location of a given point with respect to an input segment. */
|
||||
typedef typename Kernel::Compare_y_at_x_2 Compare_y_at_x_2;
|
||||
/*! returns the location of a given point with respect to an input segment. */
|
||||
using Compare_y_at_x_2 = typename Kernel::Compare_y_at_x_2;
|
||||
|
||||
/*! Check if two segments or if two points are identical. */
|
||||
typedef typename Kernel::Equal_2 Equal_2;
|
||||
/*! checks if two segments or if two points are identical. */
|
||||
using Equal_2 = typename Kernel::Equal_2;
|
||||
|
||||
//@}
|
||||
|
||||
|
|
@ -127,8 +121,7 @@ public:
|
|||
*/
|
||||
Comparison_result operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
const Point_2& CGAL_precondition_code(p)) const
|
||||
{
|
||||
const Point_2& CGAL_precondition_code(p)) const {
|
||||
Kernel kernel;
|
||||
|
||||
// The two segments must be defined at q and also to its left.
|
||||
|
|
@ -140,13 +133,13 @@ public:
|
|||
Compare_xy_2 compare_xy = kernel.compare_xy_2_object();
|
||||
typename Kernel::Construct_vertex_2 construct_vertex =
|
||||
kernel.construct_vertex_2_object();
|
||||
const Point_2 & source1 = construct_vertex(cv1, 0);
|
||||
const Point_2 & target1 = construct_vertex(cv1, 1);
|
||||
const Point_2 & left1 =
|
||||
const Point_2& source1 = construct_vertex(cv1, 0);
|
||||
const Point_2& target1 = construct_vertex(cv1, 1);
|
||||
const Point_2& left1 =
|
||||
(kernel.less_xy_2_object()(source1, target1)) ? source1 : target1;
|
||||
const Point_2 & source2 = construct_vertex(cv2, 0);
|
||||
const Point_2 & target2 = construct_vertex(cv2, 1);
|
||||
const Point_2 & left2 =
|
||||
const Point_2& source2 = construct_vertex(cv2, 0);
|
||||
const Point_2& target2 = construct_vertex(cv2, 1);
|
||||
const Point_2& left2 =
|
||||
(kernel.less_xy_2_object()(source2, target2)) ? source2 : target2;
|
||||
);
|
||||
|
||||
|
|
@ -181,10 +174,9 @@ public:
|
|||
* to the right of `p`: `SMALLER`, `LARGER`, or `EQUAL`.
|
||||
*/
|
||||
|
||||
Comparison_result operator()(const X_monotone_curve_2 & cv1,
|
||||
const X_monotone_curve_2 & cv2,
|
||||
const Point_2 & CGAL_precondition_code(p)) const
|
||||
{
|
||||
Comparison_result operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
const Point_2& CGAL_precondition_code(p)) const {
|
||||
Kernel kernel;
|
||||
|
||||
// The two segments must be defined at q and also to its right.
|
||||
|
|
@ -196,13 +188,13 @@ public:
|
|||
Compare_xy_2 compare_xy = kernel.compare_xy_2_object();
|
||||
typename Kernel::Construct_vertex_2 construct_vertex =
|
||||
kernel.construct_vertex_2_object();
|
||||
const Point_2 & source1 = construct_vertex(cv1, 0);
|
||||
const Point_2 & target1 = construct_vertex(cv1, 1);
|
||||
const Point_2 & right1 =
|
||||
const Point_2& source1 = construct_vertex(cv1, 0);
|
||||
const Point_2& target1 = construct_vertex(cv1, 1);
|
||||
const Point_2& right1 =
|
||||
(kernel.less_xy_2_object()(source1, target1)) ? target1 : source1;
|
||||
const Point_2 & source2 = construct_vertex(cv2, 0);
|
||||
const Point_2 & target2 = construct_vertex(cv2, 1);
|
||||
const Point_2 & right2 =
|
||||
const Point_2& source2 = construct_vertex(cv2, 0);
|
||||
const Point_2& target2 = construct_vertex(cv2, 1);
|
||||
const Point_2& right2 =
|
||||
(kernel.less_xy_2_object()(source2, target2)) ? target2 : source2;
|
||||
);
|
||||
|
||||
|
|
@ -222,9 +214,9 @@ public:
|
|||
|
||||
/// \name Functor definitions for the landmarks point-location strategy.
|
||||
//@{
|
||||
typedef double Approximate_number_type;
|
||||
typedef CGAL::Cartesian<Approximate_number_type> Approximate_kernel;
|
||||
typedef Approximate_kernel::Point_2 Approximate_point_2;
|
||||
using Approximate_number_type = double;
|
||||
using Approximate_kernel = CGAL::Simple_cartesian<Approximate_number_type>;
|
||||
using Approximate_point_2 = Approximate_kernel::Point_2;
|
||||
|
||||
class Approximate_2 {
|
||||
protected:
|
||||
|
|
@ -280,7 +272,7 @@ public:
|
|||
/*! obtains an Approximate_2 functor object. */
|
||||
Approximate_2 approximate_2_object () const { return Approximate_2(*this); }
|
||||
|
||||
typedef typename Kernel::Construct_segment_2 Construct_x_monotone_curve_2;
|
||||
using Construct_x_monotone_curve_2 = typename Kernel::Construct_segment_2;
|
||||
|
||||
/*! obtains a `Construct_x_monotone_curve_2` functor object. */
|
||||
Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object () const
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include <variant>
|
||||
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/tags.h>
|
||||
#include <CGAL/intersections.h>
|
||||
#include <CGAL/Arr_tags.h>
|
||||
|
|
@ -52,35 +52,32 @@ class Arr_segment_2;
|
|||
template <typename Kernel_ = Exact_predicates_exact_constructions_kernel>
|
||||
class Arr_segment_traits_2 : public Kernel_ {
|
||||
friend class Arr_segment_2<Kernel_>;
|
||||
|
||||
public:
|
||||
typedef Kernel_ Kernel;
|
||||
typedef typename Kernel::FT FT;
|
||||
using Kernel = Kernel_;
|
||||
using FT = typename Kernel::FT;
|
||||
|
||||
typedef typename Algebraic_structure_traits<FT>::Is_exact
|
||||
Has_exact_division;
|
||||
using Has_exact_division = typename Algebraic_structure_traits<FT>::Is_exact;
|
||||
|
||||
// Category tags:
|
||||
typedef Tag_true Has_left_category;
|
||||
typedef Tag_true Has_merge_category;
|
||||
typedef Tag_false Has_do_intersect_category;
|
||||
using Has_left_category = Tag_true;
|
||||
using Has_merge_category = Tag_true;
|
||||
using Has_do_intersect_category = Tag_false;
|
||||
|
||||
typedef Arr_oblivious_side_tag Left_side_category;
|
||||
typedef Arr_oblivious_side_tag Bottom_side_category;
|
||||
typedef Arr_oblivious_side_tag Top_side_category;
|
||||
typedef Arr_oblivious_side_tag Right_side_category;
|
||||
using Left_side_category = Arr_oblivious_side_tag;
|
||||
using Bottom_side_category = Arr_oblivious_side_tag;
|
||||
using Top_side_category = Arr_oblivious_side_tag;
|
||||
using Right_side_category = Arr_oblivious_side_tag;
|
||||
|
||||
typedef typename Kernel::Line_2 Line_2;
|
||||
typedef CGAL::Segment_assertions<Arr_segment_traits_2<Kernel> >
|
||||
Segment_assertions;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
using Segment_assertions = CGAL::Segment_assertions<Arr_segment_traits_2<Kernel>>;
|
||||
|
||||
/*! \class Representation of a segment with cached data.
|
||||
*/
|
||||
class _Segment_cached_2 {
|
||||
public:
|
||||
typedef typename Kernel::Line_2 Line_2;
|
||||
typedef typename Kernel::Segment_2 Segment_2;
|
||||
typedef typename Kernel::Point_2 Point_2;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
using Segment_2 = typename Kernel::Segment_2;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
|
||||
protected:
|
||||
mutable Line_2 m_l; // the line that supports the segment.
|
||||
|
|
@ -228,10 +225,10 @@ public:
|
|||
|
||||
public:
|
||||
// Traits objects
|
||||
typedef typename Kernel::Point_2 Point_2;
|
||||
typedef Arr_segment_2<Kernel> X_monotone_curve_2;
|
||||
typedef Arr_segment_2<Kernel> Curve_2;
|
||||
typedef unsigned int Multiplicity;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
using X_monotone_curve_2 = Arr_segment_2<Kernel>;
|
||||
using Curve_2 = Arr_segment_2<Kernel>;
|
||||
using Multiplicity = std::size_t;
|
||||
|
||||
public:
|
||||
/*! constructs default. */
|
||||
|
|
@ -242,7 +239,7 @@ public:
|
|||
|
||||
class Compare_x_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
//! The traits (in case it has state).
|
||||
const Traits& m_traits;
|
||||
|
|
@ -262,8 +259,7 @@ public:
|
|||
* `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 {
|
||||
const Kernel& kernel = m_traits;
|
||||
return (kernel.compare_x_2_object()(p1, p2));
|
||||
}
|
||||
|
|
@ -274,7 +270,7 @@ public:
|
|||
|
||||
class Compare_xy_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -294,8 +290,7 @@ public:
|
|||
* 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 {
|
||||
const Kernel& kernel = m_traits;
|
||||
return (kernel.compare_xy_2_object()(p1, p2));
|
||||
}
|
||||
|
|
@ -347,7 +342,7 @@ public:
|
|||
|
||||
class Compare_y_at_x_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -369,8 +364,7 @@ public:
|
|||
* `EQUAL` if `p` lies on the curve.
|
||||
*/
|
||||
Comparison_result operator()(const Point_2& p,
|
||||
const X_monotone_curve_2& cv) const
|
||||
{
|
||||
const X_monotone_curve_2& cv) const {
|
||||
CGAL_precondition(m_traits.is_in_x_range_2_object()(cv, p));
|
||||
|
||||
const Kernel& kernel = m_traits;
|
||||
|
|
@ -396,7 +390,7 @@ public:
|
|||
|
||||
class Compare_y_at_x_left_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -421,8 +415,7 @@ public:
|
|||
*/
|
||||
Comparison_result operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
const Point_2& CGAL_assertion_code(p)) const
|
||||
{
|
||||
const Point_2& CGAL_assertion_code(p)) const {
|
||||
const Kernel& kernel = m_traits;
|
||||
|
||||
// Make sure that p lies on both curves, and that both are defined to its
|
||||
|
|
@ -450,7 +443,7 @@ public:
|
|||
|
||||
class Compare_y_at_x_right_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -475,8 +468,7 @@ public:
|
|||
*/
|
||||
Comparison_result operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
const Point_2& CGAL_assertion_code(p)) const
|
||||
{
|
||||
const Point_2& CGAL_assertion_code(p)) const {
|
||||
const Kernel& kernel = m_traits;
|
||||
|
||||
// Make sure that p lies on both curves, and that both are defined to its
|
||||
|
|
@ -502,7 +494,7 @@ public:
|
|||
|
||||
class Equal_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -522,8 +514,7 @@ public:
|
|||
* \return (true) if the two curves are the same; (false) otherwise.
|
||||
*/
|
||||
bool operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2) const
|
||||
{
|
||||
const X_monotone_curve_2& cv2) const {
|
||||
const Kernel& kernel = m_traits;
|
||||
typename Kernel::Equal_2 equal = kernel.equal_2_object();
|
||||
|
||||
|
|
@ -536,8 +527,7 @@ public:
|
|||
* \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
|
||||
{
|
||||
bool operator()(const Point_2& p1, const Point_2& p2) const {
|
||||
const Kernel& kernel = m_traits;
|
||||
return (kernel.equal_2_object()(p1, p2));
|
||||
}
|
||||
|
|
@ -566,11 +556,9 @@ public:
|
|||
* \return the past-the-end output iterator.
|
||||
*/
|
||||
template <typename OutputIterator>
|
||||
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const
|
||||
{
|
||||
OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const {
|
||||
// Wrap the segment with a variant.
|
||||
typedef std::variant<Point_2, X_monotone_curve_2>
|
||||
Make_x_monotone_result;
|
||||
using Make_x_monotone_result = std::variant<Point_2, X_monotone_curve_2>;
|
||||
*oi++ = Make_x_monotone_result(cv);
|
||||
return oi;
|
||||
}
|
||||
|
|
@ -582,7 +570,7 @@ public:
|
|||
|
||||
class Split_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -595,7 +583,7 @@ public:
|
|||
friend class Arr_segment_traits_2<Kernel>;
|
||||
|
||||
public:
|
||||
/*! split a given \f$x\f$-monotone curve at a given point into two
|
||||
/*! splits a given \f$x\f$-monotone curve at a given point into two
|
||||
* sub-curves.
|
||||
* \param cv the curve to split
|
||||
* \param p the split point.
|
||||
|
|
@ -604,8 +592,7 @@ public:
|
|||
* \pre `p` lies on cv but is not one of its endpoints.
|
||||
*/
|
||||
void operator()(const X_monotone_curve_2& cv, const Point_2& p,
|
||||
X_monotone_curve_2& c1, X_monotone_curve_2& c2) const
|
||||
{
|
||||
X_monotone_curve_2& c1, X_monotone_curve_2& c2) const {
|
||||
// Make sure that p lies on the interior of the curve.
|
||||
CGAL_precondition_code(const Kernel& kernel = m_traits;
|
||||
auto compare_xy = kernel.compare_xy_2_object());
|
||||
|
|
@ -628,7 +615,7 @@ public:
|
|||
|
||||
class Intersect_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -644,8 +631,7 @@ public:
|
|||
// this point, we already know which point is left / right for
|
||||
// both segments
|
||||
bool do_intersect(const Point_2& A1, const Point_2& A2,
|
||||
const Point_2& B1, const Point_2& B2) const
|
||||
{
|
||||
const Point_2& B1, const Point_2& B2) const {
|
||||
const Kernel& kernel = m_traits;
|
||||
auto compare_xy = kernel.compare_xy_2_object();
|
||||
namespace interx = CGAL::Intersections::internal;
|
||||
|
|
@ -686,8 +672,7 @@ public:
|
|||
/*! determines whether the bounding boxes of two segments overlap
|
||||
*/
|
||||
bool do_bboxes_overlap(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2) const
|
||||
{
|
||||
const X_monotone_curve_2& cv2) const {
|
||||
const Kernel& kernel = m_traits;
|
||||
auto construct_bbox = kernel.construct_bbox_2_object();
|
||||
auto bbox1 = construct_bbox(cv1.source()) + construct_bbox(cv1.target());
|
||||
|
|
@ -707,9 +692,8 @@ public:
|
|||
template <typename OutputIterator>
|
||||
OutputIterator operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
OutputIterator oi) const
|
||||
{
|
||||
typedef std::pair<Point_2, Multiplicity> Intersection_point;
|
||||
OutputIterator oi) const {
|
||||
using Intersection_point = std::pair<Point_2, Multiplicity>;
|
||||
|
||||
// Early ending with Bbox overlapping test
|
||||
if (! do_bboxes_overlap(cv1, cv2)) return oi;
|
||||
|
|
@ -787,7 +771,7 @@ public:
|
|||
|
||||
class Are_mergeable_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -808,8 +792,7 @@ public:
|
|||
* \pre `cv1` and `cv2` share a common endpoint.
|
||||
*/
|
||||
bool operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2) const
|
||||
{
|
||||
const X_monotone_curve_2& cv2) const {
|
||||
const Kernel& kernel = m_traits;
|
||||
typename Kernel::Equal_2 equal = kernel.equal_2_object();
|
||||
if (! equal(cv1.right(), cv2.left()) &&
|
||||
|
|
@ -832,7 +815,7 @@ public:
|
|||
*/
|
||||
class Merge_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state) */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -853,14 +836,13 @@ public:
|
|||
*/
|
||||
void operator()(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
X_monotone_curve_2& c) const
|
||||
{
|
||||
X_monotone_curve_2& c) const {
|
||||
CGAL_precondition(m_traits.are_mergeable_2_object()(cv1, cv2));
|
||||
|
||||
const Kernel& kernel = m_traits;
|
||||
auto equal = kernel.equal_2_object();
|
||||
|
||||
// Check which curve extends to the right of the other.
|
||||
// checks which curve extends to the right of the other.
|
||||
if (equal(cv1.right(), cv2.left())) {
|
||||
// cv2 extends cv1 to the right.
|
||||
c = cv1;
|
||||
|
|
@ -882,9 +864,9 @@ public:
|
|||
|
||||
/// \name Functor definitions for the landmarks point-location strategy.
|
||||
//@{
|
||||
typedef double Approximate_number_type;
|
||||
typedef CGAL::Cartesian<Approximate_number_type> Approximate_kernel;
|
||||
typedef Approximate_kernel::Point_2 Approximate_point_2;
|
||||
using Approximate_number_type = double;
|
||||
using Approximate_kernel = CGAL::Simple_cartesian<Approximate_number_type>;
|
||||
using Approximate_point_2 = Approximate_kernel::Point_2;
|
||||
|
||||
class Approximate_2 {
|
||||
protected:
|
||||
|
|
@ -943,7 +925,7 @@ public:
|
|||
//! Functor
|
||||
class Construct_x_monotone_curve_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
//! The traits (in case it has state).
|
||||
const Traits& m_traits;
|
||||
|
|
@ -956,7 +938,7 @@ public:
|
|||
friend class Arr_segment_traits_2<Kernel>;
|
||||
|
||||
public:
|
||||
typedef typename Kernel::Segment_2 Segment_2;
|
||||
using Segment_2 = typename Kernel::Segment_2;
|
||||
|
||||
/*! obtains an \f$x\f$-monotone curve connecting two given endpoints.
|
||||
* \param source the first point.
|
||||
|
|
@ -965,8 +947,7 @@ public:
|
|||
* \return a segment connecting `source` and `target`.
|
||||
*/
|
||||
X_monotone_curve_2 operator()(const Point_2& source,
|
||||
const Point_2& target) const
|
||||
{
|
||||
const Point_2& target) const {
|
||||
const Kernel& kernel = m_traits;
|
||||
auto line = kernel.construct_line_2_object()(source, target);
|
||||
Comparison_result res = kernel.compare_xy_2_object()(source, target);
|
||||
|
|
@ -985,8 +966,7 @@ public:
|
|||
* \pre the segment is not degenerate.
|
||||
* \return a segment that is the same as `seg`..
|
||||
*/
|
||||
X_monotone_curve_2 operator()(const Segment_2& seg) const
|
||||
{
|
||||
X_monotone_curve_2 operator()(const Segment_2& seg) const {
|
||||
const Kernel& kernel = m_traits;
|
||||
auto line = kernel.construct_line_2_object()(seg);
|
||||
auto vertex_ctr = kernel.construct_vertex_2_object();
|
||||
|
|
@ -1011,8 +991,7 @@ public:
|
|||
*/
|
||||
X_monotone_curve_2 operator()(const Line_2& line,
|
||||
const Point_2& source,
|
||||
const Point_2& target) const
|
||||
{
|
||||
const Point_2& target) const {
|
||||
const Kernel& kernel = m_traits;
|
||||
CGAL_precondition
|
||||
(Segment_assertions::_assert_is_point_on(source, line,
|
||||
|
|
@ -1039,7 +1018,7 @@ public:
|
|||
//@{
|
||||
|
||||
//! Functor
|
||||
typedef Construct_x_monotone_curve_2 Construct_curve_2;
|
||||
using Construct_curve_2 = Construct_x_monotone_curve_2;
|
||||
|
||||
/*! obtains a `Construct_curve_2` functor object. */
|
||||
Construct_curve_2 construct_curve_2_object() const
|
||||
|
|
@ -1051,7 +1030,7 @@ public:
|
|||
|
||||
class Trim_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
/*! The traits (in case it has state). */
|
||||
const Traits& m_traits;
|
||||
|
|
@ -1074,8 +1053,7 @@ public:
|
|||
public:
|
||||
X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv,
|
||||
const Point_2& src,
|
||||
const Point_2& tgt)const
|
||||
{
|
||||
const Point_2& tgt) const {
|
||||
CGAL_precondition_code(Equal_2 equal = m_traits.equal_2_object());
|
||||
CGAL_precondition_code(Compare_y_at_x_2 compare_y_at_x =
|
||||
m_traits.compare_y_at_x_2_object());
|
||||
|
|
@ -1119,7 +1097,7 @@ public:
|
|||
|
||||
class Construct_opposite_2 {
|
||||
public:
|
||||
/*! Construct an opposite \f$x\f$-monotone (with swapped source and target).
|
||||
/*! constructs an opposite \f$x\f$-monotone (with swapped source and target).
|
||||
* \param cv the curve.
|
||||
* \return the opposite curve.
|
||||
*/
|
||||
|
|
@ -1137,12 +1115,12 @@ public:
|
|||
|
||||
class Is_in_x_range_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
//! The traits (in case it has state).
|
||||
const Traits& m_traits;
|
||||
|
||||
/*! Construct
|
||||
/*! constructs
|
||||
* \param traits the traits (in case it has state)
|
||||
*/
|
||||
Is_in_x_range_2(const Traits& traits) : m_traits(traits) {}
|
||||
|
|
@ -1156,8 +1134,7 @@ public:
|
|||
* \param p the point.
|
||||
* \return true if p is in the \f$x\f$-range of cv; false otherwise.
|
||||
*/
|
||||
bool operator()(const X_monotone_curve_2& cv, const Point_2& p) const
|
||||
{
|
||||
bool operator()(const X_monotone_curve_2& cv, const Point_2& p) const {
|
||||
const Kernel& kernel = m_traits;
|
||||
auto compare_x = kernel.compare_x_2_object();
|
||||
Comparison_result res1 = compare_x(p, cv.left());
|
||||
|
|
@ -1176,7 +1153,7 @@ public:
|
|||
|
||||
class Is_in_y_range_2 {
|
||||
protected:
|
||||
typedef Arr_segment_traits_2<Kernel> Traits;
|
||||
using Traits = Arr_segment_traits_2<Kernel>;
|
||||
|
||||
//! The traits (in case it has state).
|
||||
const Traits& m_traits;
|
||||
|
|
@ -1195,8 +1172,7 @@ public:
|
|||
* \param p the point.
|
||||
* \return true if p is in the \f$y\f$-range of cv; false otherwise.
|
||||
*/
|
||||
bool operator()(const X_monotone_curve_2& cv, const Point_2& p) const
|
||||
{
|
||||
bool operator()(const X_monotone_curve_2& cv, const Point_2& p) const {
|
||||
const Kernel& kernel = m_traits;
|
||||
auto compare_y = kernel.compare_y_2_object();
|
||||
Comparison_result res1 = compare_y(p, cv.left());
|
||||
|
|
@ -1232,8 +1208,7 @@ template <typename Kernel>
|
|||
Arr_segment_traits_2<Kernel>::
|
||||
_Segment_cached_2::_Segment_cached_2(const Segment_2& seg) :
|
||||
m_is_vert(false),
|
||||
m_is_computed(false)
|
||||
{
|
||||
m_is_computed(false) {
|
||||
Kernel kernel;
|
||||
auto vertex_ctr = kernel.construct_vertex_2_object();
|
||||
|
||||
|
|
@ -1255,8 +1230,7 @@ _Segment_cached_2::_Segment_cached_2(const Point_2& source,
|
|||
m_ps(source),
|
||||
m_pt(target),
|
||||
m_is_vert(false),
|
||||
m_is_computed(false)
|
||||
{
|
||||
m_is_computed(false) {
|
||||
Kernel kernel;
|
||||
|
||||
Comparison_result res = kernel.compare_xy_2_object()(m_ps, m_pt);
|
||||
|
|
@ -1274,8 +1248,7 @@ _Segment_cached_2::_Segment_cached_2(const Line_2& line,
|
|||
const Point_2& target) :
|
||||
m_l(line),
|
||||
m_ps(source),
|
||||
m_pt(target)
|
||||
{
|
||||
m_pt(target) {
|
||||
Kernel kernel;
|
||||
|
||||
CGAL_precondition
|
||||
|
|
@ -1312,8 +1285,7 @@ _Segment_cached_2(const Line_2& line,
|
|||
//! \brief assigns.
|
||||
template <typename Kernel>
|
||||
const typename Arr_segment_traits_2<Kernel>::_Segment_cached_2&
|
||||
Arr_segment_traits_2<Kernel>::_Segment_cached_2::operator=(const Segment_2& seg)
|
||||
{
|
||||
Arr_segment_traits_2<Kernel>::_Segment_cached_2::operator=(const Segment_2& seg) {
|
||||
Kernel kernel;
|
||||
auto vertex_ctr = kernel.construct_vertex_2_object();
|
||||
|
||||
|
|
@ -1338,8 +1310,7 @@ Arr_segment_traits_2<Kernel>::_Segment_cached_2::operator=(const Segment_2& seg)
|
|||
//! \brief obtains the supporting line.
|
||||
template <typename Kernel>
|
||||
const typename Kernel::Line_2&
|
||||
Arr_segment_traits_2<Kernel>::_Segment_cached_2::line() const
|
||||
{
|
||||
Arr_segment_traits_2<Kernel>::_Segment_cached_2::line() const {
|
||||
if (!m_is_computed) {
|
||||
Kernel kernel;
|
||||
m_l = kernel.construct_line_2_object()(m_ps, m_pt);
|
||||
|
|
@ -1351,8 +1322,7 @@ Arr_segment_traits_2<Kernel>::_Segment_cached_2::line() const
|
|||
|
||||
//! \brief determines whether the curve is vertical.
|
||||
template <typename Kernel>
|
||||
bool Arr_segment_traits_2<Kernel>::_Segment_cached_2::is_vertical() const
|
||||
{
|
||||
bool Arr_segment_traits_2<Kernel>::_Segment_cached_2::is_vertical() const {
|
||||
// Force computation of line is orientation is still unknown
|
||||
if (! m_is_computed) line();
|
||||
CGAL_precondition(!m_is_degen);
|
||||
|
|
@ -1397,8 +1367,7 @@ Arr_segment_traits_2<Kernel>::_Segment_cached_2::right() const
|
|||
|
||||
//! \brief sets the (lexicographically) left endpoint.
|
||||
template <typename Kernel>
|
||||
void Arr_segment_traits_2<Kernel>::_Segment_cached_2::set_left(const Point_2& p)
|
||||
{
|
||||
void Arr_segment_traits_2<Kernel>::_Segment_cached_2::set_left(const Point_2& p) {
|
||||
CGAL_precondition(! m_is_degen);
|
||||
CGAL_precondition_code(Kernel kernel);
|
||||
CGAL_precondition
|
||||
|
|
@ -1411,8 +1380,7 @@ void Arr_segment_traits_2<Kernel>::_Segment_cached_2::set_left(const Point_2& p)
|
|||
|
||||
//! \brief sets the (lexicographically) right endpoint.
|
||||
template <typename Kernel>
|
||||
void Arr_segment_traits_2<Kernel>::_Segment_cached_2::set_right(const Point_2& p)
|
||||
{
|
||||
void Arr_segment_traits_2<Kernel>::_Segment_cached_2::set_right(const Point_2& p) {
|
||||
CGAL_precondition(! m_is_degen);
|
||||
CGAL_precondition_code(Kernel kernel);
|
||||
CGAL_precondition
|
||||
|
|
@ -1428,8 +1396,7 @@ void Arr_segment_traits_2<Kernel>::_Segment_cached_2::set_right(const Point_2& p
|
|||
*/
|
||||
template <typename Kernel>
|
||||
bool Arr_segment_traits_2<Kernel>::_Segment_cached_2::
|
||||
is_in_x_range(const Point_2& p) const
|
||||
{
|
||||
is_in_x_range(const Point_2& p) const {
|
||||
Kernel kernel;
|
||||
typename Kernel::Compare_x_2 compare_x = kernel.compare_x_2_object();
|
||||
const Comparison_result res1 = compare_x(p, left());
|
||||
|
|
@ -1446,8 +1413,7 @@ is_in_x_range(const Point_2& p) const
|
|||
*/
|
||||
template <typename Kernel>
|
||||
bool Arr_segment_traits_2<Kernel>::_Segment_cached_2::
|
||||
is_in_y_range(const Point_2& p) const
|
||||
{
|
||||
is_in_y_range(const Point_2& p) const {
|
||||
Kernel kernel;
|
||||
typename Kernel::Compare_y_2 compare_y = kernel.compare_y_2_object();
|
||||
const Comparison_result res1 = compare_y(p, left());
|
||||
|
|
@ -1464,31 +1430,31 @@ is_in_y_range(const Point_2& p) const
|
|||
*/
|
||||
template <typename Kernel_>
|
||||
class Arr_segment_2 : public Arr_segment_traits_2<Kernel_>::_Segment_cached_2 {
|
||||
typedef Kernel_ Kernel;
|
||||
using Kernel = Kernel_;
|
||||
|
||||
typedef typename Arr_segment_traits_2<Kernel>::_Segment_cached_2 Base;
|
||||
typedef typename Kernel::Segment_2 Segment_2;
|
||||
typedef typename Kernel::Point_2 Point_2;
|
||||
typedef typename Kernel::Line_2 Line_2;
|
||||
using Base = typename Arr_segment_traits_2<Kernel>::_Segment_cached_2;
|
||||
using Segment_2 = typename Kernel::Segment_2;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
|
||||
public:
|
||||
/*! Construct default. */
|
||||
/*! constructs default. */
|
||||
Arr_segment_2();
|
||||
|
||||
/*! Construct a segment from a "kernel" segment.
|
||||
/*! constructs a segment from a "kernel" segment.
|
||||
* \param seg the segment.
|
||||
* \pre the segment is not degenerate.
|
||||
*/
|
||||
Arr_segment_2(const Segment_2& seg);
|
||||
|
||||
/*! Construct a segment from two endpoints.
|
||||
/*! constructs a segment from two endpoints.
|
||||
* \param source the source point.
|
||||
* \param target the target point.
|
||||
* \pre `source` and `target` are not equal.
|
||||
*/
|
||||
Arr_segment_2(const Point_2& source, const Point_2& target);
|
||||
|
||||
/*! Construct a segment from a line and two endpoints.
|
||||
/*! constructs a segment from a line and two endpoints.
|
||||
* \param line the supporting line.
|
||||
* \param source the source point.
|
||||
* \param target the target point.
|
||||
|
|
@ -1498,7 +1464,7 @@ public:
|
|||
Arr_segment_2(const Line_2& line,
|
||||
const Point_2& source, const Point_2& target);
|
||||
|
||||
/*! Construct a segment from all fields.
|
||||
/*! constructs a segment from all fields.
|
||||
* \param line the supporting line.
|
||||
* \param source the source point.
|
||||
* \param target the target point.
|
||||
|
|
@ -1510,11 +1476,11 @@ public:
|
|||
const Point_2& source, const Point_2& target,
|
||||
bool is_directed_right, bool is_vert, bool is_degen);
|
||||
|
||||
/*! Cast to a segment.
|
||||
/*! casts to a segment.
|
||||
*/
|
||||
operator Segment_2() const;
|
||||
|
||||
/*! Flip the segment (swap its source and target).
|
||||
/*! flips the segment (swap its source and target).
|
||||
*/
|
||||
Arr_segment_2 flip() const;
|
||||
|
||||
|
|
@ -1558,8 +1524,7 @@ Arr_segment_2<Kernel>::Arr_segment_2(const Line_2& line,
|
|||
|
||||
//! \brief casts to a segment.
|
||||
template <typename Kernel>
|
||||
Arr_segment_2<Kernel>::operator typename Kernel::Segment_2() const
|
||||
{
|
||||
Arr_segment_2<Kernel>::operator typename Kernel::Segment_2() const {
|
||||
Kernel kernel;
|
||||
auto seg_ctr = kernel.construct_segment_2_object();
|
||||
return seg_ctr(this->source(), this->target());
|
||||
|
|
@ -1567,8 +1532,7 @@ Arr_segment_2<Kernel>::operator typename Kernel::Segment_2() const
|
|||
|
||||
//! \brief flips the segment (swap its source and target).
|
||||
template <typename Kernel>
|
||||
Arr_segment_2<Kernel> Arr_segment_2<Kernel>::flip() const
|
||||
{
|
||||
Arr_segment_2<Kernel> Arr_segment_2<Kernel>::flip() const {
|
||||
return Arr_segment_2(this->line(), this->target(), this->source(),
|
||||
! (this->is_directed_right()), this->is_vertical(),
|
||||
this->is_degenerate());
|
||||
|
|
@ -1586,8 +1550,7 @@ Bbox_2 Arr_segment_2<Kernel>::bbox() const
|
|||
/*! Exporter for the segment class used by the traits-class.
|
||||
*/
|
||||
template <typename Kernel, typename OutputStream>
|
||||
OutputStream& operator<<(OutputStream& os, const Arr_segment_2<Kernel>& seg)
|
||||
{
|
||||
OutputStream& operator<<(OutputStream& os, const Arr_segment_2<Kernel>& seg) {
|
||||
os << static_cast<typename Kernel::Segment_2>(seg);
|
||||
return (os);
|
||||
}
|
||||
|
|
@ -1595,8 +1558,7 @@ OutputStream& operator<<(OutputStream& os, const Arr_segment_2<Kernel>& seg)
|
|||
/*! Importer for the segment class used by the traits-class.
|
||||
*/
|
||||
template <typename Kernel, typename InputStream>
|
||||
InputStream& operator>>(InputStream& is, Arr_segment_2<Kernel>& seg)
|
||||
{
|
||||
InputStream& operator>>(InputStream& is, Arr_segment_2<Kernel>& seg) {
|
||||
typename Kernel::Segment_2 kernel_seg;
|
||||
is >> kernel_seg;
|
||||
seg = kernel_seg;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue