mirror of https://github.com/CGAL/cgal
commit
727824eda6
|
|
@ -90,6 +90,7 @@ int main ()
|
|||
case BLUE : std::cout << "BLUE." << std::endl; break;
|
||||
case RED : std::cout << "RED." << std::endl; break;
|
||||
case WHITE : std::cout << "WHITE." << std::endl; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
/*! \class
|
||||
/*! \class
|
||||
* A model of the ArrangementTraits_2 concept that counts the methods invoked.
|
||||
*/
|
||||
template <class Base_traits>
|
||||
|
|
@ -88,7 +88,7 @@ public:
|
|||
COMPARE_X_ON_BOUNDARY_POINT_CURVE_END_OP,
|
||||
COMPARE_X_ON_BOUNDARY_CURVE_ENDS_OP,
|
||||
COMPARE_X_NEAR_BOUNDARY_OP,
|
||||
|
||||
|
||||
NUMBER_OF_OPERATIONS
|
||||
};
|
||||
|
||||
|
|
@ -103,69 +103,69 @@ public:
|
|||
}
|
||||
|
||||
/*! Construct copy */
|
||||
Arr_counting_traits_2(Arr_counting_traits_2& other) : Base(other)
|
||||
Arr_counting_traits_2(const Arr_counting_traits_2& other) : Base(other)
|
||||
{
|
||||
clear_counters();
|
||||
increment();
|
||||
}
|
||||
|
||||
|
||||
/*! Obtain the counter of the given operation */
|
||||
unsigned int count(Operation_id id) const
|
||||
{ return m_counters[id]; }
|
||||
|
||||
unsigned int count_compare_x() const
|
||||
{ return m_counters[COMPARE_X_OP]; }
|
||||
|
||||
|
||||
unsigned int count_compare_xy() const
|
||||
{ return m_counters[COMPARE_XY_OP]; }
|
||||
|
||||
unsigned int count_construct_min_vertex() const
|
||||
{ return m_counters[CONSTRUCT_MIN_VERTEX_OP]; }
|
||||
|
||||
|
||||
unsigned int count_construct_max_vertex() const
|
||||
{ return m_counters[CONSTRUCT_MAX_VERTEX_OP]; }
|
||||
|
||||
unsigned int count_is_vertical() const
|
||||
{ return m_counters[IS_VERTICAL_OP]; }
|
||||
|
||||
|
||||
unsigned int count_compare_y_at_x() const
|
||||
{ return m_counters[COMPARE_Y_AT_X_OP]; }
|
||||
|
||||
|
||||
unsigned int count_equal_points() const
|
||||
{ return m_counters[EQUAL_POINTS_OP]; }
|
||||
|
||||
|
||||
unsigned int count_equal_curves() const
|
||||
{ return m_counters[EQUAL_CURVES_OP]; }
|
||||
|
||||
|
||||
unsigned int count_compare_y_at_x_left() const
|
||||
{ return m_counters[COMPARE_Y_AT_X_LEFT_OP]; }
|
||||
|
||||
|
||||
unsigned int count_compare_y_at_x_right() const
|
||||
{ return m_counters[COMPARE_Y_AT_X_RIGHT_OP]; }
|
||||
|
||||
|
||||
unsigned int count_make_x_monotone() const
|
||||
{ return m_counters[MAKE_X_MONOTONE_OP]; }
|
||||
|
||||
|
||||
unsigned int count_split() const
|
||||
{ return m_counters[SPLIT_OP]; }
|
||||
|
||||
|
||||
unsigned int count_intersect() const
|
||||
{ return m_counters[INTERSECT_OP]; }
|
||||
|
||||
|
||||
unsigned int count_are_mergeable() const
|
||||
{ return m_counters[ARE_MERGEABLE_OP]; }
|
||||
|
||||
|
||||
unsigned int count_merge() const
|
||||
{ return m_counters[MERGE_OP]; }
|
||||
|
||||
|
||||
unsigned int count_construct_opposite() const
|
||||
{ return m_counters[CONSTRUCT_OPPOSITE_OP]; }
|
||||
|
||||
|
||||
unsigned int count_compare_endpoints_xy() const
|
||||
{ return m_counters[COMPARE_ENDPOINTS_XY_OP]; }
|
||||
|
||||
// left-right
|
||||
|
||||
|
||||
unsigned int count_parameter_space_in_x_curve_end() const
|
||||
{ return m_counters[PARAMETER_SPACE_IN_X_CURVE_END_OP]; }
|
||||
|
||||
|
|
@ -174,7 +174,7 @@ public:
|
|||
|
||||
unsigned int count_parameter_space_in_x_point() const
|
||||
{ return m_counters[PARAMETER_SPACE_IN_X_POINT_OP]; }
|
||||
|
||||
|
||||
unsigned int count_is_on_x_identification_point() const
|
||||
{ return m_counters[IS_ON_X_IDENTIFICATION_POINT_OP]; }
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ public:
|
|||
Top_side_category;
|
||||
typedef typename internal::Arr_complete_right_side_category< Base >::Category
|
||||
Right_side_category;
|
||||
|
||||
|
||||
typedef typename Base::Point_2 Point_2;
|
||||
typedef typename Base::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Base::Curve_2 Curve_2;
|
||||
|
|
@ -310,7 +310,7 @@ public:
|
|||
const Point_2 operator()(const X_monotone_curve_2& xc) const
|
||||
{ ++m_counter; return m_object(xc); }
|
||||
};
|
||||
|
||||
|
||||
/*! A functor that checks whether a given x-monotone curve is vertical. */
|
||||
class Is_vertical_2 {
|
||||
private:
|
||||
|
|
@ -326,7 +326,7 @@ public:
|
|||
bool operator()(const X_monotone_curve_2& xc) const
|
||||
{ ++m_counter; return m_object(xc); }
|
||||
};
|
||||
|
||||
|
||||
/*! A functor that compares the y-coordinates of a point and an
|
||||
* x-monotone curve at the point x-coordinate.
|
||||
*/
|
||||
|
|
@ -345,7 +345,7 @@ public:
|
|||
const X_monotone_curve_2& xc) const
|
||||
{ ++m_counter; return m_object(p, xc); }
|
||||
};
|
||||
|
||||
|
||||
/*! A functor that checks whether two points and two x-monotone curves are
|
||||
* identical.
|
||||
*/
|
||||
|
|
@ -369,7 +369,7 @@ public:
|
|||
|
||||
/*! Operate */
|
||||
bool operator()(const Point_2& p1, const Point_2& p2) const
|
||||
{ ++m_counter2; return m_object(p1, p2); }
|
||||
{ ++m_counter2; return m_object(p1, p2); }
|
||||
};
|
||||
|
||||
/*! A functor that compares compares the y-coordinates of two x-monotone
|
||||
|
|
@ -411,7 +411,7 @@ public:
|
|||
const Point_2& p) const
|
||||
{ ++m_counter; return m_object(xc1, xc2, p); }
|
||||
};
|
||||
|
||||
|
||||
/*! A functor that divides a curve into x-monotone curves. */
|
||||
class Make_x_monotone_2 {
|
||||
private:
|
||||
|
|
@ -550,7 +550,7 @@ public:
|
|||
/*! Construct */
|
||||
Parameter_space_in_x_2(const Base* base, unsigned int& counter1,
|
||||
unsigned int& counter2, unsigned int& counter3) :
|
||||
m_object(base->parameter_space_in_x_2_object()),
|
||||
m_object(base->parameter_space_in_x_2_object()),
|
||||
m_counter1(counter1),
|
||||
m_counter2(counter2),
|
||||
m_counter3(counter3) {}
|
||||
|
|
@ -583,9 +583,9 @@ public:
|
|||
|
||||
public:
|
||||
/*! Construct */
|
||||
Is_on_x_identification_2(const Base* base,
|
||||
Is_on_x_identification_2(const Base* base,
|
||||
unsigned int& counter1, unsigned int& counter2) :
|
||||
m_object(base->is_on_x_identificiation_2_object()),
|
||||
m_object(base->is_on_x_identificiation_2_object()),
|
||||
m_counter1(counter1),
|
||||
m_counter2(counter2) {}
|
||||
|
||||
|
|
@ -619,7 +619,7 @@ public:
|
|||
Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
|
||||
{ ++m_counter; return m_object(p1, p2); }
|
||||
};
|
||||
|
||||
|
||||
/*! A functor that compares the y-coordinates of curve ends near the
|
||||
* boundary of the parameter space.
|
||||
*/
|
||||
|
|
@ -635,7 +635,7 @@ public:
|
|||
|
||||
/*! Operate */
|
||||
Comparison_result operator()(const X_monotone_curve_2& xc1,
|
||||
const X_monotone_curve_2& xc2,
|
||||
const X_monotone_curve_2& xc2,
|
||||
Arr_curve_end ce) const
|
||||
{ ++m_counter; return m_object(xc1, xc2, ce); }
|
||||
};
|
||||
|
|
@ -656,7 +656,7 @@ public:
|
|||
/*! Construct */
|
||||
Parameter_space_in_y_2(const Base* base, unsigned int& counter1,
|
||||
unsigned int& counter2, unsigned int& counter3) :
|
||||
m_object(base->parameter_space_in_y_2_object()),
|
||||
m_object(base->parameter_space_in_y_2_object()),
|
||||
m_counter1(counter1),
|
||||
m_counter2(counter2),
|
||||
m_counter3(counter3) {}
|
||||
|
|
@ -673,7 +673,7 @@ public:
|
|||
/*! Operate */
|
||||
Arr_parameter_space operator()(const X_monotone_curve_2& xc) const
|
||||
{ ++m_counter3; return m_object(xc); }
|
||||
|
||||
|
||||
};
|
||||
|
||||
/*! A functor that determines whether a point or a curve lies on an
|
||||
|
|
@ -687,9 +687,9 @@ public:
|
|||
|
||||
public:
|
||||
/*! Construct */
|
||||
Is_on_y_identification_2(const Base* base,
|
||||
Is_on_y_identification_2(const Base* base,
|
||||
unsigned int& counter1, unsigned int& counter2) :
|
||||
m_object(base->is_on_y_identificiation_2_object()),
|
||||
m_object(base->is_on_y_identificiation_2_object()),
|
||||
m_counter1(counter1),
|
||||
m_counter2(counter2) {}
|
||||
|
||||
|
|
@ -715,9 +715,9 @@ public:
|
|||
|
||||
public:
|
||||
/*! Construct */
|
||||
Compare_x_at_limit_2(const Base* base,
|
||||
Compare_x_at_limit_2(const Base* base,
|
||||
unsigned int& counter1, unsigned int& counter2) :
|
||||
m_object(base->compare_x_at_limit_2_object()),
|
||||
m_object(base->compare_x_at_limit_2_object()),
|
||||
m_counter1(counter1),
|
||||
m_counter2(counter2) {}
|
||||
|
||||
|
|
@ -743,11 +743,11 @@ public:
|
|||
private:
|
||||
typename Base::Compare_x_near_limit_2 m_object;
|
||||
unsigned int& m_counter;
|
||||
|
||||
|
||||
public:
|
||||
/*! Construct */
|
||||
Compare_x_near_limit_2(const Base* base, unsigned int& counter) :
|
||||
m_object(base->compare_x_near_limit_2_object()),
|
||||
m_object(base->compare_x_near_limit_2_object()),
|
||||
m_counter(counter) {}
|
||||
|
||||
|
||||
|
|
@ -804,12 +804,12 @@ public:
|
|||
private:
|
||||
typename Base::Compare_x_near_boundary_2 m_object;
|
||||
unsigned int& m_counter;
|
||||
|
||||
|
||||
public:
|
||||
/*! Construct */
|
||||
Compare_x_near_boundary_2(const Base* base,
|
||||
Compare_x_near_boundary_2(const Base* base,
|
||||
unsigned int& counter) :
|
||||
m_object(base->compare_x_near_boundary_2_object()),
|
||||
m_object(base->compare_x_near_boundary_2_object()),
|
||||
m_counter(counter) {}
|
||||
|
||||
|
||||
|
|
@ -829,7 +829,7 @@ public:
|
|||
|
||||
Compare_x_2 compare_x_2_object() const
|
||||
{ return Compare_x_2(this, m_counters[COMPARE_X_OP]); }
|
||||
|
||||
|
||||
Compare_xy_2 compare_xy_2_object() const
|
||||
{ return Compare_xy_2(this, m_counters[COMPARE_XY_OP]); }
|
||||
|
||||
|
|
@ -838,13 +838,13 @@ public:
|
|||
|
||||
Construct_max_vertex_2 construct_max_vertex_2_object() const
|
||||
{ return Construct_max_vertex_2(this, m_counters[CONSTRUCT_MAX_VERTEX_OP]); }
|
||||
|
||||
|
||||
Is_vertical_2 is_vertical_2_object() const
|
||||
{ return Is_vertical_2(this, m_counters[IS_VERTICAL_OP]); }
|
||||
|
||||
|
||||
Compare_y_at_x_2 compare_y_at_x_2_object() const
|
||||
{ return Compare_y_at_x_2(this, m_counters[COMPARE_Y_AT_X_OP]); }
|
||||
|
||||
|
||||
Equal_2 equal_2_object() const
|
||||
{
|
||||
return Equal_2(this, m_counters[EQUAL_POINTS_OP],
|
||||
|
|
@ -856,7 +856,7 @@ public:
|
|||
|
||||
Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const
|
||||
{ return Compare_y_at_x_right_2(this, m_counters[COMPARE_Y_AT_X_RIGHT_OP]); }
|
||||
|
||||
|
||||
Make_x_monotone_2 make_x_monotone_2_object() const
|
||||
{ return Make_x_monotone_2(this, m_counters[MAKE_X_MONOTONE_OP]); }
|
||||
|
||||
|
|
@ -881,16 +881,16 @@ public:
|
|||
// left-right
|
||||
Parameter_space_in_x_2 parameter_space_in_x_2_object() const
|
||||
{ return Parameter_space_in_x_2(
|
||||
this,
|
||||
this,
|
||||
m_counters[PARAMETER_SPACE_IN_X_CURVE_END_OP],
|
||||
m_counters[PARAMETER_SPACE_IN_X_POINT_OP],
|
||||
m_counters[PARAMETER_SPACE_IN_X_CURVE_OP]
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Is_on_x_identification_2 is_on_x_identification_2_object() const
|
||||
{
|
||||
return Is_on_x_identification_2(this,
|
||||
return Is_on_x_identification_2(this,
|
||||
m_counters[IS_ON_X_IDENTIFICATION_POINT_OP],
|
||||
m_counters[IS_ON_X_IDENTIFICATION_CURVE_OP]);
|
||||
}
|
||||
|
|
@ -907,25 +907,25 @@ public:
|
|||
// bottom-top
|
||||
Parameter_space_in_y_2 parameter_space_in_y_2_object() const
|
||||
{ return Parameter_space_in_y_2(
|
||||
this,
|
||||
this,
|
||||
m_counters[PARAMETER_SPACE_IN_Y_CURVE_END_OP],
|
||||
m_counters[PARAMETER_SPACE_IN_Y_POINT_OP],
|
||||
m_counters[PARAMETER_SPACE_IN_Y_CURVE_OP]
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
Is_on_y_identification_2 is_on_y_identification_2_object() const
|
||||
{ return Is_on_y_identification_2(
|
||||
this,
|
||||
this,
|
||||
m_counters[IS_ON_Y_IDENTIFICATION_POINT_OP],
|
||||
m_counters[IS_ON_Y_IDENTIFICATION_CURVE_OP]
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
Compare_x_at_limit_2 compare_x_at_limit_2_object() const
|
||||
{
|
||||
return
|
||||
Compare_x_at_limit_2(this,
|
||||
Compare_x_at_limit_2(this,
|
||||
m_counters[COMPARE_X_AT_LIMIT_POINT_CURVE_END_OP],
|
||||
m_counters[COMPARE_X_AT_LIMIT_CURVE_ENDS_OP]);
|
||||
}
|
||||
|
|
@ -936,12 +936,12 @@ public:
|
|||
Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const
|
||||
{
|
||||
return
|
||||
Compare_x_on_boundary_2(this,
|
||||
Compare_x_on_boundary_2(this,
|
||||
m_counters[COMPARE_X_ON_BOUNDARY_POINTS_OP],
|
||||
m_counters[COMPARE_X_ON_BOUNDARY_POINT_CURVE_END_OP],
|
||||
m_counters[COMPARE_X_ON_BOUNDARY_CURVE_ENDS_OP]);
|
||||
}
|
||||
|
||||
|
||||
Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const
|
||||
{
|
||||
return Compare_x_near_boundary_2(this,
|
||||
|
|
|
|||
|
|
@ -1573,6 +1573,63 @@ public:
|
|||
Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const
|
||||
{ return Compare_x_on_boundary_2(*this); }
|
||||
|
||||
/*! A functor that compares the x-coordinates of curveends near the
|
||||
* boundary of the parameter space.
|
||||
*/
|
||||
class Compare_x_near_boundary_2 {
|
||||
protected:
|
||||
typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
|
||||
Polycurve_basic_traits_2;
|
||||
|
||||
/*! The polycurve traits (in case it has state). */
|
||||
const Polycurve_basic_traits_2& m_poly_traits;
|
||||
|
||||
public:
|
||||
/*! Constructor. */
|
||||
Compare_x_near_boundary_2(const Polycurve_basic_traits_2& traits) :
|
||||
m_poly_traits(traits)
|
||||
{}
|
||||
|
||||
/*! Compare the x-coordinates of 2 curveends near the boundary of the
|
||||
* parameter space.
|
||||
* \param xcv1 the first polycurve.
|
||||
* \param xcv2 the second polycurve.
|
||||
* \param ce the curve end indicator -
|
||||
* ARR_MIN_END - the minimal end of curves or
|
||||
* ARR_MAX_END - the maximal end of curves.
|
||||
* \return the second comparison result:
|
||||
* SMALLER - x(xcv1, ce) < x(xcv2, ce);
|
||||
* EQUAL - x(xcv1, ce) = x(xcv2, ce);
|
||||
* LARGER - x(xcv1, ce) > x(xcv2, ce).
|
||||
* \pre the $x$-coordinates of xcv1 and xcv2 at their ce end are equal.
|
||||
* \pre xcv1 does not coincide with the vertical identification curve.
|
||||
* \pre xcv2 does not coincide with the vertical identification curve.
|
||||
*/
|
||||
Comparison_result operator()(const X_monotone_curve_2& xcv1,
|
||||
const X_monotone_curve_2& xcv2,
|
||||
Arr_curve_end ce) const
|
||||
{
|
||||
const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2();
|
||||
Comparison_result direction1 =
|
||||
geom_traits->compare_endpoints_xy_2_object()(xcv1[0]);
|
||||
const X_monotone_subcurve_2& xs1 =
|
||||
(((direction1 == SMALLER) && (ce == ARR_MAX_END)) ||
|
||||
((direction1 == LARGER) && (ce == ARR_MIN_END))) ?
|
||||
xcv1[0] : xcv1[xcv1.number_of_subcurves()-1];
|
||||
Comparison_result direction2 =
|
||||
geom_traits->compare_endpoints_xy_2_object()(xcv2[0]);
|
||||
const X_monotone_subcurve_2& xs2 =
|
||||
(((direction2 == SMALLER) && (ce == ARR_MAX_END)) ||
|
||||
((direction2 == LARGER) && (ce == ARR_MIN_END))) ?
|
||||
xcv2[0] : xcv2[xcv2.number_of_subcurves()-1];
|
||||
return geom_traits->compare_x_near_boundary_2_object()(xs1, xs2, ce);
|
||||
}
|
||||
};
|
||||
|
||||
/*! Obtain a Compare_x_near_boundary_2 function object */
|
||||
Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const
|
||||
{ return Compare_x_near_boundary_2(*this); }
|
||||
|
||||
class Compare_x_at_limit_2{
|
||||
protected:
|
||||
typedef Arr_polycurve_basic_traits_2<Subcurve_traits_2>
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ public:
|
|||
typedef typename Base::Parameter_space_in_y_2 Parameter_space_in_y_2;
|
||||
typedef typename Base::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
|
||||
typedef typename Base::Compare_x_at_limit_2 Compare_x_at_limit_2;
|
||||
typedef typename Base::Compare_x_near_boundary_2 Compare_x_near_boundary_2;
|
||||
typedef typename Base::Compare_x_near_limit_2 Compare_x_near_limit_2;
|
||||
typedef typename Base::Compare_y_on_boundary_2 Compare_y_on_boundary_2;
|
||||
typedef typename Base::Compare_y_near_boundary_2 Compare_y_near_boundary_2;
|
||||
|
|
@ -165,7 +166,7 @@ public:
|
|||
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
class Push_back_2;
|
||||
#endif
|
||||
#endif
|
||||
/*! \class
|
||||
* A functor that divides an arc into x-monotone arcs. That are, arcs that
|
||||
* do not cross the identification arc.
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ public:
|
|||
typedef typename Base::Parameter_space_in_y_2 Parameter_space_in_y_2;
|
||||
typedef typename Base::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
|
||||
typedef typename Base::Compare_x_at_limit_2 Compare_x_at_limit_2;
|
||||
typedef typename Base::Compare_x_near_boundary_2 Compare_x_near_boundary_2;
|
||||
typedef typename Base::Compare_x_near_limit_2 Compare_x_near_limit_2;
|
||||
typedef typename Base::Compare_y_on_boundary_2 Compare_y_on_boundary_2;
|
||||
typedef typename Base::Compare_y_near_boundary_2 Compare_y_near_boundary_2;
|
||||
|
|
|
|||
|
|
@ -204,9 +204,6 @@ private:
|
|||
/*! The number of facest */
|
||||
size_type m_num_facets;
|
||||
|
||||
/*! The type of the facets. */
|
||||
size_type m_num_vertices_per_facet;
|
||||
|
||||
/*! The index of the marked vertex */
|
||||
size_type m_marked_vertex_index;
|
||||
|
||||
|
|
@ -223,13 +220,11 @@ private:
|
|||
size_type num_points,
|
||||
const CoordIndexIter& indices_begin,
|
||||
const CoordIndexIter& indices_end,
|
||||
size_type num_facets,
|
||||
size_type num_vertices_per_facet = 0) :
|
||||
size_type num_facets) :
|
||||
m_points_begin(points_begin), m_points_end(points_end),
|
||||
m_num_points(num_points),
|
||||
m_indices_begin(indices_begin), m_indices_end(indices_end),
|
||||
m_num_facets(num_facets),
|
||||
m_num_vertices_per_facet(num_vertices_per_facet),
|
||||
m_marked_vertex_index(0),
|
||||
m_marked_edge_index(0),
|
||||
m_marked_facet_index(0)
|
||||
|
|
@ -264,51 +259,16 @@ private:
|
|||
|
||||
// Add the facets:
|
||||
counter = 0;
|
||||
switch (m_num_vertices_per_facet) {
|
||||
case 0: // '0' indicates variant number of vertices per facet
|
||||
{
|
||||
CoordIndexIter ii = m_indices_begin;
|
||||
while (ii != m_indices_end) {
|
||||
Polyhedron_facet_handle fh = B.begin_facet();
|
||||
if (counter == m_marked_facet_index) fh->set_marked(true);
|
||||
int index = *ii++;
|
||||
while (index != -1) {
|
||||
B.add_vertex_to_facet(index);
|
||||
index = *ii++;
|
||||
}
|
||||
B.end_facet();
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// Unfold for to improve preformance:
|
||||
for (CoordIndexIter ii = m_indices_begin; ii != m_indices_end;
|
||||
ii += m_num_vertices_per_facet)
|
||||
{
|
||||
Polyhedron_facet_handle fh = B.begin_facet();
|
||||
if (counter == m_marked_facet_index) fh->set_marked(true);
|
||||
B.add_vertex_to_facet(*ii);
|
||||
B.add_vertex_to_facet(*(ii+1));
|
||||
B.add_vertex_to_facet(*(ii+2));
|
||||
B.end_facet();
|
||||
++counter;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
for (CoordIndexIter ii = m_indices_begin; ii != m_indices_end;
|
||||
ii += m_num_vertices_per_facet)
|
||||
{
|
||||
Polyhedron_facet_handle fh = B.begin_facet();
|
||||
if (counter == m_marked_facet_index) fh->set_marked(true);
|
||||
for (size_type i = 0; i < m_num_vertices_per_facet; ++i)
|
||||
B.add_vertex_to_facet(*(ii + i));
|
||||
B.end_facet();
|
||||
++counter;
|
||||
}
|
||||
break;
|
||||
for (CoordIndexIter it = m_indices_begin; it != m_indices_end; ++it) {
|
||||
Polyhedron_facet_handle fh = B.begin_facet();
|
||||
if (counter == m_marked_facet_index) fh->set_marked(true);
|
||||
//! \todo EF: when upgrading to C++11 change the type of the following
|
||||
// iterator to auto. Better yet, use for (auto blah : foo).
|
||||
for (std::vector<size_t>::const_iterator iit = it->begin();
|
||||
iit != it->end(); ++iit)
|
||||
B.add_vertex_to_facet(*iit);
|
||||
B.end_facet();
|
||||
++counter;
|
||||
}
|
||||
B.end_surface();
|
||||
}
|
||||
|
|
@ -366,13 +326,12 @@ private:
|
|||
size_type num_points,
|
||||
const CoordIndexIter indices_begin,
|
||||
const CoordIndexIter indices_end,
|
||||
size_type num_facets,
|
||||
size_type num_vertices_per_facet = 0)
|
||||
size_type num_facets)
|
||||
{
|
||||
/*! The builder */
|
||||
Build_surface<PointIterator, CoordIndexIter>
|
||||
surface(points_begin, points_end, num_points,
|
||||
indices_begin, indices_end, num_facets, num_vertices_per_facet);
|
||||
indices_begin, indices_end, num_facets);
|
||||
surface.set_marked_vertex_index(m_marked_vertex_index);
|
||||
surface.set_marked_edge_index(m_marked_edge_index);
|
||||
surface.set_marked_facet_index(m_marked_facet_index);
|
||||
|
|
@ -604,15 +563,13 @@ public:
|
|||
const CoordIndexIter indices_begin,
|
||||
const CoordIndexIter indices_end,
|
||||
size_type num_facets,
|
||||
size_type num_vertices_per_facet = 0,
|
||||
Visitor* visitor = NULL)
|
||||
{
|
||||
m_visitor = visitor;
|
||||
|
||||
Polyhedron polyhedron;
|
||||
update_polyhedron(polyhedron, points_begin, points_end, num_points,
|
||||
indices_begin, indices_end, num_facets,
|
||||
num_vertices_per_facet);
|
||||
indices_begin, indices_end, num_facets);
|
||||
|
||||
#if 0
|
||||
std::copy(polyhedron.points_begin(), polyhedron.points_end(),
|
||||
|
|
|
|||
|
|
@ -18,15 +18,16 @@
|
|||
// $Date$
|
||||
//
|
||||
//
|
||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>s
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
// Eric Berberich <eric@mpi-inf.mpg.de>
|
||||
// (based on old version by Iddo Hanniel
|
||||
// Eyal Flato
|
||||
// Oren Nechushtan
|
||||
// Efi Fogel
|
||||
// Ron Wein
|
||||
// Idit Haran)
|
||||
// Author(s): Ron Wein <wein@post.tau.ac.il>s
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
// Eric Berberich <eric@mpi-inf.mpg.de>
|
||||
// (based on old version by Iddo Hanniel
|
||||
// Eyal Flato
|
||||
// Oren Nechushtan
|
||||
// Efi Fogel
|
||||
// Ron Wein
|
||||
// Idit Haran)
|
||||
|
||||
#ifndef CGAL_ARR_TRAITS_ADAPTOR_2_H
|
||||
#define CGAL_ARR_TRAITS_ADAPTOR_2_H
|
||||
|
||||
|
|
@ -73,6 +74,12 @@ public:
|
|||
Right_side_category;
|
||||
|
||||
protected:
|
||||
// All sides
|
||||
typedef typename Arr_are_all_sides_oblivious_tag<Left_side_category,
|
||||
Bottom_side_category,
|
||||
Top_side_category,
|
||||
Right_side_category>::result
|
||||
Are_all_sides_oblivious_category;
|
||||
|
||||
// left-right dispatch
|
||||
typedef CGAL::internal::Arr_left_right_implementation_dispatch<
|
||||
|
|
@ -2270,10 +2277,10 @@ class Arr_traits_adaptor_2 :
|
|||
public Arr_traits_basic_adaptor_2<ArrangementTraits_>
|
||||
{
|
||||
public:
|
||||
|
||||
// Traits-class geometric types.
|
||||
typedef ArrangementTraits_ Base_traits_2;
|
||||
typedef Arr_traits_basic_adaptor_2<ArrangementTraits_> Base;
|
||||
typedef ArrangementTraits_ Base_traits_2;
|
||||
typedef Arr_traits_basic_adaptor_2<Base_traits_2> Base;
|
||||
typedef Arr_traits_adaptor_2<Base_traits_2> Self;
|
||||
|
||||
typedef typename Base_traits_2::Curve_2 Curve_2;
|
||||
typedef typename Base::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
|
@ -2289,6 +2296,9 @@ public:
|
|||
typedef typename Base::Top_side_category Top_side_category;
|
||||
typedef typename Base::Right_side_category Right_side_category;
|
||||
|
||||
typedef typename Base::Are_all_sides_oblivious_category
|
||||
Are_all_sides_oblivious_category;
|
||||
|
||||
/// \name Construction.
|
||||
//@{
|
||||
/*! Default constructor. */
|
||||
|
|
@ -2300,7 +2310,7 @@ public:
|
|||
|
||||
// Inherited functors:
|
||||
typedef typename Base::Compare_x_2 Compare_x_2;
|
||||
typedef typename Base::Compare_xy_2 Compare_xy_2;
|
||||
// typedef typename Base::Compare_xy_2 Compare_xy_2;
|
||||
typedef typename Base::Construct_min_vertex_2 Construct_min_vertex_2;
|
||||
typedef typename Base::Construct_max_vertex_2 Construct_max_vertex_2;
|
||||
typedef typename Base::Is_vertical_2 Is_vertical_2;
|
||||
|
|
@ -2317,6 +2327,499 @@ public:
|
|||
/// \name Overriden functors.
|
||||
//@{
|
||||
|
||||
/*! A functor that compares two points or two x-monotone curves
|
||||
* lexigoraphically. Twp points are compared firest by their x-coordinates,
|
||||
* then by their y-coordinates. Two curves are compared first their left-most
|
||||
* endpoint, then by the graphs, and finally by their right-most endpoint.
|
||||
*/
|
||||
class Compare_xy_2 {
|
||||
public:
|
||||
/*! Compare two points lexigoraphically: by x, then by y.
|
||||
* \param p1 the first point.
|
||||
* \param p2 the second point.
|
||||
* \return SMALLER - x(p1) < x(p2);
|
||||
* SMALLER - x(p1) = x(p2) and y(p1) < y(p2);
|
||||
* EQUAL - x(p1) = x(p2) and y(p1) = y(p2);
|
||||
* LARGER - x(p1) = x(p2) and y(p1) > y(p2);
|
||||
* LARGER - x(p1) > x(p2).
|
||||
* \pre p1 does not lie on the boundary.
|
||||
* \pre p2 does not lie on the boundary.
|
||||
*/
|
||||
Comparison_result operator()(const Point_2& p1, const Point_2& p2) const
|
||||
{
|
||||
Base base(m_self);
|
||||
return base.compare_xy_2_object()(p1, p2);
|
||||
}
|
||||
|
||||
/*! Compare two x-monotone curves lexigoraphically.
|
||||
* Input: C1, C2, intersections = empty
|
||||
* compare(C1, C2, intersections)
|
||||
* Compare the left-most points of C1 and C2.
|
||||
* If not equal return the comparison result.
|
||||
* Otherwise (the left-most points are equal)
|
||||
* Compare C1 and C2 to the right of the point.
|
||||
* If not equal return the comparison result.
|
||||
* Otherwise (they overlap)
|
||||
* If intersection is empty, compute the intersections,
|
||||
* Remove the first overlapping section from c1, c2, and intersections.
|
||||
* If intersections is empty
|
||||
* Compare the right-most point and return the result.
|
||||
* return compare(C1, C2, intersections).
|
||||
*/
|
||||
Comparison_result operator()(const X_monotone_curve_2& c1,
|
||||
const X_monotone_curve_2& c2) const
|
||||
{
|
||||
std::list<CGAL::Object> intersections;
|
||||
return operator()(c1, c2, intersections,
|
||||
Are_all_sides_oblivious_category());
|
||||
}
|
||||
|
||||
protected:
|
||||
//! The base traits.
|
||||
const Self& m_self;
|
||||
|
||||
/*! Constructor.
|
||||
* \param trait The base traits class. It must be passed, to handle non
|
||||
* stateless traits objects, (which stores data).
|
||||
* The constructor is declared private to allow only the functor
|
||||
* obtaining function, which is a member of the nesting class,
|
||||
* constructing it.
|
||||
*/
|
||||
Compare_xy_2(const Self& self) : m_self(self) {}
|
||||
|
||||
//! Allow its functor obtaining function calling the private constructor.
|
||||
friend class Arr_traits_adaptor_2<Base_traits_2>;
|
||||
|
||||
/// Point-curve
|
||||
//@{
|
||||
/*! Compare a point and a curve end.
|
||||
* Dispatch calls to traits that handle open and close boundaries, resp.
|
||||
* The only reason for this dispatcher is the poor choice of different
|
||||
* names for the Traits functors that handle close and open boundaries:
|
||||
* Open boundary traits use: Compare_x_at_limit_2
|
||||
* Close boundary traits use: Compare_x_on_boundary_2
|
||||
*/
|
||||
Comparison_result cmp_x_on_bnd(const Point_2& p,
|
||||
const X_monotone_curve_2& c,
|
||||
Arr_curve_end ce) const
|
||||
{
|
||||
// The complete code would need to check whether ce is bottom or top and
|
||||
// use the corresponding dispatching criterion, but
|
||||
// (i) in all out traits if bottom is open, so is top, and
|
||||
// (ii) this is going to change soon....
|
||||
return cmp_x_on_bnd(p, c, ce, Bottom_side_category());
|
||||
}
|
||||
|
||||
// Open
|
||||
Comparison_result cmp_x_on_bnd(const Point_2& p,
|
||||
const X_monotone_curve_2& c,
|
||||
Arr_curve_end ce,
|
||||
Arr_open_side_tag) const
|
||||
{ return m_self.compare_x_at_limit_2_object()(p, c, ce); }
|
||||
|
||||
// Close
|
||||
Comparison_result cmp_x_on_bnd(const Point_2& p,
|
||||
const X_monotone_curve_2& c,
|
||||
Arr_curve_end ce,
|
||||
Arr_oblivious_side_tag) const
|
||||
{ return m_self.compare_x_on_boundary_2_object()(p, c, ce); }
|
||||
//@}
|
||||
|
||||
/// curve-curve
|
||||
//@{
|
||||
/*! Compare a curve end and a curve end.
|
||||
* Dispatch calls to traits that handle open and close boundaries, resp.
|
||||
* The only reason for this dispatcher is the poor choice of different
|
||||
* names for the Traits functors that handle close and open boundaries:
|
||||
* Open boundary traits use: Compare_x_at_limit_2
|
||||
* Close boundary traits use: Compare_x_on_boundary_2
|
||||
*/
|
||||
Comparison_result cmp_x_on_bnd(const X_monotone_curve_2& c1,
|
||||
Arr_curve_end ce1,
|
||||
const X_monotone_curve_2& c2,
|
||||
Arr_curve_end ce2) const
|
||||
{
|
||||
// The complete code would need to check the combination of ce1 and ce2,
|
||||
// whther they are (booton,bottom), (bottom,top), (top,bottom) or
|
||||
// (top,top) and use the corresponding dispatching criteria, but we don't
|
||||
// even have the interface to handle mixed (e.g., open bottom and
|
||||
// closed top. Anyway, this is going to change soon....
|
||||
return cmp_x_on_bnd(c1, ce1, c2, ce2, Bottom_side_category());
|
||||
}
|
||||
|
||||
// Open
|
||||
Comparison_result cmp_x_on_bnd(const X_monotone_curve_2& c1,
|
||||
Arr_curve_end ce1,
|
||||
const X_monotone_curve_2& c2,
|
||||
Arr_curve_end ce2,
|
||||
Arr_open_side_tag) const
|
||||
{ return m_self.compare_x_at_limit_2_object()(c1, ce1, c2, ce2); }
|
||||
|
||||
// Close
|
||||
Comparison_result cmp_x_on_bnd(const X_monotone_curve_2& c1,
|
||||
Arr_curve_end ce1,
|
||||
const X_monotone_curve_2& c2,
|
||||
Arr_curve_end ce2,
|
||||
Arr_oblivious_side_tag) const
|
||||
{ return m_self.compare_x_on_boundary_2_object()(c1, ce1, c2, ce2); }
|
||||
//@}
|
||||
|
||||
/*! Compare the max end of two x-monotone curves lexigoraphically.
|
||||
*/
|
||||
Comparison_result compare_max_end(const X_monotone_curve_2& c1,
|
||||
const X_monotone_curve_2& c2,
|
||||
Arr_all_sides_oblivious_tag) const
|
||||
{
|
||||
typedef typename Self::Construct_max_vertex_2 Construct_max_vertex_2;
|
||||
Construct_max_vertex_2 ctr_max =
|
||||
m_self.construct_max_vertex_2_object();
|
||||
const Point_2& p1 = ctr_max(c1);
|
||||
const Point_2& p2 = ctr_max(c2);
|
||||
return operator()(p1, p2);
|
||||
}
|
||||
|
||||
/*! Compare the max (right) end of two x-monotone curves lexigoraphically.
|
||||
* \pre the curve overlap
|
||||
*/
|
||||
Comparison_result compare_max_end(const X_monotone_curve_2& c1,
|
||||
const X_monotone_curve_2& c2,
|
||||
Arr_not_all_sides_oblivious_tag) const
|
||||
{
|
||||
typedef typename Base::Parameter_space_in_x_2 Parameter_space_in_x_2;
|
||||
typedef typename Base::Parameter_space_in_y_2 Parameter_space_in_y_2;
|
||||
Parameter_space_in_x_2 psx = m_self.parameter_space_in_x_2_object();
|
||||
Parameter_space_in_y_2 psy = m_self.parameter_space_in_y_2_object();
|
||||
|
||||
Arr_parameter_space px1 = psx(c1, ARR_MAX_END);
|
||||
Arr_parameter_space py1 = psy(c1, ARR_MAX_END);
|
||||
|
||||
Arr_parameter_space px2 = psx(c2, ARR_MAX_END);
|
||||
Arr_parameter_space py2 = psy(c2, ARR_MAX_END);
|
||||
|
||||
// Handle the trivial cases:
|
||||
if ((px1 == ARR_LEFT_BOUNDARY) && (px2 != ARR_LEFT_BOUNDARY))
|
||||
return SMALLER;
|
||||
|
||||
if ((px2 == ARR_LEFT_BOUNDARY) && (px1 != ARR_LEFT_BOUNDARY))
|
||||
return LARGER;
|
||||
|
||||
if ((px1 == ARR_RIGHT_BOUNDARY) && (px2 != ARR_RIGHT_BOUNDARY))
|
||||
return LARGER;
|
||||
|
||||
if ((px2 == ARR_RIGHT_BOUNDARY) && (px1 != ARR_RIGHT_BOUNDARY))
|
||||
return SMALLER;
|
||||
|
||||
// The only casese left are px1,px2 = (I,I), (L,L), and (R,R)
|
||||
|
||||
if (px1 == ARR_INTERIOR) {
|
||||
CGAL_assertion(px2 == ARR_INTERIOR);
|
||||
|
||||
if ((py1 == ARR_INTERIOR) && (py2 == ARR_INTERIOR))
|
||||
return compare_max_end(c1, c2, Arr_all_sides_oblivious_tag());
|
||||
|
||||
// px1, px2, py1 are interior
|
||||
if (py1 == ARR_INTERIOR) {
|
||||
CGAL_assertion(py2 != ARR_INTERIOR);
|
||||
#if 0
|
||||
// This code is retained (commented out) because in the future, when
|
||||
// Compare_x_at_limit_2 and Compare_x_on_boundary will be consolidated,
|
||||
// say, to Compare_x_on_boundary, it will replace the call below.
|
||||
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
|
||||
Compare_x_on_boundary_2 cmp_x_on_bnd =
|
||||
m_self.compare_x_on_boundary_2_object();
|
||||
#endif
|
||||
const Point_2& c1_max = m_self.construct_max_vertex_2_object()(c1);
|
||||
Comparison_result res = cmp_x_on_bnd(c1_max, c2, ARR_MAX_END);
|
||||
if (res != EQUAL) return res;
|
||||
|
||||
return (py2 == ARR_TOP_BOUNDARY) ? SMALLER : LARGER;
|
||||
}
|
||||
|
||||
// px1, px2, py2 are interior
|
||||
if (py2 == ARR_INTERIOR) {
|
||||
CGAL_assertion(py1 != ARR_INTERIOR);
|
||||
#if 0
|
||||
// This code is retained (commented out) because in the future, when
|
||||
// Compare_x_at_limit_2 and Compare_x_on_boundary will be consolidated,
|
||||
// say, to Compare_x_on_boundary, it will replace the call below.
|
||||
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
|
||||
Compare_x_on_boundary_2 cmp_x_on_bnd =
|
||||
m_self.compare_x_on_boundary_2_object();
|
||||
#endif
|
||||
const Point_2& c2_max = m_self.construct_max_vertex_2_object()(c2);
|
||||
Comparison_result res = cmp_x_on_bnd(c2_max, c1, ARR_MAX_END);
|
||||
if (res != EQUAL) return CGAL::opposite(res);
|
||||
|
||||
return (py1 == ARR_BOTTOM_BOUNDARY) ? SMALLER : LARGER;
|
||||
}
|
||||
|
||||
// Both py1 and py2 not interior
|
||||
#if 0
|
||||
// This code is retained (commented out) because in the future, when
|
||||
// Compare_x_at_limit_2 and Compare_x_on_boundary will be consolidated,
|
||||
// say, to Compare_x_on_boundary, it will replace the call below.
|
||||
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
|
||||
Compare_x_on_boundary_2 cmp_x_on_bnd =
|
||||
m_self.compare_x_on_boundary_2_object();
|
||||
#endif
|
||||
Comparison_result res = cmp_x_on_bnd(c1, ARR_MAX_END, c2, ARR_MAX_END);
|
||||
if (res != EQUAL) return res;
|
||||
|
||||
if ((py1 == ARR_BOTTOM_BOUNDARY) && (py2 != ARR_BOTTOM_BOUNDARY))
|
||||
return SMALLER;
|
||||
if ((py1 == ARR_TOP_BOUNDARY) && (py2 != ARR_TOP_BOUNDARY))
|
||||
return LARGER;
|
||||
return EQUAL;
|
||||
}
|
||||
|
||||
// Both endpoints lie either on the left boundary or on the right
|
||||
// boundary, which means that their x-coordinates are equal.
|
||||
// Handle the trivial cases:
|
||||
if ((py1 == ARR_BOTTOM_BOUNDARY) && (py2 != ARR_BOTTOM_BOUNDARY))
|
||||
return SMALLER;
|
||||
if ((py1 == ARR_TOP_BOUNDARY) && (py2 != ARR_TOP_BOUNDARY))
|
||||
return LARGER;
|
||||
|
||||
typedef typename Self::Compare_y_on_boundary_2 Compare_y_on_boundary_2;
|
||||
Compare_y_on_boundary_2 cmp_y_on_bnd =
|
||||
m_self.compare_y_on_boundary_2_object();
|
||||
const Point_2& c1_max = m_self.construct_max_vertex_2_object()(c1);
|
||||
const Point_2& c2_max = m_self.construct_max_vertex_2_object()(c2);
|
||||
Comparison_result res = cmp_y_on_bnd(c1_max, c2_max);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*! Split 2 given curves that overlap and have a common sub-curve on their
|
||||
* right. Then compare the remaining portions of the curves, respectively.
|
||||
*/
|
||||
Comparison_result
|
||||
compare_remainder(const X_monotone_curve_2& c1,
|
||||
const X_monotone_curve_2& c2,
|
||||
std::list<CGAL::Object>& intersections) const
|
||||
{
|
||||
// Right-most sections are equal.
|
||||
// Advance to the next respective sections:
|
||||
if (intersections.empty()) {
|
||||
typedef typename Self::Intersect_2 Intersect_2;
|
||||
Intersect_2 intersect = m_self.intersect_2_object();
|
||||
intersect(c1, c2, std::back_inserter(intersections));
|
||||
}
|
||||
// Verify the first intersection is an overlap, remove it, and
|
||||
// recursively call.
|
||||
CGAL::Object first = intersections.front();
|
||||
X_monotone_curve_2 xcv;
|
||||
if (!assign(xcv, first)) {
|
||||
CGAL_error_msg("The first intersection is not an overlap!");
|
||||
return SMALLER;
|
||||
}
|
||||
intersections.pop_front();
|
||||
if (intersections.empty())
|
||||
return compare_max_end(c1, c2, Are_all_sides_oblivious_category());
|
||||
|
||||
// Otherwise, split and continue.
|
||||
typedef typename Self::Split_2 Split_2;
|
||||
Split_2 split = m_self.split_2_object();
|
||||
X_monotone_curve_2 c11, c12, c21, c22;
|
||||
Construct_max_vertex_2 ctr_max =
|
||||
m_self.construct_max_vertex_2_object();
|
||||
const Point_2& p1 = ctr_max(xcv);
|
||||
const Point_2& p2 = ctr_max(xcv);
|
||||
split(c1, p1, c11, c12);
|
||||
split(c2, p2, c21, c22);
|
||||
return operator()(c12, c22, intersections,
|
||||
Are_all_sides_oblivious_category());
|
||||
}
|
||||
|
||||
/*! Compare two x-monotone curves lexigoraphically.
|
||||
*/
|
||||
Comparison_result operator()(const X_monotone_curve_2& c1,
|
||||
const X_monotone_curve_2& c2,
|
||||
std::list<CGAL::Object>& intersections,
|
||||
Arr_all_sides_oblivious_tag) const
|
||||
{
|
||||
const Point_2& c1_min = m_self.construct_min_vertex_2_object()(c1);
|
||||
const Point_2& c2_min = m_self.construct_min_vertex_2_object()(c2);
|
||||
|
||||
Comparison_result res = operator()(c1_min, c2_min);
|
||||
if (res != EQUAL) return res;
|
||||
|
||||
// Left-most points are equal.
|
||||
// Compare their y-coordinates to their right:
|
||||
res = m_self.compare_y_at_x_right_2_object()(c1, c2, c1_min);
|
||||
if (res != EQUAL) return res;
|
||||
|
||||
return compare_remainder(c1, c2, intersections);
|
||||
}
|
||||
|
||||
/*! Compare two x-monotone curves lexigoraphically.
|
||||
*/
|
||||
Comparison_result operator()(const X_monotone_curve_2& c1,
|
||||
const X_monotone_curve_2& c2,
|
||||
std::list<CGAL::Object>& intersections,
|
||||
Arr_not_all_sides_oblivious_tag) const
|
||||
{
|
||||
typedef typename Base::Parameter_space_in_x_2 Parameter_space_in_x_2;
|
||||
typedef typename Base::Parameter_space_in_y_2 Parameter_space_in_y_2;
|
||||
Parameter_space_in_x_2 psx = m_self.parameter_space_in_x_2_object();
|
||||
Parameter_space_in_y_2 psy = m_self.parameter_space_in_y_2_object();
|
||||
|
||||
Arr_parameter_space min_px1 = psx(c1, ARR_MIN_END);
|
||||
Arr_parameter_space min_py1 = psy(c1, ARR_MIN_END);
|
||||
|
||||
Arr_parameter_space min_px2 = psx(c2, ARR_MIN_END);
|
||||
Arr_parameter_space min_py2 = psy(c2, ARR_MIN_END);
|
||||
|
||||
// Handle the trivial cases:
|
||||
if ((min_px1 == ARR_LEFT_BOUNDARY) && (min_px2 != ARR_LEFT_BOUNDARY))
|
||||
return SMALLER;
|
||||
|
||||
if ((min_px2 == ARR_LEFT_BOUNDARY) && (min_px1 != ARR_LEFT_BOUNDARY))
|
||||
return LARGER;
|
||||
|
||||
if ((min_px1 == ARR_RIGHT_BOUNDARY) && (min_px2 != ARR_RIGHT_BOUNDARY))
|
||||
return LARGER;
|
||||
|
||||
if ((min_px2 == ARR_RIGHT_BOUNDARY) && (min_px1 != ARR_RIGHT_BOUNDARY))
|
||||
return SMALLER;
|
||||
|
||||
// The only casese left are px1,px2 = (I,I), (L,L), and (R,R)
|
||||
|
||||
if (min_px1 == ARR_INTERIOR) {
|
||||
CGAL_assertion(min_px2 == ARR_INTERIOR);
|
||||
|
||||
if ((min_py1 == ARR_INTERIOR) && (min_py2 == ARR_INTERIOR)) {
|
||||
return operator()(c1, c2, intersections,
|
||||
Arr_all_sides_oblivious_tag());
|
||||
}
|
||||
|
||||
//
|
||||
if (min_py1 == ARR_INTERIOR) {
|
||||
CGAL_assertion(min_py2 != ARR_INTERIOR);
|
||||
#if 0
|
||||
// This code is retained (commented out) because in the future, when
|
||||
// Compare_x_at_limit_2 and Compare_x_on_boundary will be consolidated,
|
||||
// say, to Compare_x_on_boundary, it will replace the call below.
|
||||
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
|
||||
Compare_x_on_boundary_2 cmp_x_on_bnd =
|
||||
m_self.compare_x_on_boundary_2_object();
|
||||
#endif
|
||||
const Point_2& c1_min = m_self.construct_min_vertex_2_object()(c1);
|
||||
Comparison_result res = cmp_x_on_bnd(c1_min, c2, ARR_MIN_END);
|
||||
if (res != EQUAL) return res;
|
||||
|
||||
return (min_py2 == ARR_TOP_BOUNDARY) ? SMALLER : LARGER;
|
||||
}
|
||||
|
||||
if (min_py2 == ARR_INTERIOR) {
|
||||
CGAL_assertion(min_py1 != ARR_INTERIOR);
|
||||
#if 0
|
||||
// This code is retained (commented out) because in the future, when
|
||||
// Compare_x_at_limit_2 and Compare_x_on_boundary will be consolidated,
|
||||
// say, to Compare_x_on_boundary, it will replace the call below.
|
||||
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
|
||||
Compare_x_on_boundary_2 cmp_x_on_bnd =
|
||||
m_self.compare_x_on_boundary_2_object();
|
||||
#endif
|
||||
const Point_2& c2_min = m_self.construct_min_vertex_2_object()(c2);
|
||||
|
||||
Comparison_result res = cmp_x_on_bnd(c2_min, c1, ARR_MIN_END);
|
||||
if (res != EQUAL) return CGAL::opposite(res);
|
||||
|
||||
return (min_py1 == ARR_BOTTOM_BOUNDARY) ? SMALLER : LARGER;
|
||||
}
|
||||
|
||||
// Both min_py1 and min_py2 not interior
|
||||
#if 0
|
||||
// This code is retained (commented out) because in the future, when
|
||||
// Compare_x_at_limit_2 and Compare_x_on_boundary will be consolidated,
|
||||
// say, to Compare_x_on_boundary, it will replace the call below.
|
||||
typedef typename Self::Compare_x_on_boundary_2 Compare_x_on_boundary_2;
|
||||
Compare_x_on_boundary_2 cmp_x_on_bnd =
|
||||
m_self.compare_x_on_boundary_2_object();
|
||||
#endif
|
||||
Comparison_result res = cmp_x_on_bnd(c1, ARR_MIN_END, c2, ARR_MIN_END);
|
||||
if (res != EQUAL) return res;
|
||||
|
||||
if ((min_py1 == ARR_BOTTOM_BOUNDARY) && (min_py2 == ARR_TOP_BOUNDARY))
|
||||
return SMALLER;
|
||||
if ((min_py1 == ARR_TOP_BOUNDARY) && (min_py2 == ARR_BOTTOM_BOUNDARY))
|
||||
return LARGER;
|
||||
|
||||
// Left-most points are equal.
|
||||
// Compare their x-coordinates near the common left endpoint.
|
||||
res = m_self.compare_x_near_boundary_2_object()(c1, c2, ARR_MIN_END);
|
||||
if (res != EQUAL) return res;
|
||||
|
||||
return compare_remainder(c1, c2, intersections);
|
||||
}
|
||||
|
||||
|
||||
if ((min_py1 == ARR_BOTTOM_BOUNDARY) && (min_py2 != ARR_BOTTOM_BOUNDARY))
|
||||
return SMALLER;
|
||||
if ((min_py1 == ARR_TOP_BOUNDARY) && (min_py2 != ARR_TOP_BOUNDARY))
|
||||
return LARGER;
|
||||
|
||||
if (min_px1 == ARR_LEFT_BOUNDARY) {
|
||||
// The min points of the two curves lie on the left boundary.
|
||||
CGAL_assertion(min_px2 == ARR_LEFT_BOUNDARY);
|
||||
typedef typename Self::Compare_y_on_boundary_2 Compare_y_on_boundary_2;
|
||||
Compare_y_on_boundary_2 cmp_y_on_bnd =
|
||||
m_self.compare_y_on_boundary_2_object();
|
||||
const Point_2& c1_min = m_self.construct_min_vertex_2_object()(c1);
|
||||
const Point_2& c2_min = m_self.construct_min_vertex_2_object()(c2);
|
||||
Comparison_result res = cmp_y_on_bnd(c1_min, c2_min);
|
||||
if (res != EQUAL) return res;
|
||||
|
||||
typedef typename Self::Is_vertical_2 Is_vertical_2;
|
||||
Is_vertical_2 is_vert = m_self.is_vertical_2_object();
|
||||
bool vert1 = is_vert(c1);
|
||||
bool vert2 = is_vert(c2);
|
||||
if (vert1 && ! vert2) return SMALLER;
|
||||
if (vert2 && ! vert1) return LARGER;
|
||||
if (vert1 && vert2) {
|
||||
const Point_2& c1_max = m_self.construct_max_vertex_2_object()(c1);
|
||||
const Point_2& c2_max = m_self.construct_max_vertex_2_object()(c2);
|
||||
res = cmp_y_on_bnd(c1_max, c2_max);
|
||||
if (res == SMALLER) return SMALLER;
|
||||
}
|
||||
// Compare slightly to the right near the boundary.
|
||||
typedef typename Self::Compare_y_near_boundary_2
|
||||
Compare_y_near_boundary_2;
|
||||
Compare_y_near_boundary_2 cmp_y_near_bnd =
|
||||
m_self.compare_y_near_boundary_2_object();
|
||||
res = cmp_y_near_bnd(c1, c2, CGAL::ARR_MIN_END);
|
||||
if (res != EQUAL) return res;
|
||||
|
||||
// The two curves overlap on their right.
|
||||
// Intersect them, and recursively compare the remaining portions,
|
||||
// respectively.
|
||||
return compare_remainder(c1, c2, intersections);
|
||||
}
|
||||
|
||||
CGAL_assertion(min_px1 == ARR_RIGHT_BOUNDARY);
|
||||
CGAL_assertion(min_px2 == ARR_RIGHT_BOUNDARY);
|
||||
// The min points of the two curves lie on the right boundary.
|
||||
// It implies that the entire curves lie on the right boundary, and
|
||||
// thus both are vertical.
|
||||
|
||||
typedef typename Self::Compare_y_on_boundary_2 Compare_y_on_boundary_2;
|
||||
Compare_y_on_boundary_2 cmp_y_on_bnd =
|
||||
m_self.compare_y_on_boundary_2_object();
|
||||
const Point_2& c1_min = m_self.construct_min_vertex_2_object()(c1);
|
||||
const Point_2& c2_min = m_self.construct_min_vertex_2_object()(c2);
|
||||
Comparison_result res = cmp_y_on_bnd(c1_min, c2_min);
|
||||
if (res != EQUAL) return res;
|
||||
|
||||
const Point_2& c1_max = m_self.construct_max_vertex_2_object()(c1);
|
||||
const Point_2& c2_max = m_self.construct_max_vertex_2_object()(c2);
|
||||
res = cmp_y_on_bnd(c1_max, c2_max);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
/*! Obtain a Compare_xy_2 function object */
|
||||
Compare_xy_2 compare_xy_2_object() const { return Compare_xy_2(*this); }
|
||||
|
||||
/*! A functor that tests whether two x-monotone curves can be merged. */
|
||||
class Are_mergeable_2 {
|
||||
public:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -15,11 +15,11 @@
|
|||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
//
|
||||
// Author(s) : Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
// (based on old version by Eyal Flato)
|
||||
//
|
||||
// Author(s): Ron Wein <wein@post.tau.ac.il>
|
||||
// Efi Fogel <efif@post.tau.ac.il>
|
||||
// (based on old version by Eyal Flato)
|
||||
|
||||
#ifndef CGAL_ARRANGEMENT_ZONE_2_H
|
||||
#define CGAL_ARRANGEMENT_ZONE_2_H
|
||||
|
|
@ -61,17 +61,14 @@ namespace CGAL {
|
|||
* by the visitor (if valid), and the Boolean value indicates whether we
|
||||
* should halt the zone-computation process.
|
||||
*/
|
||||
template <class Arrangement_, class ZoneVisitor_>
|
||||
class Arrangement_zone_2
|
||||
{
|
||||
template <typename Arrangement_, typename ZoneVisitor_>
|
||||
class Arrangement_zone_2 {
|
||||
public:
|
||||
|
||||
typedef Arrangement_ Arrangement_2;
|
||||
typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2;
|
||||
typedef typename Arrangement_2::Topology_traits Topology_traits;
|
||||
|
||||
protected:
|
||||
|
||||
typedef Arr_traits_adaptor_2<Geometry_traits_2> Traits_adaptor_2;
|
||||
|
||||
typedef typename Traits_adaptor_2::Left_side_category Left_side_category;
|
||||
|
|
@ -79,14 +76,13 @@ protected:
|
|||
typedef typename Traits_adaptor_2::Top_side_category Top_side_category;
|
||||
typedef typename Traits_adaptor_2::Right_side_category Right_side_category;
|
||||
|
||||
BOOST_MPL_ASSERT(
|
||||
(typename
|
||||
Arr_sane_identified_tagging< Left_side_category, Bottom_side_category,
|
||||
Top_side_category, Right_side_category >::result)
|
||||
);
|
||||
BOOST_MPL_ASSERT
|
||||
((typename Arr_sane_identified_tagging<Left_side_category,
|
||||
Bottom_side_category,
|
||||
Top_side_category,
|
||||
Right_side_category>::result));
|
||||
|
||||
public:
|
||||
|
||||
typedef ZoneVisitor_ Visitor;
|
||||
|
||||
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
|
||||
|
|
@ -100,194 +96,260 @@ public:
|
|||
typedef typename Geometry_traits_2::Multiplicity Multiplicity;
|
||||
|
||||
protected:
|
||||
|
||||
typedef typename Arr_are_all_sides_oblivious_tag<
|
||||
Left_side_category, Bottom_side_category,
|
||||
Top_side_category, Right_side_category >::result
|
||||
typedef typename Arr_are_all_sides_oblivious_tag<Left_side_category,
|
||||
Bottom_side_category,
|
||||
Top_side_category,
|
||||
Right_side_category>::result
|
||||
Are_all_sides_oblivious_category;
|
||||
|
||||
|
||||
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
|
||||
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
|
||||
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
|
||||
|
||||
// Types used for caching intersection points:
|
||||
typedef std::pair<Point_2,Multiplicity> Intersect_point_2;
|
||||
typedef std::list<CGAL::Object> Intersect_list;
|
||||
typedef std::map<const X_monotone_curve_2*,
|
||||
Intersect_list> Intersect_map;
|
||||
typedef typename Intersect_map::iterator Intersect_map_iterator;
|
||||
typedef typename Arrangement_2::Ccb_halfedge_circulator
|
||||
Ccb_halfedge_circulator;
|
||||
|
||||
typedef std::set<const X_monotone_curve_2*> Curves_set;
|
||||
typedef typename Curves_set::iterator Curves_set_iterator;
|
||||
// Types used for caching intersection points:
|
||||
typedef std::pair<Point_2, Multiplicity> Intersect_point_2;
|
||||
typedef std::list<CGAL::Object> Intersect_list;
|
||||
typedef std::map<const X_monotone_curve_2*, Intersect_list>
|
||||
Intersect_map;
|
||||
typedef typename Intersect_map::iterator Intersect_map_iterator;
|
||||
|
||||
typedef std::set<const X_monotone_curve_2*> Curves_set;
|
||||
typedef typename Curves_set::iterator Curves_set_iterator;
|
||||
|
||||
// Data members:
|
||||
Arrangement_2& arr; // The associated arrangement.
|
||||
const Traits_adaptor_2 * m_geom_traits; // Its associated geometry traits.
|
||||
Arr_accessor<Arrangement_2> arr_access; // An accessor for the arrangement.
|
||||
|
||||
Visitor *visitor; // The zone visitor.
|
||||
Arrangement_2& m_arr; // The associated arrangement.
|
||||
const Traits_adaptor_2* m_geom_traits; // Its associated geometry traits.
|
||||
Arr_accessor<Arrangement_2> m_arr_access; // An accessor for the arrangement.
|
||||
|
||||
Intersect_map inter_map; // Stores all computed intersections.
|
||||
Visitor* m_visitor; // The zone visitor.
|
||||
|
||||
const Vertex_handle invalid_v; // An invalid vertex handle.
|
||||
const Halfedge_handle invalid_he; // An invalid halfedge handle.
|
||||
Intersect_map m_inter_map; // Stores all computed intersections.
|
||||
|
||||
X_monotone_curve_2 cv; // The current portion of the
|
||||
const Vertex_handle m_invalid_v; // An invalid vertex handle.
|
||||
const Halfedge_handle m_invalid_he; // An invalid halfedge handle.
|
||||
|
||||
X_monotone_curve_2 m_cv; // The current portion of the
|
||||
// inserted curve.
|
||||
CGAL::Object obj; // The location of the left endpoint.
|
||||
bool has_left_pt; // Is the left end of the curve
|
||||
// bounded.
|
||||
bool left_on_boundary; // Is the left point on the boundary.
|
||||
Point_2 left_pt; // Its current left endpoint.
|
||||
bool has_right_pt; // Is the right end of the curve
|
||||
// bounded.
|
||||
bool right_on_boundary;// Is the right point on the boundary.
|
||||
Point_2 right_pt; // Its right endpoint (if bounded).
|
||||
CGAL::Object m_obj; // The location of the left endpoint.
|
||||
bool m_has_left_pt; // Is the left end of the curve bounded.
|
||||
bool m_left_on_boundary; // Is the left point on the boundary.
|
||||
Point_2 m_left_pt; // Its current left endpoint.
|
||||
bool m_has_right_pt; // Is the right end of the curve bounded.
|
||||
bool m_right_on_boundary; // Is the right point on the boundary.
|
||||
Point_2 m_right_pt; // Its right endpoint (if bounded).
|
||||
|
||||
Vertex_handle left_v; // The arrangement vertex associated
|
||||
Vertex_handle m_left_v; // The arrangement vertex associated
|
||||
// with the current left_pt (if any).
|
||||
Halfedge_handle left_he; // If left_v is valid, left_he is the
|
||||
Halfedge_handle m_left_he; // If left_v is valid, left_he is the
|
||||
// predecessor for cv around this
|
||||
// vertex. Otherwise, if it is valid,
|
||||
// it is the halfedge that contains
|
||||
// the left endpoint it its interior.
|
||||
|
||||
Vertex_handle right_v; // The arrangement vertex associated
|
||||
// with the current right_pt (if any).
|
||||
Halfedge_handle right_he; // If right_v is valid, left_he is the
|
||||
Vertex_handle m_right_v; // The arrangement vertex associated
|
||||
// with the current m_right_pt (if any).
|
||||
Halfedge_handle m_right_he; // If m_right_v is valid, left_he is the
|
||||
// predecessor for cv around this
|
||||
// vertex. Otherwise, if it is valid,
|
||||
// it is the halfedge that contains
|
||||
// the right endpoint it its interior.
|
||||
|
||||
Point_2 intersect_p; // The next intersection point.
|
||||
unsigned int ip_mult; // Its multiplicity
|
||||
Point_2 m_intersect_p; // The next intersection point.
|
||||
unsigned int m_ip_multiplicity; // Its multiplicity
|
||||
// (0 in case of an overlap).
|
||||
bool found_intersect; // Have we found an intersection
|
||||
bool m_found_intersect; // An intersection has been found.
|
||||
// (or an overlap).
|
||||
X_monotone_curve_2 overlap_cv; // The currently discovered overlap.
|
||||
bool found_overlap; // Have we found an overlap.
|
||||
bool found_iso_vert; // Check if an isolated vertex induces
|
||||
// the next intersection.
|
||||
Vertex_handle intersect_v; // The vertex that intersects cv.
|
||||
Halfedge_handle intersect_he; // The halfedge that intersects cv
|
||||
X_monotone_curve_2 m_overlap_cv; // The currently discovered overlap.
|
||||
bool m_found_overlap; // An overlap has been found.
|
||||
bool m_found_iso_vert; // Check whether an isolated vertex
|
||||
// induces the next intersection.
|
||||
Vertex_handle m_intersect_v; // The vertex that intersects cv.
|
||||
Halfedge_handle m_intersect_he; // The halfedge that intersects cv
|
||||
// (or overlaps it).
|
||||
|
||||
X_monotone_curve_2 sub_cv1; // Auxiliary variable (for curve split).
|
||||
X_monotone_curve_2 sub_cv2; // Auxiliary variable (for curve split).
|
||||
X_monotone_curve_2 m_sub_cv1; // Auxiliary variable (for curve split).
|
||||
X_monotone_curve_2 m_sub_cv2; // Auxiliary variable (for curve split).
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* Constructor.
|
||||
/*! Constructor.
|
||||
* \param _arr The arrangement for which we compute the zone.
|
||||
* \param _visitor A pointer to a zone-visitor object.
|
||||
*/
|
||||
Arrangement_zone_2 (Arrangement_2& _arr, Visitor *_visitor) :
|
||||
arr (_arr),
|
||||
arr_access (_arr),
|
||||
visitor (_visitor),
|
||||
invalid_v (),
|
||||
invalid_he ()
|
||||
Arrangement_zone_2(Arrangement_2& arr, Visitor* visitor) :
|
||||
m_arr(arr),
|
||||
m_arr_access(arr),
|
||||
m_visitor(visitor),
|
||||
m_invalid_v(),
|
||||
m_invalid_he()
|
||||
{
|
||||
m_geom_traits = static_cast<const Traits_adaptor_2*> (arr.geometry_traits());
|
||||
|
||||
CGAL_assertion (visitor != NULL);
|
||||
m_geom_traits = static_cast<const Traits_adaptor_2*>(arr.geometry_traits());
|
||||
CGAL_assertion(visitor != NULL);
|
||||
|
||||
// Initialize the visitor.
|
||||
visitor->init (&arr);
|
||||
visitor->init(&arr);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Initialize the zone-computation process with a given curve.
|
||||
/*! Initialize the zone-computation process with a given curve.
|
||||
* \param _cv The query curve.
|
||||
* \param pl A point-location object associated with the arrangement.
|
||||
*/
|
||||
template <class PointLocation>
|
||||
void init (const X_monotone_curve_2& _cv, const PointLocation& pl)
|
||||
template <typename PointLocation>
|
||||
void init(const X_monotone_curve_2& cv, const PointLocation& pl)
|
||||
{
|
||||
// Set the curve and check whether its left end has boundary conditions.
|
||||
cv = _cv;
|
||||
m_cv = cv;
|
||||
|
||||
const Arr_parameter_space bx1 =
|
||||
m_geom_traits->parameter_space_in_x_2_object()(cv, ARR_MIN_END);
|
||||
const Arr_parameter_space by1 =
|
||||
m_geom_traits->parameter_space_in_y_2_object()(cv, ARR_MIN_END);
|
||||
const Arr_parameter_space bx1 =
|
||||
m_geom_traits->parameter_space_in_x_2_object()(m_cv, ARR_MIN_END);
|
||||
const Arr_parameter_space by1 =
|
||||
m_geom_traits->parameter_space_in_y_2_object()(m_cv, ARR_MIN_END);
|
||||
|
||||
if (bx1 == ARR_INTERIOR && by1 == ARR_INTERIOR) {
|
||||
// The curve has a finite left endpoint with no boundary conditions:
|
||||
// locate it in the arrangement.
|
||||
has_left_pt = true;
|
||||
left_on_boundary = (bx1 != ARR_INTERIOR || by1 != ARR_INTERIOR);
|
||||
left_pt = m_geom_traits->construct_min_vertex_2_object() (cv);
|
||||
m_has_left_pt = true;
|
||||
m_left_on_boundary = (bx1 != ARR_INTERIOR || by1 != ARR_INTERIOR);
|
||||
m_left_pt = m_geom_traits->construct_min_vertex_2_object()(m_cv);
|
||||
|
||||
obj = pl.locate (left_pt);
|
||||
m_obj = pl.locate(m_left_pt);
|
||||
}
|
||||
else {
|
||||
// The left end of the curve has boundary conditions: use the topology
|
||||
// traits use the arrangement accessor to locate it.
|
||||
// Note that if the curve-end is unbounded, left_pt does not exist.
|
||||
// Note that if the curve-end is unbounded, left_pt does not exist.
|
||||
has_left_pt = m_geom_traits->is_closed_2_object()(cv, ARR_MIN_END);
|
||||
left_on_boundary = true;
|
||||
if (has_left_pt)
|
||||
left_pt = m_geom_traits->construct_min_vertex_2_object() (cv);
|
||||
obj = arr_access.locate_curve_end (cv, ARR_MIN_END, bx1, by1);
|
||||
// Note that if the curve-end is unbounded, m_left_pt does not exist.
|
||||
// Note that if the curve-end is unbounded, m_left_pt does not exist.
|
||||
m_has_left_pt = m_geom_traits->is_closed_2_object()(m_cv, ARR_MIN_END);
|
||||
m_left_on_boundary = true;
|
||||
if (m_has_left_pt)
|
||||
m_left_pt = m_geom_traits->construct_min_vertex_2_object()(m_cv);
|
||||
m_obj = m_arr_access.locate_curve_end(m_cv, ARR_MIN_END, bx1, by1);
|
||||
}
|
||||
|
||||
// Check the boundary conditions of th right curve end.
|
||||
if (m_geom_traits->is_closed_2_object()(cv, ARR_MAX_END)) {
|
||||
const Arr_parameter_space bx2 =
|
||||
m_geom_traits->parameter_space_in_x_2_object()(cv, ARR_MAX_END);
|
||||
const Arr_parameter_space by2 =
|
||||
m_geom_traits->parameter_space_in_y_2_object()(cv, ARR_MAX_END);
|
||||
if (m_geom_traits->is_closed_2_object()(m_cv, ARR_MAX_END)) {
|
||||
const Arr_parameter_space bx2 =
|
||||
m_geom_traits->parameter_space_in_x_2_object()(m_cv, ARR_MAX_END);
|
||||
const Arr_parameter_space by2 =
|
||||
m_geom_traits->parameter_space_in_y_2_object()(m_cv, ARR_MAX_END);
|
||||
|
||||
// The right endpoint is valid.
|
||||
has_right_pt = true;
|
||||
right_pt = m_geom_traits->construct_max_vertex_2_object() (cv);
|
||||
right_on_boundary = (bx2 != ARR_INTERIOR) || (by2 != ARR_INTERIOR);
|
||||
m_has_right_pt = true;
|
||||
m_right_pt = m_geom_traits->construct_max_vertex_2_object()(m_cv);
|
||||
m_right_on_boundary = (bx2 != ARR_INTERIOR) || (by2 != ARR_INTERIOR);
|
||||
}
|
||||
else {
|
||||
// The right end of the curve lies at infinity.
|
||||
has_right_pt = false;
|
||||
right_on_boundary = true;
|
||||
m_has_right_pt = false;
|
||||
m_right_on_boundary = true;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Initialize the zone-computation process with a given curve and an object
|
||||
/*! Initialize the zone-computation process with a given curve and an object
|
||||
* that wraps the location of the curve's left end.
|
||||
* \param _cv The query curve.
|
||||
* \param _obj An object that represents the location of the left end
|
||||
* of the curve.
|
||||
* \param cv The query curve.
|
||||
* \param obj An object that represents the location of the left end of the
|
||||
* curve.
|
||||
*/
|
||||
void init_with_hint (const X_monotone_curve_2& _cv, const Object& _obj);
|
||||
void init_with_hint(const X_monotone_curve_2& cv, const Object& obj);
|
||||
|
||||
/*!
|
||||
* Compute the zone of the given curve and issue the apporpriate
|
||||
/*! Compute the zone of the given curve and issue the apporpriate
|
||||
* notifications for the visitor.
|
||||
*/
|
||||
void compute_zone ();
|
||||
void compute_zone();
|
||||
|
||||
private:
|
||||
/*! Check whether two curves with a common endpoint overlap.
|
||||
* \pre p == min_point(cv1)
|
||||
* \pre p == min_point(cv2)
|
||||
* \todo move this function to a more accessible place so that it can be reused
|
||||
*/
|
||||
bool do_overlap(const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2,
|
||||
const Point_2& p) const
|
||||
{ return do_overlap_impl(cv1, cv2, p, Are_all_sides_oblivious_category()); }
|
||||
|
||||
/*!
|
||||
* Find a face containing the query curve cv around the given vertex.
|
||||
* In case an overlap occurs, sets intersect_he to be the overlapping edge.
|
||||
/*! Check whether two curves with a common min endpoint overlap.
|
||||
*/
|
||||
bool do_overlap_impl(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
const Point_2& p, Arr_all_sides_oblivious_tag) const
|
||||
{
|
||||
return m_geom_traits->compare_y_at_x_right_2_object()(cv1, cv2, p) == EQUAL;
|
||||
}
|
||||
|
||||
/*! Check whether two curves with a common min endpoint overlap.
|
||||
*/
|
||||
bool do_overlap_impl(const X_monotone_curve_2& cv1,
|
||||
const X_monotone_curve_2& cv2,
|
||||
const Point_2& p, Arr_not_all_sides_oblivious_tag) const;
|
||||
|
||||
/* Check whether the given query curve is encountered when rotating the
|
||||
* first curve in a clockwise direction around a given point until reaching
|
||||
* the second curve.
|
||||
* \pre p == min_point(xcv)
|
||||
* \pre p == min_point(xcv1)
|
||||
* \pre p == min_point(cxv2)
|
||||
* \pre xcv_to_right == TRUE
|
||||
* \todo move this function to a more accessible place so that it can be reused
|
||||
*/
|
||||
bool is_between_cw(const X_monotone_curve_2& xcv, bool xcv_to_right,
|
||||
const X_monotone_curve_2& xcv1, bool xcv1_to_right,
|
||||
const X_monotone_curve_2& xcv2, bool xcv2_to_right,
|
||||
const Point_2& p,
|
||||
bool& xcv_equal_xcv1, bool& xcv_equal_xcv2) const
|
||||
{
|
||||
return is_between_cw_impl(xcv, xcv_to_right,
|
||||
xcv1, xcv1_to_right,
|
||||
xcv2, xcv2_to_right,
|
||||
p, xcv_equal_xcv1, xcv_equal_xcv2,
|
||||
Are_all_sides_oblivious_category());
|
||||
}
|
||||
|
||||
/* Check whether the given query curve is encountered when rotating the
|
||||
* first curve in a clockwise direction around a given point until reaching
|
||||
* the second curve.
|
||||
*/
|
||||
bool is_between_cw_impl(const X_monotone_curve_2& xcv, bool xcv_to_right,
|
||||
const X_monotone_curve_2& xcv1, bool xcv1_to_right,
|
||||
const X_monotone_curve_2& xcv2, bool xcv2_to_right,
|
||||
const Point_2& p,
|
||||
bool& xcv_equal_xcv1, bool& xcv_equal_xcv2,
|
||||
Arr_all_sides_oblivious_tag) const
|
||||
{
|
||||
return m_geom_traits->is_between_cw_2_object()(xcv, xcv_to_right,
|
||||
xcv1, xcv1_to_right,
|
||||
xcv2, xcv2_to_right,
|
||||
p,
|
||||
xcv_equal_xcv1,
|
||||
xcv_equal_xcv2);
|
||||
}
|
||||
|
||||
/* Check whether the given query curve is encountered when rotating the
|
||||
* first curve in a clockwise direction around a given point until reaching
|
||||
* the second curve.
|
||||
*/
|
||||
bool is_between_cw_impl(const X_monotone_curve_2& xcv, bool xcv_to_right,
|
||||
const X_monotone_curve_2& xcv1, bool xcv1_to_right,
|
||||
const X_monotone_curve_2& xcv2, bool xcv2_to_right,
|
||||
const Point_2& p,
|
||||
bool& xcv_equal_xcv1, bool& xcv_equal_xcv2,
|
||||
Arr_not_all_sides_oblivious_tag) const;
|
||||
|
||||
/*! Find a face containing the query curve m_cv around the given vertex.
|
||||
* In case an overlap occurs, sets m_intersect_he to be the overlapping edge.
|
||||
* \param v The query vertex.
|
||||
* \param he Output: The predecessor of cv around the vertex.
|
||||
* \return (true) if cv overlaps with the curve associated with he;
|
||||
* \param he Output: The predecessor of m_cv around the vertex.
|
||||
* \return (true) if m_cv overlaps with the curve associated with he;
|
||||
* (false) if there is no overlap.
|
||||
*/
|
||||
bool _find_prev_around_vertex (Vertex_handle v, Halfedge_handle& he);
|
||||
bool _find_prev_around_vertex(Vertex_handle v, Halfedge_handle& he);
|
||||
|
||||
/*!
|
||||
* Direct the halfedge for the location of the given subcurve around a split
|
||||
/*! Direct the halfedge for the location of the given subcurve around a split
|
||||
* point that occurs in the interior of a given edge, when the subcurve lies
|
||||
* to the right of the split point.
|
||||
* In case of overlaps, it sets also found_overlap and intersect_he.
|
||||
* In case of overlaps, it sets also m_found_overlap and m_intersect_he.
|
||||
* \param cv_ins The curve to be inserted, whose left endpoint coincides
|
||||
* with the edge to be split.
|
||||
* \param cv_left_pt The left endpoint of cv_ins.
|
||||
|
|
@ -302,8 +364,7 @@ private:
|
|||
const Point_2& cv_left_pt,
|
||||
Halfedge_handle query_he);
|
||||
|
||||
/*!
|
||||
* Direct the halfedge for the location of the given subcurve around a split
|
||||
/*! Direct the halfedge for the location of the given subcurve around a split
|
||||
* point that occurs in the interior of a given edge, when the subcurve lies
|
||||
* to the left of the split point.
|
||||
* \param cv_ins The curve to be inserted, whose right endpoint coincides
|
||||
|
|
@ -318,8 +379,7 @@ private:
|
|||
_direct_intersecting_edge_to_left(const X_monotone_curve_2& cv_ins,
|
||||
Halfedge_handle query_he);
|
||||
|
||||
/*!
|
||||
* Get the next intersection of cv with the given halfedge.
|
||||
/*! Get the next intersection of m_cv with the given halfedge.
|
||||
* \param he A handle to the halfedge.
|
||||
* \param skip_first_point Should we skip the first intersection point.
|
||||
* \param intersect_on_right_boundary Output: If an intersetion point is
|
||||
|
|
@ -332,20 +392,19 @@ private:
|
|||
* case of an overlap, and an empty object if there is no
|
||||
* intersection.
|
||||
*/
|
||||
CGAL::Object _compute_next_intersection (Halfedge_handle he,
|
||||
bool skip_first_point,
|
||||
bool& intersect_on_right_boundary);
|
||||
CGAL::Object _compute_next_intersection(Halfedge_handle he,
|
||||
bool skip_first_point,
|
||||
bool& intersect_on_right_boundary);
|
||||
|
||||
/*!
|
||||
* Remove the next intersection of cv with the given halfedge from the map.
|
||||
/*! Remove the next intersection of m_cv with the given halfedge from the map.
|
||||
* \param he A handle to the halfedge.
|
||||
* \pre The list of intersections with the curve of he has already been
|
||||
* computed, and it is not empty.
|
||||
*/
|
||||
void _remove_next_intersection (Halfedge_handle he);
|
||||
|
||||
/*!
|
||||
* Check if the given point lies completely to the left of the given egde.
|
||||
/*! Check whether the given point lies completely to the left of the given
|
||||
* egde.
|
||||
* \param p The point.
|
||||
* \param he The halfedge.
|
||||
* \pre he is not a fictitious edge.
|
||||
|
|
@ -359,19 +418,19 @@ private:
|
|||
bool _is_to_left_impl(const Point_2& p, Halfedge_handle he,
|
||||
Arr_all_sides_oblivious_tag) const
|
||||
{
|
||||
return ((he->direction() == ARR_LEFT_TO_RIGHT &&
|
||||
m_geom_traits->compare_xy_2_object()
|
||||
return (((he->direction() == ARR_LEFT_TO_RIGHT) &&
|
||||
m_geom_traits->compare_xy_2_object()
|
||||
(p, he->source()->point()) == SMALLER) ||
|
||||
(he->direction() == ARR_RIGHT_TO_LEFT &&
|
||||
m_geom_traits->compare_xy_2_object()
|
||||
m_geom_traits->compare_xy_2_object()
|
||||
(p, he->target()->point()) == SMALLER));
|
||||
}
|
||||
|
||||
bool _is_to_left_impl(const Point_2& p, Halfedge_handle he,
|
||||
Arr_not_all_sides_oblivious_tag) const;
|
||||
|
||||
/*!
|
||||
* Check if the given point lies completely to the right of the given egde.
|
||||
|
||||
/*! Check whether the given point lies completely to the right of the given
|
||||
* egde.
|
||||
* \param p The point.
|
||||
* \param he The halfedge.
|
||||
* \pre he is not a fictitious edge.
|
||||
|
|
@ -385,59 +444,62 @@ private:
|
|||
bool _is_to_right_impl(const Point_2& p, Halfedge_handle he,
|
||||
Arr_all_sides_oblivious_tag) const
|
||||
{
|
||||
return ((he->direction() == ARR_LEFT_TO_RIGHT &&
|
||||
m_geom_traits->compare_xy_2_object()
|
||||
(p, he->target()->point()) == LARGER) ||
|
||||
(he->direction() == ARR_RIGHT_TO_LEFT &&
|
||||
m_geom_traits->compare_xy_2_object()
|
||||
(p, he->source()->point()) == LARGER));
|
||||
return (((he->direction() == ARR_LEFT_TO_RIGHT) &&
|
||||
m_geom_traits->compare_xy_2_object()(p, he->target()->point()) ==
|
||||
LARGER) ||
|
||||
((he->direction() == ARR_RIGHT_TO_LEFT) &&
|
||||
m_geom_traits->compare_xy_2_object()(p, he->source()->point()) ==
|
||||
LARGER));
|
||||
}
|
||||
|
||||
bool _is_to_right_impl(const Point_2& p, Halfedge_handle he,
|
||||
Arr_not_all_sides_oblivious_tag) const;
|
||||
|
||||
/*!
|
||||
* Compute the (lexicographically) leftmost intersection of the query
|
||||
/*! Compute the (lexicographically) leftmost intersection of the query
|
||||
* curve with a given halfedge on the boundary of a face in the arrangement.
|
||||
*/
|
||||
void
|
||||
_leftmost_intersection(Ccb_halfedge_circulator he_curr, bool on_boundary,
|
||||
bool& leftmost_on_right_boundary);
|
||||
|
||||
/*! Compute the (lexicographically) leftmost intersection of the query
|
||||
* curve with the boundary of a given face in the arrangement.
|
||||
* The function computes sets intersect_p, intersect_he (or alternatively
|
||||
* overlap_cv and intersect_he) and set the flags found_intersect and
|
||||
* found_overlap accordingly.
|
||||
* The function computes sets m_intersect_p, m_intersect_he (or alternatively
|
||||
* m_overlap_cv and m_intersect_he) and set the flags m_found_intersect and
|
||||
* m_found_overlap accordingly.
|
||||
* \param face A handle to the face.
|
||||
* \param on_boundary Specifies whether the left endpoint of the curve lies
|
||||
* on the face boundary.
|
||||
*/
|
||||
void _leftmost_intersection_with_face_boundary (Face_handle face,
|
||||
bool on_boundary);
|
||||
void _leftmost_intersection_with_face_boundary(Face_handle face,
|
||||
bool on_boundary);
|
||||
|
||||
/*!
|
||||
* Compute the zone of an x-monotone curve in a given arrangement face.
|
||||
/*! Compute the zone of an x-monotone curve in a given arrangement face.
|
||||
* The left endpoint of the curve either lies in the face interior or on
|
||||
* the boundary of the face.
|
||||
* This function updates cv and its left endpoint and also sets left_v
|
||||
* and left_he for the remaining portion of the curve.
|
||||
* In case of overlaps, it sets also overlap_cv and intersect_he.
|
||||
* This function updates m_cv and its left endpoint and also sets m_left_v
|
||||
* and m_left_he for the remaining portion of the curve.
|
||||
* In case of overlaps, it sets also m_overlap_cv and m_intersect_he.
|
||||
* \param face The given face.
|
||||
* \param on_boundary Specifies whether the left endpoint of the curve lies
|
||||
* on the face boundary.
|
||||
* \pre If on_boundary is (true) then left_he must be valid; if it is (false)
|
||||
* then both left_v anf left_he must be invalid.
|
||||
* \pre If on_boundary is (true) then m_left_he must be valid; if it is
|
||||
* (false), then both m_left_v anf m_left_he must be invalid.
|
||||
* \return (true) if we are done with the zone-computation process;
|
||||
* (false) if we still have a remaining portion of cv to continue
|
||||
* (false) if we still have a remaining portion of m_cv to continue
|
||||
* with.
|
||||
*/
|
||||
bool _zone_in_face (Face_handle face,
|
||||
bool on_boundary);
|
||||
bool _zone_in_face(Face_handle face, bool on_boundary);
|
||||
|
||||
/*!
|
||||
* Compute the zone of an overlapping subcurve overlap_cv of cv and the
|
||||
* curve currently associated with intersect_he.
|
||||
* This function updates cv and its left endpoint and also sets left_v
|
||||
* and left_he for the remaining portion of the curve.
|
||||
/*! Compute the zone of an overlapping subcurve m_overlap_cv of m_cv and the
|
||||
* curve currently associated with m_intersect_he.
|
||||
* This function updates m_cv and its left endpoint and also sets m_left_v
|
||||
* and m_left_he for the remaining portion of the curve.
|
||||
* \return (true) if we are done with the zone-computation process;
|
||||
* (false) if we still have a remaining portion of cv to continue
|
||||
* (false) if we still have a remaining portion of m_cv to continue
|
||||
* with.
|
||||
*/
|
||||
bool _zone_in_overlap ();
|
||||
bool _zone_in_overlap();
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -270,10 +270,9 @@ bool Construction_test<T_Geom_traits, T_Topol_traits>::are_same_results()
|
|||
typename Xcurve_container::iterator xcit = curves_res.begin();
|
||||
|
||||
Edge_const_iterator eit;
|
||||
for (eit = m_arr->edges_begin(); eit != m_arr->edges_end(); ++eit) {
|
||||
if (is_interior(eit->source()) && is_interior(eit->target()))
|
||||
*xcit++ = eit->curve();
|
||||
}
|
||||
for (eit = m_arr->edges_begin(); eit != m_arr->edges_end(); ++eit)
|
||||
*xcit++ = eit->curve();
|
||||
|
||||
Curve_compare<Geom_traits> curve_compare(m_geom_traits);
|
||||
std::sort(curves_res.begin(), xcit, curve_compare);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,17 +6,20 @@
|
|||
|
||||
#include "Traits_base_test.h"
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
class Traits_adaptor_test :
|
||||
public Traits_base_test<typename Geom_traits_T::Base>
|
||||
public Traits_base_test<BaseGeomTraits>
|
||||
{
|
||||
public:
|
||||
typedef Geom_traits_T Geom_traits;
|
||||
typedef Traits_base_test<typename Geom_traits::Base> Base;
|
||||
typedef GeomTraits Geom_traits;
|
||||
typedef BaseGeomTraits Base_geom_traits;
|
||||
typedef Traits_base_test<Base_geom_traits> Base;
|
||||
|
||||
private:
|
||||
typedef Traits_adaptor_test<Geom_traits, Base_geom_traits> Self;
|
||||
|
||||
/*! A map between (strings) commands and (member functions) operations */
|
||||
typedef bool (Traits_adaptor_test::* Wrapper)(std::istringstream &);
|
||||
typedef bool (Traits_adaptor_test::* Wrapper)(std::istringstream&);
|
||||
typedef std::map<std::string, Wrapper> Wrapper_map;
|
||||
typedef typename Wrapper_map::iterator Wrapper_iter;
|
||||
Wrapper_map m_wrappers;
|
||||
|
|
@ -34,6 +37,8 @@ private:
|
|||
}
|
||||
|
||||
//@{
|
||||
bool ta_compare_xy(std::istringstream&);
|
||||
bool ta_compare_xy_imp(std::istringstream&);
|
||||
|
||||
bool ta_compare_y_at_x_left_wrapper(std::istringstream&);
|
||||
bool ta_compare_y_at_x_left_wrapper_imp(std::istringstream&,
|
||||
|
|
@ -61,67 +66,78 @@ protected:
|
|||
const Geom_traits& m_geom_traits;
|
||||
|
||||
public:
|
||||
/*! Constructor */
|
||||
/*! Construct.
|
||||
*/
|
||||
Traits_adaptor_test(const Geom_traits& geom_traits);
|
||||
|
||||
/*! Destructor */
|
||||
/*! Destruct.
|
||||
*/
|
||||
virtual ~Traits_adaptor_test();
|
||||
};
|
||||
|
||||
/*!
|
||||
* Constructor.
|
||||
/*! Construct.
|
||||
* Accepts test data file name.
|
||||
*/
|
||||
template <typename Geom_traits_T>
|
||||
Traits_adaptor_test<Geom_traits_T>::
|
||||
Traits_adaptor_test(const Geom_traits_T& geom_traits) :
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
Traits_adaptor_test(const GeomTraits& geom_traits) :
|
||||
Base(geom_traits),
|
||||
m_geom_traits(geom_traits)
|
||||
{
|
||||
typedef Geom_traits_T Geom_traits;
|
||||
|
||||
m_wrappers[std::string("compare_xy")] = &Self::ta_compare_xy;
|
||||
m_wrappers[std::string("compare_y_at_x_left")] =
|
||||
&Traits_adaptor_test<Geom_traits>::ta_compare_y_at_x_left_wrapper;
|
||||
m_wrappers[std::string("is_in_x_range")] =
|
||||
&Traits_adaptor_test<Geom_traits>::ta_is_in_x_range_wrapper;
|
||||
&Self::ta_compare_y_at_x_left_wrapper;
|
||||
m_wrappers[std::string("is_in_x_range")] = &Self::ta_is_in_x_range_wrapper;
|
||||
m_wrappers[std::string("compare_y_position")] =
|
||||
&Traits_adaptor_test<Geom_traits>::ta_compare_y_position_wrapper;
|
||||
m_wrappers[std::string("is_between_cw")] =
|
||||
&Traits_adaptor_test<Geom_traits>::ta_is_between_cw_wrapper;
|
||||
&Self::ta_compare_y_position_wrapper;
|
||||
m_wrappers[std::string("is_between_cw")] = &Self::ta_is_between_cw_wrapper;
|
||||
m_wrappers[std::string("compare_cw_around_point")] =
|
||||
&Traits_adaptor_test<Geom_traits>::ta_compare_cw_around_point_wrapper;
|
||||
m_wrappers[std::string("are_mergeable")] =
|
||||
&Traits_adaptor_test<Geom_traits>::ta_are_mergeable_wrapper;
|
||||
m_wrappers[std::string("merge")] =
|
||||
&Traits_adaptor_test<Geom_traits>::ta_merge_wrapper;
|
||||
&Self::ta_compare_cw_around_point_wrapper;
|
||||
m_wrappers[std::string("are_mergeable")] = &Self::ta_are_mergeable_wrapper;
|
||||
m_wrappers[std::string("merge")] = &Self::ta_merge_wrapper;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Destructor.
|
||||
/*! Destruct.
|
||||
* Declares as virtual.
|
||||
*/
|
||||
template <typename Geom_traits_T>
|
||||
Traits_adaptor_test<Geom_traits_T>::~Traits_adaptor_test() {}
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
Traits_adaptor_test<GeomTraits, BaseGeomTraits>::~Traits_adaptor_test() {}
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
bool Traits_adaptor_test<Geom_traits_T>::
|
||||
ta_compare_y_at_x_left_wrapper(std::istringstream & str_stream)
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
ta_compare_xy(std::istringstream& str_stream)
|
||||
{
|
||||
typedef typename Geom_traits_T::Has_left_category Has_left_category;
|
||||
unsigned int id1, id2;
|
||||
str_stream >> id1 >> id2;
|
||||
unsigned int exp_answer = this->get_expected_enum(str_stream);
|
||||
std::cout << "Test: compare_xy( " << this->m_xcurves[id1]
|
||||
<< "," << this->m_xcurves[id2] << " ) ? " << exp_answer << " ";
|
||||
|
||||
unsigned int real_answer =
|
||||
m_geom_traits.compare_xy_2_object()(this->m_xcurves[id1] ,
|
||||
this->m_xcurves[id2]);
|
||||
return this->compare(exp_answer, real_answer);
|
||||
}
|
||||
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
ta_compare_y_at_x_left_wrapper(std::istringstream& str_stream)
|
||||
{
|
||||
typedef typename Geom_traits::Has_left_category Has_left_category;
|
||||
return ta_compare_y_at_x_left_wrapper_imp(str_stream, Has_left_category());
|
||||
}
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
bool Traits_adaptor_test<Geom_traits_T>::
|
||||
ta_compare_y_at_x_left_wrapper_imp(std::istringstream &, CGAL::Tag_false)
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
ta_compare_y_at_x_left_wrapper_imp(std::istringstream&, CGAL::Tag_false)
|
||||
{
|
||||
CGAL_error();
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
bool Traits_adaptor_test<Geom_traits_T>::
|
||||
ta_compare_y_at_x_left_wrapper_imp(std::istringstream & str_stream,
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
ta_compare_y_at_x_left_wrapper_imp(std::istringstream& str_stream,
|
||||
CGAL::Tag_true)
|
||||
{
|
||||
unsigned int id1, id2, id3;
|
||||
|
|
@ -138,21 +154,18 @@ ta_compare_y_at_x_left_wrapper_imp(std::istringstream & str_stream,
|
|||
return this->compare(exp_answer, real_answer);
|
||||
}
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
bool Traits_adaptor_test<Geom_traits_T>::
|
||||
ta_is_in_x_range_wrapper(std::istringstream & str_stream)
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
ta_is_in_x_range_wrapper(std::istringstream& str_stream)
|
||||
{
|
||||
unsigned int id1, id2;
|
||||
char c;
|
||||
str_stream >> c >> id1 >> id2;
|
||||
bool exp_answer = this->get_expected_boolean(str_stream);
|
||||
std::cout << "Test: is_in_x_range( " << this->m_xcurves[id1] << ",";
|
||||
if (c == 'p')
|
||||
std::cout << this->m_points[id2];
|
||||
else if (c == 'x')
|
||||
std::cout << this->m_xcurves[id2];
|
||||
else
|
||||
CGAL_error();
|
||||
if (c == 'p') std::cout << this->m_points[id2];
|
||||
else if (c == 'x') std::cout << this->m_xcurves[id2];
|
||||
else CGAL_error();
|
||||
std::cout << " ) ? " << " ";
|
||||
|
||||
bool real_answer = (c == 'p') ?
|
||||
|
|
@ -163,9 +176,9 @@ ta_is_in_x_range_wrapper(std::istringstream & str_stream)
|
|||
return this->compare(exp_answer, real_answer);
|
||||
}
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
bool Traits_adaptor_test<Geom_traits_T>::
|
||||
ta_compare_y_position_wrapper(std::istringstream & str_stream)
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
ta_compare_y_position_wrapper(std::istringstream& str_stream)
|
||||
{
|
||||
unsigned int id1, id2;
|
||||
str_stream >> id1 >> id2;
|
||||
|
|
@ -179,9 +192,9 @@ ta_compare_y_position_wrapper(std::istringstream & str_stream)
|
|||
return this->compare(exp_answer, real_answer);
|
||||
}
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
bool Traits_adaptor_test<Geom_traits_T>::
|
||||
ta_is_between_cw_wrapper(std::istringstream & str_stream)
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
ta_is_between_cw_wrapper(std::istringstream& str_stream)
|
||||
{
|
||||
unsigned int xcv , b , xcv1 , b1 , xcv2 , b2 , p;
|
||||
//note that b_ref1 b_ref2 are outputs so they can be tested also
|
||||
|
|
@ -205,9 +218,9 @@ ta_is_between_cw_wrapper(std::istringstream & str_stream)
|
|||
return this->compare(exp_answer, real_answer);
|
||||
}
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
bool Traits_adaptor_test<Geom_traits_T>::
|
||||
ta_compare_cw_around_point_wrapper(std::istringstream & str_stream)
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
ta_compare_cw_around_point_wrapper(std::istringstream& str_stream)
|
||||
{
|
||||
unsigned int xcv1 , b1 , xcv2 , b2 , p , b3;
|
||||
str_stream >> xcv1 >> b1 >> xcv2 >> b2 >> p >> b3;
|
||||
|
|
@ -231,25 +244,25 @@ ta_compare_cw_around_point_wrapper(std::istringstream & str_stream)
|
|||
return this->compare(exp_answer, real_answer);
|
||||
}
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
bool Traits_adaptor_test<Geom_traits_T>::
|
||||
ta_are_mergeable_wrapper(std::istringstream & str_stream)
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
ta_are_mergeable_wrapper(std::istringstream& str_stream)
|
||||
{
|
||||
typedef typename Geom_traits_T::Has_merge_category Has_merge_category;
|
||||
typedef typename GeomTraits::Has_merge_category Has_merge_category;
|
||||
return ta_are_mergeable_wrapper_imp(str_stream, Has_merge_category());
|
||||
}
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
bool Traits_adaptor_test<Geom_traits_T>::
|
||||
ta_are_mergeable_wrapper_imp(std::istringstream &, CGAL::Tag_false)
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
ta_are_mergeable_wrapper_imp(std::istringstream&, CGAL::Tag_false)
|
||||
{
|
||||
CGAL_error();
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
bool Traits_adaptor_test<Geom_traits_T>::
|
||||
ta_are_mergeable_wrapper_imp (std::istringstream & str_stream, CGAL::Tag_true)
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
ta_are_mergeable_wrapper_imp(std::istringstream& str_stream, CGAL::Tag_true)
|
||||
{
|
||||
unsigned int id1, id2;
|
||||
str_stream >> id1 >> id2;
|
||||
|
|
@ -263,27 +276,26 @@ ta_are_mergeable_wrapper_imp (std::istringstream & str_stream, CGAL::Tag_true)
|
|||
return this->compare(exp_answer, real_answer);
|
||||
}
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
bool Traits_adaptor_test<Geom_traits_T>::ta_merge_wrapper
|
||||
(std::istringstream & str_stream)
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::ta_merge_wrapper
|
||||
(std::istringstream& str_stream)
|
||||
{
|
||||
typedef typename Geom_traits_T::Has_merge_category Has_merge_category;
|
||||
typedef typename GeomTraits::Has_merge_category Has_merge_category;
|
||||
return ta_merge_wrapper_imp(str_stream, Has_merge_category());
|
||||
}
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
bool Traits_adaptor_test<Geom_traits_T>::
|
||||
ta_merge_wrapper_imp(std::istringstream &, CGAL::Tag_false)
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
ta_merge_wrapper_imp(std::istringstream&, CGAL::Tag_false)
|
||||
{
|
||||
CGAL_error();
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Geom_traits_T>
|
||||
bool Traits_adaptor_test<Geom_traits_T>::
|
||||
ta_merge_wrapper_imp(std::istringstream & str_stream, CGAL::Tag_true)
|
||||
template <typename GeomTraits, typename BaseGeomTraits>
|
||||
bool Traits_adaptor_test<GeomTraits, BaseGeomTraits>::
|
||||
ta_merge_wrapper_imp(std::istringstream& str_stream, CGAL::Tag_true)
|
||||
{
|
||||
typedef Geom_traits_T Geom_traits;
|
||||
typedef typename Geom_traits::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Geom_traits::Equal_2 Equal_2;
|
||||
CGAL_USE_TYPE(Equal_2);
|
||||
|
|
|
|||
|
|
@ -479,6 +479,7 @@ function(execute_commands_traits_adaptor data_dir traits_type_name)
|
|||
|
||||
set(commands_indicator_PARAMETER_SPACE_X 0)
|
||||
set(commands_indicator_PARAMETER_SPACE_Y 0)
|
||||
set(commands_indicator_COMPARE_XY 0)
|
||||
set(commands_indicator_COMPARE_X_AT_LIMIT 0)
|
||||
set(commands_indicator_COMPARE_X_NEAR_LIMIT 0)
|
||||
set(commands_indicator_COMPARE_X_ON_BOUNDARY 0)
|
||||
|
|
@ -508,6 +509,11 @@ function(execute_commands_traits_adaptor data_dir traits_type_name)
|
|||
data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves
|
||||
data/test_adaptor/${data_dir}/parameter_space_y ${traits_type_name})
|
||||
endif()
|
||||
if(commands_indicator_COMPARE_XY)
|
||||
run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points
|
||||
data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves
|
||||
data/test_adaptor/${data_dir}/compare_xy ${traits_type_name})
|
||||
endif()
|
||||
if(commands_indicator_COMPARE_X_AT_LIMIT)
|
||||
run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points
|
||||
data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves
|
||||
|
|
@ -599,7 +605,7 @@ function(test_segment_traits_adaptor)
|
|||
compile_test_with_flags(test_traits_adaptor segments "${flags}")
|
||||
# if [ -n "${SUCCESS}" ] ; then
|
||||
execute_commands_traits_adaptor( segments segments_traits_adaptor
|
||||
COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT
|
||||
COMPARE_XY COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT
|
||||
ARE_MERGEABLE MERGE IS_IN_X_RANGE IS_BETWEEN_CW)
|
||||
endfunction()
|
||||
|
||||
|
|
@ -615,7 +621,7 @@ function(test_linear_traits_adaptor)
|
|||
compile_test_with_flags( test_traits_adaptor linear "${flags}")
|
||||
|
||||
execute_commands_traits_adaptor( linear linear_traits_adaptor
|
||||
COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
|
||||
COMPARE_XY COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
|
||||
COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT)
|
||||
endfunction()
|
||||
|
||||
|
|
@ -632,7 +638,7 @@ function(test_spherical_arcs_traits_adaptor)
|
|||
compile_test_with_flags( test_traits_adaptor geodesic_arcs_on_sphere "${flags}")
|
||||
|
||||
execute_commands_traits_adaptor( spherical_arcs spherical_arcs_traits_adaptor
|
||||
COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
|
||||
COMPARE_XY COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE
|
||||
COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT)
|
||||
endfunction()
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
compare_xy 0 8 SMALLER
|
||||
|
|
@ -19,10 +19,10 @@
|
|||
0 0 1
|
||||
|
||||
2 1 0 1 -2 0 0 1
|
||||
1 -1 1 2 1 0 0 1
|
||||
1 0 1 2 1 0 0 1
|
||||
1 1 0 2 1 0 0 1
|
||||
0 0 1 1 -2 0 0 1
|
||||
1 -1 1 2 1 0 0 1
|
||||
1 -1 1 0 0 1 0 1
|
||||
1 0 1 2 1 0 0 1
|
||||
1 0 1 0 0 1 0 1
|
||||
1 1 0 2 1 0 0 1
|
||||
0 0 1 1 1 0 0 1
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ ColorBackground {
|
|||
NavigationInfo { type [ "EXAMINE" "ANY" ] }
|
||||
Viewpoint {
|
||||
type "ORTHOGONAL"
|
||||
fieldOfView 2.96
|
||||
# radiusScale 0.7
|
||||
}
|
||||
|
||||
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
|
||||
|
|
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
|
|||
Transform {
|
||||
rotation 1 0 0 -1.5708
|
||||
bboxCenter 0 0 0
|
||||
bboxSize 1.5 1.5 1.5
|
||||
bboxSize 2 2 2
|
||||
children [
|
||||
Switch {
|
||||
whichChoice 0
|
||||
|
|
@ -96,15 +94,14 @@ Transform {
|
|||
aosIsolatedVertexStyle "disc"
|
||||
# insertionStrategy "increment"
|
||||
aosMarkedEdgeIndex 100
|
||||
coord DEF COORD ExactCoordinate {
|
||||
ratPoint [
|
||||
0 0 1
|
||||
1 -2 0
|
||||
1 -1 1
|
||||
2 1 0
|
||||
1 0 1
|
||||
1 1 0
|
||||
]
|
||||
coord DEF COORD EpecCoordinate {
|
||||
exactPoint [0 0 1
|
||||
1 -2 0
|
||||
1 -1 1
|
||||
2 1 0
|
||||
1 0 1
|
||||
1 1 0
|
||||
]
|
||||
}
|
||||
# Pointindex [6 7]
|
||||
curveIndex [
|
||||
|
|
@ -145,7 +142,14 @@ Transform {
|
|||
}
|
||||
}
|
||||
Shape {
|
||||
appearance USE AXES_APP
|
||||
appearance DEF AXES_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.3 0.3 0.3
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
geometry Sphere {
|
||||
center 0 0 -1
|
||||
radius 0.05
|
||||
|
|
@ -207,20 +211,13 @@ Transform {
|
|||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
# The axes:
|
||||
DEF AXES Transform {
|
||||
scale 0.1 0.1 0.1
|
||||
children [
|
||||
Shape {
|
||||
appearance DEF AXES_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.3 0.3 0.3
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
appearance USE AXES_APP
|
||||
geometry Sphere { radius 0.1 }
|
||||
}
|
||||
DEF CS_AXIS Transform {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@
|
|||
0 0 1
|
||||
-1 0 -1 -1 -1 0 0 1
|
||||
-1 -1 0 0 0 1 0 1
|
||||
0 0 1 -1 2 0 0 1
|
||||
-1 2 0 -1 0 -1 0 1
|
||||
0 0 1 -1 2 0 0 1
|
||||
-1 1 0 0 0 1 0 1
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ ColorBackground {
|
|||
NavigationInfo { type [ "EXAMINE" "ANY" ] }
|
||||
Viewpoint {
|
||||
type "ORTHOGONAL"
|
||||
fieldOfView 2.96
|
||||
# radiusScale 0.7
|
||||
}
|
||||
|
||||
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
|
||||
|
|
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
|
|||
Transform {
|
||||
rotation 1 0 0 -1.5708
|
||||
bboxCenter 0 0 0
|
||||
bboxSize 1.5 1.5 1.5
|
||||
bboxSize 2 2 2
|
||||
children [
|
||||
Switch {
|
||||
whichChoice 0
|
||||
|
|
@ -98,13 +96,13 @@ Transform {
|
|||
# insertionStrategy "increment"
|
||||
aosMarkedEdgeIndex 100
|
||||
aosMarkedVertexIndex 0
|
||||
coord DEF COORD ExactCoordinate {
|
||||
ratPoint [-1 0 -1,
|
||||
-1 -1 0,
|
||||
0 0 1,
|
||||
-1 2 0,
|
||||
-1 1 0
|
||||
]
|
||||
coord DEF COORD EpecCoordinate {
|
||||
exactPoint [-1 0 -1,
|
||||
-1 -1 0,
|
||||
0 0 1,
|
||||
-1 2 0,
|
||||
-1 1 0
|
||||
]
|
||||
}
|
||||
# Pointindex [6 7]
|
||||
curveIndex [0 1 1 2 2 3 3 0 4 2]
|
||||
|
|
@ -136,7 +134,14 @@ Transform {
|
|||
}
|
||||
}
|
||||
Shape {
|
||||
appearance USE AXES_APP
|
||||
appearance DEF AXES_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.3 0.3 0.3
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
geometry Sphere {
|
||||
center 0 0 -1
|
||||
radius 0.05
|
||||
|
|
@ -198,20 +203,13 @@ Transform {
|
|||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
# The axes:
|
||||
DEF AXES Transform {
|
||||
scale 0.1 0.1 0.1
|
||||
children [
|
||||
Shape {
|
||||
appearance DEF AXES_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.3 0.3 0.3
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
appearance USE AXES_APP
|
||||
geometry Sphere { radius 0.1 }
|
||||
}
|
||||
DEF CS_AXIS Transform {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,6 @@
|
|||
1 -1 0
|
||||
0 0 1
|
||||
-1 -1 0 1 -1 0 0 1
|
||||
0 0 1 -1 -1 0 0 1
|
||||
-1 -2 1 1 -2 1 0 1
|
||||
1 -1 0 0 0 1 0 1
|
||||
0 0 1 -1 -1 0 0 1
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ ColorBackground {
|
|||
NavigationInfo { type [ "EXAMINE" "ANY" ] }
|
||||
Viewpoint {
|
||||
type "ORTHOGONAL"
|
||||
fieldOfView 2.96
|
||||
# radiusScale 0.7
|
||||
}
|
||||
|
||||
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
|
||||
|
|
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
|
|||
Transform {
|
||||
rotation 1 0 0 -1.5708
|
||||
bboxCenter 0 0 0
|
||||
bboxSize 1.5 1.5 1.5
|
||||
bboxSize 2 2 2
|
||||
children [
|
||||
Switch {
|
||||
whichChoice 0
|
||||
|
|
@ -98,13 +96,13 @@ Transform {
|
|||
# insertionStrategy "increment"
|
||||
aosMarkedEdgeIndex 100
|
||||
aosMarkedVertexIndex 0
|
||||
coord DEF COORD ExactCoordinate {
|
||||
ratPoint [-1 -1 0
|
||||
1 -1 0,
|
||||
0 0 1,
|
||||
-1 -2 1,
|
||||
1 -2 1
|
||||
]
|
||||
coord DEF COORD EpecCoordinate {
|
||||
exactPoint [-1 -1 0
|
||||
1 -1 0,
|
||||
0 0 1,
|
||||
-1 -2 1,
|
||||
1 -2 1
|
||||
]
|
||||
}
|
||||
# Pointindex [6 7]
|
||||
curveIndex [0 1 1 2 2 0 3 4]
|
||||
|
|
@ -136,7 +134,14 @@ Transform {
|
|||
}
|
||||
}
|
||||
Shape {
|
||||
appearance USE AXES_APP
|
||||
appearance DEF AXES_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.3 0.3 0.3
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
geometry Sphere {
|
||||
center 0 0 -1
|
||||
radius 0.05
|
||||
|
|
@ -198,20 +203,13 @@ Transform {
|
|||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
# The axes:
|
||||
DEF AXES Transform {
|
||||
scale 0.1 0.1 0.1
|
||||
children [
|
||||
Shape {
|
||||
appearance DEF AXES_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.3 0.3 0.3
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
appearance USE AXES_APP
|
||||
geometry Sphere { radius 0.1 }
|
||||
}
|
||||
DEF CS_AXIS Transform {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@
|
|||
1 -1 0
|
||||
0 0 1
|
||||
-1 -1 0 1 -1 0 0 1
|
||||
1 -1 0 0 0 1 0 1
|
||||
0 0 1 -1 -1 0 0 1
|
||||
0 0 1 0 -1 1 0 1
|
||||
1 -1 0 0 0 1 0 1
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ ColorBackground {
|
|||
NavigationInfo { type [ "EXAMINE" "ANY" ] }
|
||||
Viewpoint {
|
||||
type "ORTHOGONAL"
|
||||
fieldOfView 2.96
|
||||
# radiusScale 0.7
|
||||
}
|
||||
|
||||
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
|
||||
|
|
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
|
|||
Transform {
|
||||
rotation 1 0 0 -1.5708
|
||||
bboxCenter 0 0 0
|
||||
bboxSize 1.5 1.5 1.5
|
||||
bboxSize 2 2 2
|
||||
children [
|
||||
Switch {
|
||||
whichChoice 0
|
||||
|
|
@ -98,12 +96,12 @@ Transform {
|
|||
# insertionStrategy "increment"
|
||||
aosMarkedEdgeIndex 100
|
||||
aosMarkedVertexIndex 0
|
||||
coord DEF COORD ExactCoordinate {
|
||||
ratPoint [-1 -1 0
|
||||
1 -1 0,
|
||||
0 0 1,
|
||||
0 -1 1
|
||||
]
|
||||
coord DEF COORD EpecCoordinate {
|
||||
exactPoint [-1 -1 0
|
||||
1 -1 0,
|
||||
0 0 1,
|
||||
0 -1 1
|
||||
]
|
||||
}
|
||||
# Pointindex [6 7]
|
||||
curveIndex [0 1 1 2 2 0 2 3]
|
||||
|
|
@ -135,7 +133,14 @@ Transform {
|
|||
}
|
||||
}
|
||||
Shape {
|
||||
appearance USE AXES_APP
|
||||
appearance DEF AXES_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.3 0.3 0.3
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
geometry Sphere {
|
||||
center 0 0 -1
|
||||
radius 0.05
|
||||
|
|
@ -197,20 +202,13 @@ Transform {
|
|||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
# The axes:
|
||||
DEF AXES Transform {
|
||||
scale 0.1 0.1 0.1
|
||||
children [
|
||||
Shape {
|
||||
appearance DEF AXES_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.3 0.3 0.3
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
appearance USE AXES_APP
|
||||
geometry Sphere { radius 0.1 }
|
||||
}
|
||||
DEF CS_AXIS Transform {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@
|
|||
0 0 1
|
||||
-1 0 -1 -1 -1 0 0 1
|
||||
-1 -1 0 0 0 1 0 1
|
||||
0 0 1 -1 2 0 0 1
|
||||
-1 2 0 -1 0 -1 0 1
|
||||
0 0 1 -1 2 0 0 1
|
||||
-1 1 0 -1 0 0 0 1
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ ColorBackground {
|
|||
NavigationInfo { type [ "EXAMINE" "ANY" ] }
|
||||
Viewpoint {
|
||||
type "ORTHOGONAL"
|
||||
fieldOfView 2.96
|
||||
# radiusScale 0.7
|
||||
}
|
||||
|
||||
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
|
||||
|
|
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
|
|||
Transform {
|
||||
rotation 1 0 0 -1.5708
|
||||
bboxCenter 0 0 0
|
||||
bboxSize 1.5 1.5 1.5
|
||||
bboxSize 2 2 2
|
||||
children [
|
||||
Switch {
|
||||
whichChoice 0
|
||||
|
|
@ -98,14 +96,14 @@ Transform {
|
|||
# insertionStrategy "increment"
|
||||
aosMarkedEdgeIndex 100
|
||||
aosMarkedVertexIndex 0 1
|
||||
coord DEF COORD ExactCoordinate {
|
||||
ratPoint [-1 0 -1,
|
||||
-1 -1 0,
|
||||
0 0 1,
|
||||
-1 2 0,
|
||||
-1 1 0
|
||||
-1 0 0
|
||||
]
|
||||
coord DEF COORD EpecCoordinate {
|
||||
exactPoint [-1 0 -1,
|
||||
-1 -1 0,
|
||||
0 0 1,
|
||||
-1 2 0,
|
||||
-1 1 0
|
||||
-1 0 0
|
||||
]
|
||||
}
|
||||
# Pointindex [6 7]
|
||||
curveIndex [0 1 1 2 2 3 3 0 4 5]
|
||||
|
|
@ -137,7 +135,14 @@ Transform {
|
|||
}
|
||||
}
|
||||
Shape {
|
||||
appearance USE AXES_APP
|
||||
appearance DEF AXES_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.3 0.3 0.3
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
geometry Sphere {
|
||||
center 0 0 -1
|
||||
radius 0.05
|
||||
|
|
@ -199,20 +204,13 @@ Transform {
|
|||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
# The axes:
|
||||
DEF AXES Transform {
|
||||
scale 0.1 0.1 0.1
|
||||
children [
|
||||
Shape {
|
||||
appearance DEF AXES_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.3 0.3 0.3
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
appearance USE AXES_APP
|
||||
geometry Sphere { radius 0.1 }
|
||||
}
|
||||
DEF CS_AXIS Transform {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@
|
|||
-1 1 0
|
||||
-2 1 0
|
||||
0 0 1
|
||||
0 1 0 -1 1 0 0 1
|
||||
-1 0 -1 -2 -1 0 0 1
|
||||
-2 -1 0 0 0 1 0 1
|
||||
0 0 1 -2 1 0 0 1
|
||||
0 1 0 -1 1 0 0 1
|
||||
-2 1 0 -1 0 -1 0 1
|
||||
0 0 1 -2 1 0 0 1
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ ColorBackground {
|
|||
NavigationInfo { type [ "EXAMINE" "ANY" ] }
|
||||
Viewpoint {
|
||||
type "ORTHOGONAL"
|
||||
fieldOfView 2.96
|
||||
# radiusScale 0.7
|
||||
}
|
||||
|
||||
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
|
||||
|
|
@ -56,7 +54,7 @@ DEF SNAP Snapshot {
|
|||
Transform {
|
||||
rotation 1 0 0 -1.5708
|
||||
bboxCenter 0 0 0
|
||||
bboxSize 1.5 1.5 1.5
|
||||
bboxSize 2 2 2
|
||||
children [
|
||||
Switch {
|
||||
whichChoice 0
|
||||
|
|
@ -98,13 +96,13 @@ Transform {
|
|||
# insertionStrategy "increment"
|
||||
aosMarkedEdgeIndex 100
|
||||
aosMarkedVertexIndex 0
|
||||
coord DEF COORD ExactCoordinate {
|
||||
ratPoint [-1 0 -1,
|
||||
-2 -1 0,
|
||||
0 0 1,
|
||||
-2 1 0,
|
||||
0 1 0
|
||||
-1 1 0
|
||||
coord DEF COORD EpecCoordinate {
|
||||
exactPoint [-1 0 -1,
|
||||
-2 -1 0,
|
||||
0 0 1,
|
||||
-2 1 0,
|
||||
0 1 0
|
||||
-1 1 0
|
||||
]
|
||||
}
|
||||
# Pointindex [6 7]
|
||||
|
|
@ -137,7 +135,14 @@ Transform {
|
|||
}
|
||||
}
|
||||
Shape {
|
||||
appearance USE AXES_APP
|
||||
appearance DEF AXES_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.3 0.3 0.3
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
geometry Sphere {
|
||||
center 0 0 -1
|
||||
radius 0.05
|
||||
|
|
@ -199,20 +204,13 @@ Transform {
|
|||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
# The axes:
|
||||
DEF AXES Transform {
|
||||
scale 0.1 0.1 0.1
|
||||
children [
|
||||
Shape {
|
||||
appearance DEF AXES_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.3 0.3 0.3
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
appearance USE AXES_APP
|
||||
geometry Sphere { radius 0.1 }
|
||||
}
|
||||
DEF CS_AXIS Transform {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
3
|
||||
0 0 -1 0 -1 -1 0
|
||||
0 -1 1 0 -1 -1 0
|
||||
0 0 -1 0 -1 0 0
|
||||
0
|
||||
4 3 1
|
||||
0 0 -1
|
||||
0 -1 -1
|
||||
0 -1 0
|
||||
0 -1 1
|
||||
0 0 -1 0 -1 -1 0 2
|
||||
0 -1 -1 0 -1 0 0 2
|
||||
0 -1 1 0 -1 0 0 1
|
||||
|
|
@ -0,0 +1,267 @@
|
|||
#VRML V2.0 utf8
|
||||
Configuration {
|
||||
accumulation Accumulation { enabled TRUE }
|
||||
}
|
||||
ColorBackground {
|
||||
color 1 1 1 1
|
||||
clearStencil TRUE
|
||||
}
|
||||
NavigationInfo { type [ "EXAMINE" "ANY" ] }
|
||||
Viewpoint {
|
||||
type "ORTHOGONAL"
|
||||
}
|
||||
|
||||
DEF TRANSFORMER_NAV NavigationInfo { type [ "TRANSFORM" ] }
|
||||
|
||||
DEF DRAW_OPAQUE_KEY SingleKeySensor { key "o" }
|
||||
DEF DRAW_HALOED_KEY SingleKeySensor { key "l" state TRUE }
|
||||
DEF DRAW_SURFACE_KEY SingleKeySensor { key "b" state TRUE }
|
||||
DEF EXPORT_KEY SingleKeySensor { key "O" }
|
||||
DEF SNAP_KEY SingleKeySensor { key "S" }
|
||||
|
||||
DEF VERTEX_SHAPE_KEY SingleKeySensor {
|
||||
key "v"
|
||||
boolean FALSE
|
||||
numberOfStates 5
|
||||
intState 2 # disc
|
||||
}
|
||||
|
||||
DEF EDGE_SHAPE_KEY SingleKeySensor {
|
||||
key "e"
|
||||
boolean FALSE
|
||||
numberOfStates 4
|
||||
intState 2 # strip
|
||||
}
|
||||
|
||||
DEF HIDE_SINGULARITIES_KEY SingleKeySensor {
|
||||
boolean FALSE
|
||||
key "s"
|
||||
}
|
||||
|
||||
DEF HIDE_DISCONTINUITY_KEY SingleKeySensor {
|
||||
boolean FALSE
|
||||
key "d"
|
||||
}
|
||||
|
||||
DEF SNAP Snapshot {
|
||||
image Image { }
|
||||
fileFormat "jpg"
|
||||
sequence FALSE
|
||||
dirName "."
|
||||
fileName "test07"
|
||||
}
|
||||
|
||||
Transform {
|
||||
rotation 1 0 0 -1.5708
|
||||
bboxCenter 0 0 0
|
||||
bboxSize 2 2 2
|
||||
children [
|
||||
Switch {
|
||||
whichChoice 0
|
||||
children [
|
||||
DEF ARRANGMENT Group {
|
||||
children [
|
||||
Shape {
|
||||
drawDepth FALSE
|
||||
appearance Appearance {
|
||||
material Material {
|
||||
diffuseColor 0.5 0.5 0.5
|
||||
ambientIntensity 0.7
|
||||
specularColor 0.5 0.5 0.5
|
||||
}
|
||||
}
|
||||
geometry Sphere {
|
||||
slices 32
|
||||
stacks 32
|
||||
}
|
||||
}
|
||||
Shape {
|
||||
appearance Appearance {
|
||||
material Material {
|
||||
transparency 0.0001
|
||||
}
|
||||
}
|
||||
geometry DEF GEOM ArrangementOnSphereMarked {
|
||||
drawSurface FALSE
|
||||
# drawOpaque TRUE
|
||||
drawHaloed TRUE
|
||||
aosEdgeStyle "strip"
|
||||
aosEdgeRadius 0.03
|
||||
aosEdgeLineWidth 3
|
||||
aosVertexStyle "disc"
|
||||
aosMarkedVertexStyle "none"
|
||||
aosVertexRadius 0.1
|
||||
aosVertexPointSize 6
|
||||
aosIsolatedVertexStyle "disc"
|
||||
# insertionStrategy "increment"
|
||||
aosMarkedEdgeIndex 100
|
||||
aosMarkedVertexIndex 0
|
||||
coord DEF COORD EpecCoordinate {
|
||||
exactPoint [0 0 -1, 0 -1 -1,
|
||||
0 -1 1, 0 -1 -1,
|
||||
0 0 -1, 0 -1 0
|
||||
]
|
||||
}
|
||||
# Pointindex [6 7]
|
||||
curveIndex [0 1 2 3 4 5]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
# The singularity points:
|
||||
DEF SINGULARITIES_SWITCH Switch {
|
||||
whichChoice 0
|
||||
children [
|
||||
Group {
|
||||
children [
|
||||
Shape {
|
||||
appearance DEF BOUNDARY_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.8 0.8 0.8
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
geometry Sphere {
|
||||
center 0 0 1
|
||||
radius 0.05
|
||||
}
|
||||
}
|
||||
Shape {
|
||||
appearance DEF AXES_APP Appearance {
|
||||
material Material {
|
||||
# ambientIntensity 1
|
||||
diffuseColor 0.4 0.4 0.4
|
||||
# specularColor 0.3 0.3 0.3
|
||||
# transparency 0.0001
|
||||
}
|
||||
}
|
||||
geometry Sphere {
|
||||
center 0 0 -1
|
||||
radius 0.05
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
# The discontinuity arc:
|
||||
DEF DISCONTINUITY_SWITCH Switch {
|
||||
whichChoice 0
|
||||
children [
|
||||
Shape {
|
||||
appearance USE BOUNDARY_APP
|
||||
geometry Extrusion {
|
||||
creaseAngle 2.0
|
||||
beginCap TRUE
|
||||
endCap TRUE
|
||||
loop FALSE
|
||||
crossSectionRadius 0.025
|
||||
spine [
|
||||
0 0 1,
|
||||
-0.0980171 0 0.995185,
|
||||
-0.19509 0 0.980785,
|
||||
-0.290285 0 0.95694,
|
||||
-0.382683 0 0.92388,
|
||||
-0.471397 0 0.881921,
|
||||
-0.55557 0 0.83147,
|
||||
-0.634393 0 0.77301,
|
||||
-0.707107 0 0.707107,
|
||||
-0.77301 0 0.634393,
|
||||
-0.83147 0 0.55557,
|
||||
-0.881921 0 0.471397,
|
||||
-0.92388 0 0.382683,
|
||||
-0.95694 0 0.290285,
|
||||
-0.980785 0 0.19509,
|
||||
-0.995185 0 0.0980171,
|
||||
-1 0 0,
|
||||
-0.995185 0 -0.0980171,
|
||||
-0.980785 0 -0.19509,
|
||||
-0.95694 0 -0.290285,
|
||||
-0.92388 0 -0.382683,
|
||||
-0.881921 0 -0.471397,
|
||||
-0.83147 0 -0.55557,
|
||||
-0.77301 0 -0.634393,
|
||||
-0.707107 0 -0.707107,
|
||||
-0.634393 0 -0.77301,
|
||||
-0.55557 0 -0.83147,
|
||||
-0.471397 0 -0.881921,
|
||||
-0.382683 0 -0.92388,
|
||||
-0.290285 0 -0.95694,
|
||||
-0.19509 0 -0.980785,
|
||||
-0.0980171 0 -0.995185,
|
||||
0 0 -1,
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
# The axes:
|
||||
DEF AXES Transform {
|
||||
scale 0.1 0.1 0.1
|
||||
children [
|
||||
Shape {
|
||||
appearance USE AXES_APP
|
||||
geometry Sphere { radius 0.1 }
|
||||
}
|
||||
DEF CS_AXIS Transform {
|
||||
translation 0 1.5 0
|
||||
children [
|
||||
Shape {
|
||||
appearance USE AXES_APP
|
||||
geometry Cylinder {
|
||||
radius 0.1
|
||||
height 3
|
||||
set_is_bottom_visible FALSE
|
||||
set_is_top_visible FALSE
|
||||
}
|
||||
}
|
||||
Transform {
|
||||
translation 0 1.7 0
|
||||
children [
|
||||
Shape {
|
||||
appearance USE AXES_APP
|
||||
geometry Cone {
|
||||
bottomRadius 0.2
|
||||
height 0.4
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Transform {
|
||||
rotation 0 0 -1 1.57
|
||||
children [ USE CS_AXIS ]
|
||||
}
|
||||
Transform {
|
||||
rotation 1 0 0 1.57
|
||||
children [ USE CS_AXIS ]
|
||||
}
|
||||
]
|
||||
}
|
||||
# Transform {
|
||||
# translation 2 0 0
|
||||
# children [
|
||||
# USE ARRANGMENT
|
||||
# ]
|
||||
# }
|
||||
]
|
||||
}
|
||||
|
||||
ROUTE DRAW_OPAQUE_KEY.state TO GEOM.drawOpaque
|
||||
ROUTE DRAW_HALOED_KEY.state TO GEOM.drawHaloed
|
||||
ROUTE SNAP_KEY.state TO SNAP.trigger
|
||||
# ROUTE EXPORT_KEY.press TO GEOM.export
|
||||
|
||||
ROUTE HIDE_DISCONTINUITY_KEY.intState TO DISCONTINUITY_SWITCH.whichChoice
|
||||
ROUTE HIDE_SINGULARITIES_KEY.intState TO SINGULARITIES_SWITCH.whichChoice
|
||||
|
||||
ROUTE VERTEX_SHAPE_KEY.intState TO GEOM.aosVertexStyleId
|
||||
ROUTE EDGE_SHAPE_KEY.intState TO GEOM.aosEdgeStyleId
|
||||
|
|
@ -8,7 +8,7 @@ r 0 0 0 1
|
|||
3
|
||||
0 0
|
||||
0 1
|
||||
s 0 0 0 1 1
|
||||
r 0 0 1 0 1
|
||||
s 0 0 0 1 1
|
||||
r 0 1 1 1 1
|
||||
r 0 1 0 2 1
|
||||
|
|
|
|||
|
|
@ -5,3 +5,4 @@
|
|||
./data/test_construction/geodesic_arcs_on_sphere/test05.txt
|
||||
./data/test_construction/geodesic_arcs_on_sphere/test06.txt
|
||||
./data/test_construction/geodesic_arcs_on_sphere/test07.txt
|
||||
./data/test_construction/geodesic_arcs_on_sphere/test08.txt
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
int main (int argc, char * argv[])
|
||||
{
|
||||
Geom_traits traits;
|
||||
Traits_adaptor_test<Geom_traits> test(traits);
|
||||
Traits_adaptor_test<Geom_traits, Base_geom_traits> test(traits);
|
||||
if (!test.parse(argc, argv)) return -1;
|
||||
if (!test.init()) return -1;
|
||||
if (!test.perform()) return -1;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "test_geom_traits.h"
|
||||
|
||||
typedef CGAL::Arr_traits_basic_adaptor_2<Base_geom_traits> Geom_traits;
|
||||
typedef CGAL::Arr_traits_adaptor_2<Base_geom_traits> Geom_traits;
|
||||
typedef Geom_traits::Point_2 Point_2;
|
||||
typedef Geom_traits::Curve_2 Curve_2;
|
||||
typedef Geom_traits::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <CGAL/enum.h>
|
||||
#include <CGAL/Arr_enums.h>
|
||||
#include <CGAL/Arr_tags.h>
|
||||
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
|
||||
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
|
|
@ -103,32 +104,25 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
template <typename T_Geom_traits>
|
||||
template <typename GeomTraits>
|
||||
class Curve_compare {
|
||||
private:
|
||||
typedef T_Geom_traits Traits;
|
||||
typedef GeomTraits Geom_traits;
|
||||
|
||||
const Traits& m_traits;
|
||||
const Geom_traits& m_traits;
|
||||
|
||||
public:
|
||||
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits::Point_2 Point_2;
|
||||
typedef typename Geom_traits::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
||||
Curve_compare(const Traits& traits) : m_traits(traits) {}
|
||||
Curve_compare(const Geom_traits& traits) : m_traits(traits) {}
|
||||
|
||||
bool operator()(const X_monotone_curve_2& c1, const X_monotone_curve_2& c2)
|
||||
{
|
||||
const Point_2& c1_left = m_traits.construct_min_vertex_2_object()(c1);
|
||||
const Point_2& c2_left = m_traits.construct_min_vertex_2_object()(c2);
|
||||
|
||||
CGAL::Comparison_result res =
|
||||
m_traits.compare_xy_2_object()(c1_left, c2_left);
|
||||
|
||||
if (res == CGAL::SMALLER) return true;
|
||||
if (res == CGAL::LARGER) return false;
|
||||
CGAL_assertion(res == CGAL::EQUAL);
|
||||
res = m_traits.compare_y_at_x_right_2_object()(c1, c2, c1_left);
|
||||
return (res == CGAL::SMALLER) ? true : false;
|
||||
typedef CGAL::Arr_traits_adaptor_2<Geom_traits> Geom_traits_adaptor;
|
||||
Geom_traits_adaptor geom_traits_adapter(m_traits);
|
||||
typedef typename Geom_traits_adaptor::Compare_xy_2 Compare_xy_2;
|
||||
Compare_xy_2 cmp_xy = geom_traits_adapter.compare_xy_2_object();
|
||||
return (CGAL::SMALLER == cmp_xy(c1, c2));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -42,14 +42,14 @@ _construct_envelope_non_vertical(Curve_pointer_iterator begin,
|
|||
Envelope_diagram_1& out_d)
|
||||
{
|
||||
out_d.clear();
|
||||
|
||||
|
||||
if (begin == end)
|
||||
return;
|
||||
|
||||
|
||||
// Check if the range contains just a single curve.
|
||||
Curve_pointer_iterator iter = begin;
|
||||
++iter;
|
||||
|
||||
|
||||
if (iter == end)
|
||||
{
|
||||
// Construct a singleton diagram, which matches a single curve.
|
||||
|
|
@ -61,14 +61,14 @@ _construct_envelope_non_vertical(Curve_pointer_iterator begin,
|
|||
std::size_t size = std::distance(begin, end);
|
||||
Curve_pointer_iterator div_it = begin;
|
||||
std::advance(div_it, size / 2);
|
||||
|
||||
// Construct the diagrams (envelopes) for the two sub-ranges recursively
|
||||
|
||||
// Construct the diagrams (envelopes) for the two sub-ranges recursively
|
||||
// and then merge the two diagrams to obtain the result.
|
||||
Envelope_diagram_1 d1;
|
||||
Envelope_diagram_1 d2;
|
||||
|
||||
|
||||
_construct_envelope_non_vertical(begin, div_it, d1);
|
||||
|
||||
|
||||
_construct_envelope_non_vertical(div_it, end, d2);
|
||||
|
||||
_merge_envelopes(d1, d2, out_d);
|
||||
|
|
@ -88,13 +88,13 @@ _construct_envelope_non_vertical(Curve_pointer_iterator begin,
|
|||
|
||||
v = e->right();
|
||||
std::cout << "(" << v->point() << ") ";
|
||||
|
||||
|
||||
e = v->right();
|
||||
}
|
||||
std::cout << "[empty]" << std::endl;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ _construct_singleton_diagram(const X_monotone_curve_2& cv,
|
|||
{
|
||||
CGAL_assertion(out_d.leftmost() == out_d.rightmost());
|
||||
CGAL_assertion(out_d.leftmost()->is_empty());
|
||||
|
||||
|
||||
// Check if the given curve is bounded from the left and from the right.
|
||||
if (traits->parameter_space_in_x_2_object()(cv, ARR_MIN_END) != ARR_INTERIOR)
|
||||
{
|
||||
|
|
@ -117,7 +117,7 @@ _construct_singleton_diagram(const X_monotone_curve_2& cv,
|
|||
// The curve is defined over (-oo, oo), so its diagram contains
|
||||
// only a single edge.
|
||||
out_d.leftmost()->add_curve(cv);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -125,50 +125,50 @@ _construct_singleton_diagram(const X_monotone_curve_2& cv,
|
|||
// Create a vertex and associate it with the right endpoint of cv.
|
||||
CGAL_precondition
|
||||
(traits->parameter_space_in_y_2_object()(cv, ARR_MAX_END) == ARR_INTERIOR);
|
||||
|
||||
|
||||
Vertex_handle v =
|
||||
out_d.new_vertex(traits->construct_max_vertex_2_object()(cv));
|
||||
Edge_handle e_right = out_d.new_edge();
|
||||
|
||||
|
||||
v->add_curve(cv);
|
||||
v->set_left(out_d.leftmost());
|
||||
v->set_right(e_right);
|
||||
|
||||
|
||||
// The leftmost edge is associated with cv, and the rightmost is empty.
|
||||
out_d.leftmost()->add_curve(cv);
|
||||
out_d.leftmost()->set_right(v);
|
||||
|
||||
|
||||
e_right->set_left(v);
|
||||
out_d.set_rightmost(e_right);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (traits->parameter_space_in_x_2_object()(cv, ARR_MAX_END) != ARR_INTERIOR)
|
||||
{
|
||||
// The curve is defined over [x, +oo), where x is finite.
|
||||
// Create a vertex and associate it with the left endpoint of cv.
|
||||
CGAL_precondition
|
||||
(traits->parameter_space_in_y_2_object()(cv, ARR_MIN_END) == ARR_INTERIOR);
|
||||
|
||||
Vertex_handle v =
|
||||
|
||||
Vertex_handle v =
|
||||
out_d.new_vertex(traits->construct_min_vertex_2_object()(cv));
|
||||
Edge_handle e_left = out_d.new_edge();
|
||||
|
||||
|
||||
v->add_curve(cv);
|
||||
v->set_left(e_left);
|
||||
v->set_right(out_d.rightmost());
|
||||
|
||||
|
||||
// The rightmost edge is associated with cv, and the leftmost is empty.
|
||||
out_d.rightmost()->add_curve(cv);
|
||||
out_d.rightmost()->set_left(v);
|
||||
|
||||
|
||||
e_left->set_right(v);
|
||||
out_d.set_leftmost(e_left);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// If we reached here, the curve is defined over a bounded x-range.
|
||||
// We therefore create the following diagram:
|
||||
//
|
||||
|
|
@ -179,33 +179,33 @@ _construct_singleton_diagram(const X_monotone_curve_2& cv,
|
|||
(traits->parameter_space_in_y_2_object()(cv, ARR_MIN_END) == ARR_INTERIOR);
|
||||
CGAL_precondition
|
||||
(traits->parameter_space_in_y_2_object()(cv, ARR_MAX_END) == ARR_INTERIOR);
|
||||
|
||||
Vertex_handle v1 =
|
||||
|
||||
Vertex_handle v1 =
|
||||
out_d.new_vertex(traits->construct_min_vertex_2_object()(cv));
|
||||
Vertex_handle v2 =
|
||||
Vertex_handle v2 =
|
||||
out_d.new_vertex(traits->construct_max_vertex_2_object()(cv));
|
||||
Edge_handle e_left = out_d.new_edge();
|
||||
Edge_handle e_right = out_d.new_edge();
|
||||
Edge_handle e = out_d.leftmost();
|
||||
|
||||
|
||||
v1->add_curve(cv);
|
||||
v1->set_left(e_left);
|
||||
v1->set_right(e);
|
||||
|
||||
|
||||
v2->add_curve(cv);
|
||||
v2->set_left(e);
|
||||
v2->set_right(e_right);
|
||||
|
||||
|
||||
e->add_curve(cv);
|
||||
e->set_left(v1);
|
||||
e->set_right(v2);
|
||||
|
||||
|
||||
e_left->set_right(v1);
|
||||
e_right->set_left(v2);
|
||||
|
||||
|
||||
out_d.set_leftmost(e_left);
|
||||
out_d.set_rightmost(e_right);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ _merge_envelopes(const Envelope_diagram_1& d1,
|
|||
// If both have the same x-ccordinate, find the one that should be in
|
||||
// the envelope.
|
||||
same_x = false;
|
||||
|
||||
|
||||
if (e1 == d1.rightmost())
|
||||
{
|
||||
if (e2 == d2.rightmost())
|
||||
|
|
@ -265,14 +265,14 @@ _merge_envelopes(const Envelope_diagram_1& d1,
|
|||
res_v = _compare_vertices(v1, v2, same_x);
|
||||
next_v = (res_v == SMALLER) ? v1 : v2;
|
||||
}
|
||||
|
||||
|
||||
// Check if the current edges represent empty intervals or not.
|
||||
if (! e1->is_empty() && ! e2->is_empty())
|
||||
{
|
||||
// Both edges are not empty, and there are curves defined on them.
|
||||
_merge_two_intervals(e1, is_leftmost1, e2, is_leftmost2,
|
||||
next_v, next_exists, res_v, out_d);
|
||||
|
||||
|
||||
}
|
||||
else if (! e1->is_empty() && e2->is_empty())
|
||||
{
|
||||
|
|
@ -304,7 +304,7 @@ _merge_envelopes(const Envelope_diagram_1& d1,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Proceed to the next diagram edge(s), if possible.
|
||||
if (next_exists)
|
||||
{
|
||||
|
|
@ -336,14 +336,14 @@ _merge_envelopes(const Envelope_diagram_1& d1,
|
|||
{
|
||||
e1 = v1->right();
|
||||
is_leftmost1 = false;
|
||||
|
||||
|
||||
e2 = v2->right();
|
||||
is_leftmost2 = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} while (next_exists);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -358,7 +358,7 @@ _compare_vertices(Vertex_const_handle v1,
|
|||
{
|
||||
Comparison_result res =
|
||||
traits->compare_x_2_object()(v1->point(), v2->point());
|
||||
|
||||
|
||||
if (res != EQUAL)
|
||||
{
|
||||
same_x = false;
|
||||
|
|
@ -396,15 +396,15 @@ _merge_single_interval(Edge_const_handle e, Edge_const_handle other_edge,
|
|||
out_d.rightmost()->add_curves(e->curves_begin(), e->curves_end());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Vertex_handle new_v;
|
||||
|
||||
|
||||
if (origin_of_v == SMALLER)
|
||||
{
|
||||
// The non-empty edge ends at v, so we simply insert it to out_d.
|
||||
new_v = _append_vertex(out_d, v->point(), e);
|
||||
new_v->add_curves(v->curves_begin(), v->curves_end());
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ _merge_single_interval(Edge_const_handle e, Edge_const_handle other_edge,
|
|||
{
|
||||
new_v = _append_vertex(out_d, v->point(), e);
|
||||
new_v->add_curves(e->right()->curves_begin(), e->right()->curves_end());
|
||||
new_v->add_curves(other_edge->right()->curves_begin(),
|
||||
new_v->add_curves(other_edge->right()->curves_begin(),
|
||||
other_edge->right()->curves_end());
|
||||
return;
|
||||
}
|
||||
|
|
@ -421,7 +421,7 @@ _merge_single_interval(Edge_const_handle e, Edge_const_handle other_edge,
|
|||
// is below (or above, in case of an upper envelope) the curves of e.
|
||||
Comparison_result res =
|
||||
traits->compare_y_at_x_2_object()(v->point(), e->curve());
|
||||
|
||||
|
||||
if ((res == EQUAL) ||
|
||||
(env_type == LOWER && res == SMALLER) ||
|
||||
(env_type == UPPER && res == LARGER))
|
||||
|
|
@ -441,15 +441,15 @@ _merge_single_interval(Edge_const_handle e, Edge_const_handle other_edge,
|
|||
/*@{*/
|
||||
|
||||
//! Compare the $y$-coordinates of two curves at their endpoints
|
||||
/*! The function compares the $y$ values of two curves with a joint
|
||||
/*! The function compares the $y$ values of two curves with a joint
|
||||
range of $x$ values, at the end of the joint range.
|
||||
\param xcv1 The first curve
|
||||
\param xcv2 The second curve
|
||||
\param curve_end ARR_MIN_END - compare the $y$ value of the smaller
|
||||
\param curve_end ARR_MIN_END - compare the $y$ value of the smaller
|
||||
endpoint, ARR_MAX_END - compare the $y$ value of the larger endpoint.
|
||||
\pre The two $x$-monotone curves need to have a partially overlapping
|
||||
\pre The two $x$-monotone curves need to have a partially overlapping
|
||||
$x$-ranges.
|
||||
\return
|
||||
\return
|
||||
\todo Move it to Arr_traits_adaptor ?
|
||||
*/
|
||||
template <class Traits, class Diagram>
|
||||
|
|
@ -460,7 +460,7 @@ compare_y_at_end(const X_monotone_curve_2& xcv1,
|
|||
{
|
||||
CGAL_precondition(traits->is_in_x_range_2_object()(xcv1, xcv2));
|
||||
|
||||
typedef typename Traits::Compare_xy_2 Compare_xy_2;
|
||||
typedef typename Traits_adaptor_2::Compare_xy_2 Compare_xy_2;
|
||||
typedef typename Traits::Compare_y_at_x_2 Compare_y_at_x_2;
|
||||
typedef typename Traits::Construct_min_vertex_2 Construct_min_vertex_2;
|
||||
typedef typename Traits::Construct_max_vertex_2 Construct_max_vertex_2;
|
||||
|
|
@ -470,30 +470,30 @@ compare_y_at_end(const X_monotone_curve_2& xcv1,
|
|||
traits->construct_min_vertex_2_object();
|
||||
Construct_max_vertex_2 max_vertex =
|
||||
traits->construct_max_vertex_2_object();
|
||||
|
||||
|
||||
// First check whether any of the curves is defined at x boundary.
|
||||
const Arr_parameter_space ps_x1 =
|
||||
traits->parameter_space_in_x_2_object()(xcv1, curve_end);
|
||||
const Arr_parameter_space ps_x2 =
|
||||
traits->parameter_space_in_x_2_object()(xcv2, curve_end);
|
||||
Comparison_result res;
|
||||
|
||||
|
||||
if (ps_x1 != ARR_INTERIOR) {
|
||||
if (ps_x2 != ARR_INTERIOR) {
|
||||
// Compare the relative position of the curves at x boundary.
|
||||
return (traits->compare_y_near_boundary_2_object()(xcv1, xcv2,
|
||||
curve_end));
|
||||
}
|
||||
|
||||
|
||||
// Check if the left end of xcv2 lies at y boundary.
|
||||
const Arr_parameter_space ps_y2 =
|
||||
traits->parameter_space_in_y_2_object()(xcv2, curve_end);
|
||||
|
||||
|
||||
if (ps_y2 == ARR_BOTTOM_BOUNDARY)
|
||||
return (LARGER); // xcv2 is obviously below xcv1.
|
||||
else if (ps_y2 == ARR_TOP_BOUNDARY)
|
||||
return (SMALLER); // xcv2 is obviously above xcv1.
|
||||
|
||||
|
||||
// Compare the position of the left end of xcv2 (which is a normal
|
||||
// point) to xcv1.
|
||||
res = (curve_end == ARR_MIN_END) ?
|
||||
|
|
@ -507,12 +507,12 @@ compare_y_at_end(const X_monotone_curve_2& xcv1,
|
|||
// Check if the left end of xcv1 lies at y boundary.
|
||||
const Arr_parameter_space ps_y1 = traits->parameter_space_in_y_2_object()
|
||||
(xcv1, curve_end);
|
||||
|
||||
|
||||
if (ps_y1 == ARR_BOTTOM_BOUNDARY)
|
||||
return (SMALLER); // xcv1 is obviously below xcv2.
|
||||
else if (ps_y1 == ARR_TOP_BOUNDARY)
|
||||
return (LARGER); // xcv1 is obviously above xcv2.
|
||||
|
||||
|
||||
// Compare the position of the left end of xcv1 (which is a normal
|
||||
// point) to xcv2.
|
||||
res = (curve_end == ARR_MIN_END) ?
|
||||
|
|
@ -520,14 +520,14 @@ compare_y_at_end(const X_monotone_curve_2& xcv1,
|
|||
compare_y_at_x(max_vertex(xcv1), xcv2);
|
||||
return (res);
|
||||
}
|
||||
|
||||
|
||||
// Check if the left curve end lies at y = +/- oo.
|
||||
const Arr_parameter_space ps_y1 =
|
||||
traits->parameter_space_in_y_2_object()(xcv1, curve_end);
|
||||
const Arr_parameter_space ps_y2 =
|
||||
traits->parameter_space_in_y_2_object()(xcv2, curve_end);
|
||||
Comparison_result l_res;
|
||||
|
||||
|
||||
if (ps_y1 != ARR_INTERIOR) {
|
||||
if (ps_y2 != ARR_INTERIOR) {
|
||||
// The curve ends have boundary conditions with oposite signs in y,
|
||||
|
|
@ -544,7 +544,7 @@ compare_y_at_end(const X_monotone_curve_2& xcv1,
|
|||
l_res = traits->compare_x_curve_ends_2_object()(xcv1, curve_end,
|
||||
xcv2, curve_end);
|
||||
CGAL_assertion(l_res != EQUAL);
|
||||
|
||||
|
||||
if (ps_y1 == ARR_TOP_BOUNDARY)
|
||||
return (l_res);
|
||||
else
|
||||
|
|
@ -555,10 +555,10 @@ compare_y_at_end(const X_monotone_curve_2& xcv1,
|
|||
// Compare the x-positions of this endpoint and the asymptote.
|
||||
const Point_2& left2 =
|
||||
(curve_end == ARR_MIN_END) ? min_vertex(xcv2) : max_vertex(xcv2);
|
||||
|
||||
|
||||
l_res =
|
||||
traits->compare_x_point_curve_end_2_object()(left2, xcv1, curve_end);
|
||||
|
||||
|
||||
if (l_res == LARGER) {
|
||||
// left2 lies in the x-range of xcv1, so it is safe to compare:
|
||||
res = compare_y_at_x(left2, xcv1);
|
||||
|
|
@ -571,12 +571,12 @@ compare_y_at_end(const X_monotone_curve_2& xcv1,
|
|||
else if (ps_y2 != ARR_INTERIOR) {
|
||||
// xcv2 has a vertical asymptote and xcv1 has a normal left endpoint.
|
||||
// Compare the x-positions of this endpoint and the asymptote.
|
||||
const Point_2& left1 =
|
||||
const Point_2& left1 =
|
||||
(curve_end == ARR_MIN_END) ? min_vertex(xcv1) : max_vertex(xcv1);
|
||||
|
||||
|
||||
l_res =
|
||||
traits->compare_x_point_curve_end_2_object()(left1, xcv2, curve_end);
|
||||
|
||||
|
||||
return ((l_res == LARGER) ?
|
||||
// left1 lies in the x-range of xcv2, so it is safe to compare:
|
||||
(compare_y_at_x(left1, xcv2)) :
|
||||
|
|
@ -584,21 +584,21 @@ compare_y_at_end(const X_monotone_curve_2& xcv1,
|
|||
}
|
||||
|
||||
// In this case we compare two normal points.
|
||||
Compare_xy_2 compare_xy = traits->compare_xy_2_object();
|
||||
Compare_xy_2 compare_xy = traits->compare_xy_2_object();
|
||||
|
||||
// Get the left endpoints of xcv1 and xcv2.
|
||||
const Point_2& left1 =
|
||||
const Point_2& left1 =
|
||||
(curve_end == ARR_MIN_END) ? min_vertex(xcv1) : max_vertex(xcv1);
|
||||
const Point_2& left2 =
|
||||
const Point_2& left2 =
|
||||
(curve_end == ARR_MIN_END) ? min_vertex(xcv2) : max_vertex(xcv2);
|
||||
|
||||
// Locate the rightmost point of left1 and left2 and compare its position
|
||||
// to the other curve.
|
||||
l_res = compare_xy(left1, left2);
|
||||
|
||||
|
||||
return ((l_res != SMALLER) ?
|
||||
// left1 is in the x-range of xcv2:
|
||||
compare_y_at_x(left1, xcv2) :
|
||||
compare_y_at_x(left1, xcv2) :
|
||||
// left2 is in the x-range of xcv1:
|
||||
CGAL::opposite(compare_y_at_x(left2, xcv1)));
|
||||
}
|
||||
|
|
@ -609,7 +609,7 @@ compare_y_at_end(const X_monotone_curve_2& xcv1,
|
|||
//
|
||||
template <class Traits, class Diagram>
|
||||
void Envelope_divide_and_conquer_2<Traits,Diagram>::
|
||||
_merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
||||
_merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
||||
Edge_const_handle e2, bool is_leftmost2,
|
||||
Vertex_const_handle v, bool v_exists,
|
||||
Comparison_result origin_of_v,
|
||||
|
|
@ -619,7 +619,7 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
|
||||
Comparison_result current_res;
|
||||
bool equal_at_v = false;
|
||||
|
||||
|
||||
// Get the relative position of two curves associated with e1 and e2
|
||||
// at the rightmost of the left endpoints of e1 and e2.
|
||||
current_res = compare_y_at_end(e1->curve(), e2->curve(), ARR_MIN_END);
|
||||
|
|
@ -659,24 +659,24 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
CGAL::Object obj;
|
||||
const X_monotone_curve_2* intersection_curve;
|
||||
const Intersection_point* intersection_point;
|
||||
|
||||
|
||||
traits->intersect_2_object()(e1->curve(), e2->curve(),
|
||||
std::back_inserter(objects));
|
||||
|
||||
|
||||
while (! objects.empty()) {
|
||||
// Pop the xy-lexicographically smallest intersection object.
|
||||
obj = objects.front();
|
||||
objects.pop_front();
|
||||
|
||||
|
||||
if ((intersection_point = CGAL::object_cast<Intersection_point>(&obj)) !=
|
||||
NULL)
|
||||
{
|
||||
// We have a simple intersection point.
|
||||
bool is_in_x_range = true; // true if the intersection point is to the
|
||||
bool is_in_x_range = true; // true if the intersection point is to the
|
||||
// right of v_leftmost.
|
||||
// check if we are before the leftmost point.
|
||||
if (v_leftmost &&
|
||||
traits->compare_xy_2_object() (intersection_point->first,
|
||||
traits->compare_xy_2_object() (intersection_point->first,
|
||||
(*v_leftmost)->point()) != LARGER)
|
||||
{
|
||||
// The point is to the left of the current rightmost vertex in out_d,
|
||||
|
|
@ -684,22 +684,22 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
// However, we update the last intersection point observed.
|
||||
is_in_x_range = false;
|
||||
}
|
||||
|
||||
|
||||
// check if we arrived at the rightmost point (stop if indeed we are
|
||||
// there).
|
||||
if (is_in_x_range && v_exists) {
|
||||
Comparison_result res = traits->compare_xy_2_object()
|
||||
Comparison_result res = traits->compare_xy_2_object()
|
||||
(intersection_point->first, v->point());
|
||||
|
||||
|
||||
// v is an intersection points, so both curves are equal there:
|
||||
if (res == EQUAL)
|
||||
equal_at_v = true;
|
||||
|
||||
|
||||
// We passed the next vertex, so we can stop here.
|
||||
if (res == LARGER)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Create a new vertex in the output diagram that corrsponds to the
|
||||
// current intersection point.
|
||||
if (is_in_x_range) {
|
||||
|
|
@ -708,7 +708,7 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
Vertex_handle new_v = (current_res == SMALLER) ?
|
||||
_append_vertex(out_d, intersection_point->first, e1) :
|
||||
_append_vertex(out_d, intersection_point->first, e2);
|
||||
|
||||
|
||||
// if we are at v, then this is a special case that is handled after
|
||||
// the loop. We need to add the curves from the original vertices.
|
||||
if (equal_at_v == false) {
|
||||
|
|
@ -716,7 +716,7 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
new_v->add_curves(e1->curves_begin(), e1->curves_end());
|
||||
new_v->add_curves(e2->curves_begin(), e2->curves_end());
|
||||
}
|
||||
|
||||
|
||||
// Update the handle to the rightmost vertex in the output diagram.
|
||||
v_leftmost = new_v;
|
||||
}
|
||||
|
|
@ -724,7 +724,7 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
// Update the relative position of the two curves, which is their
|
||||
// order immediately to the right of their last observed intersection
|
||||
// point.
|
||||
|
||||
|
||||
// Get the curve order immediately to the right of the intersection
|
||||
// point. Note that in case of even (non-zero) multiplicity the order
|
||||
// remains the same.
|
||||
|
|
@ -750,22 +750,22 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
// We have an x-monotone curve representing an overlap of the two
|
||||
// curves.
|
||||
intersection_curve = CGAL::object_cast<X_monotone_curve_2>(&obj);
|
||||
|
||||
|
||||
if (intersection_curve == NULL)
|
||||
CGAL_error_msg("unrecognized intersection object.");
|
||||
|
||||
// Get the endpoints of the overlapping curves.
|
||||
const bool has_left =
|
||||
(traits->parameter_space_in_x_2_object()
|
||||
const bool has_left =
|
||||
(traits->parameter_space_in_x_2_object()
|
||||
(*intersection_curve, ARR_MIN_END) == ARR_INTERIOR);
|
||||
const bool has_right =
|
||||
(traits->parameter_space_in_x_2_object()
|
||||
const bool has_right =
|
||||
(traits->parameter_space_in_x_2_object()
|
||||
(*intersection_curve, ARR_MAX_END) == ARR_INTERIOR);
|
||||
Point_2 p_left, p_right;
|
||||
|
||||
|
||||
if (has_left)
|
||||
p_left = traits->construct_min_vertex_2_object()(*intersection_curve);
|
||||
|
||||
|
||||
if (has_right)
|
||||
p_right = traits->construct_max_vertex_2_object()(*intersection_curve);
|
||||
|
||||
|
|
@ -781,22 +781,22 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
// However, we update the last intersection point observed.
|
||||
is_in_x_range = false;
|
||||
}
|
||||
|
||||
|
||||
if (is_in_x_range && v_exists && has_left) {
|
||||
Comparison_result res =
|
||||
traits->compare_xy_2_object()(p_left, v->point());
|
||||
|
||||
|
||||
// v is an intersection points, so both curves are equal there:
|
||||
if (res == EQUAL)
|
||||
equal_at_v = true;
|
||||
|
||||
|
||||
// We passed the next vertex, so we can stop here.
|
||||
if (res == LARGER)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// There is an overlap between the range [u, v] and intersection_curve.
|
||||
if (is_in_x_range && has_left &&
|
||||
if (is_in_x_range && has_left &&
|
||||
(! v_leftmost ||
|
||||
(traits->compare_xy_2_object()(p_left, (*v_leftmost)->point()) ==
|
||||
LARGER)))
|
||||
|
|
@ -808,7 +808,7 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
Vertex_handle new_v = (current_res == SMALLER) ?
|
||||
_append_vertex(out_d, p_left, e1) :
|
||||
_append_vertex(out_d, p_left, e2);
|
||||
|
||||
|
||||
// if we are at v, then this is a special case that is handled after
|
||||
// the loop. We need to add the curves from the original vertices.
|
||||
if (equal_at_v == false) {
|
||||
|
|
@ -817,11 +817,11 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
new_v->add_curves(e1->curves_begin(), e1->curves_end());
|
||||
new_v->add_curves(e2->curves_begin(), e2->curves_end());
|
||||
}
|
||||
|
||||
|
||||
// Update the handle to the rightmost vertex in the output diagram.
|
||||
v_leftmost = new_v;
|
||||
}
|
||||
|
||||
|
||||
if (is_in_x_range && has_right &&
|
||||
(! v_exists ||
|
||||
(traits->compare_xy_2_object()(p_right, v->point()) == SMALLER)))
|
||||
|
|
@ -829,7 +829,7 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
// Create an edge that represents the overlapping curve.
|
||||
Vertex_handle new_v = _append_vertex(out_d, p_right, e1);
|
||||
new_v->left()->add_curves(e2->curves_begin(), e2->curves_end());
|
||||
|
||||
|
||||
// We are not at v becuase p_right is smaller than v.
|
||||
// The special case that we are at v is handled in the next
|
||||
// condition.
|
||||
|
|
@ -838,12 +838,12 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
CGAL_assertion(equal_at_v == false);
|
||||
new_v->add_curves(e1->curves_begin(), e1->curves_end());
|
||||
new_v->add_curves(e2->curves_begin(), e2->curves_end());
|
||||
|
||||
|
||||
// Update the handle to the rightmost vertex in the output diagram.
|
||||
v_leftmost = new_v;
|
||||
}
|
||||
|
||||
if (has_right == false ||
|
||||
|
||||
if (has_right == false ||
|
||||
(v_exists && traits->compare_xy_2_object()(p_right, v->point()) !=
|
||||
SMALLER))
|
||||
{
|
||||
|
|
@ -852,7 +852,7 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
Vertex_handle new_v = _append_vertex(out_d, v->point(), e1);
|
||||
new_v->left()->add_curves(e2->curves_begin(), e2->curves_end());
|
||||
}
|
||||
|
||||
|
||||
equal_at_v = true;
|
||||
current_res = EQUAL;
|
||||
break;
|
||||
|
|
@ -867,7 +867,7 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
// Flip the result in case of an upper envelope.
|
||||
if (env_type == UPPER)
|
||||
current_res = CGAL::opposite (current_res);
|
||||
|
||||
|
||||
}
|
||||
} // End of the traversal over the intersection objects.
|
||||
|
||||
|
|
@ -883,11 +883,11 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
Vertex_handle v_to_be_updated = out_d.rightmost()->left();
|
||||
|
||||
if (origin_of_v == EQUAL) {
|
||||
// If the vertices of the edge are the same, we have to get the
|
||||
// If the vertices of the edge are the same, we have to get the
|
||||
// curves from there:
|
||||
v_to_be_updated->add_curves(e1->right()->curves_begin(),
|
||||
v_to_be_updated->add_curves(e1->right()->curves_begin(),
|
||||
e1->right()->curves_end());
|
||||
v_to_be_updated->add_curves(e2->right()->curves_begin(),
|
||||
v_to_be_updated->add_curves(e2->right()->curves_begin(),
|
||||
e2->right()->curves_end());
|
||||
}
|
||||
else {
|
||||
|
|
@ -898,10 +898,10 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
v_to_be_updated->add_curves (v->curves_begin(), v->curves_end());
|
||||
v_to_be_updated->add_curves (e->curves_begin(), e->curves_end());
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (! v_exists) {
|
||||
// Both edges are unbounded from the right, so we simply have
|
||||
// to update the rightmost edge in out_d.
|
||||
|
|
@ -930,9 +930,9 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
// For example:
|
||||
// First diagram is the segment: [(0, -1), (1, 0)]
|
||||
// Second diagram of the two segments: [(0, 0), (1, 1)], [(1, 0), (2, 1)]
|
||||
|
||||
|
||||
// Check if we need to insert v into the diagram.
|
||||
if (current_res == SMALLER) {
|
||||
if (current_res == SMALLER) {
|
||||
// The final part of the interval is taken from e1.
|
||||
Vertex_handle new_v;
|
||||
|
||||
|
|
@ -947,25 +947,25 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
if (origin_of_v == EQUAL) {
|
||||
new_v = _append_vertex(out_d, v->point(), e1);
|
||||
new_v->add_curves(v->curves_begin(), v->curves_end());
|
||||
|
||||
|
||||
// adding the curves of the vertex of the first diagram (vertices are
|
||||
// equal...)
|
||||
new_v->add_curves(e1->right()->curves_begin(),
|
||||
new_v->add_curves(e1->right()->curves_begin(),
|
||||
e1->right()->curves_end());
|
||||
}
|
||||
else {
|
||||
// If v is from e2, check if it below (or above, in case of an upper
|
||||
// envelope) cv1 to insert it.
|
||||
const Comparison_result res =
|
||||
const Comparison_result res =
|
||||
traits->compare_y_at_x_2_object()(v->point(), e1->curve());
|
||||
|
||||
|
||||
if (res == EQUAL ||
|
||||
((env_type == LOWER) && (res == SMALLER)) ||
|
||||
((env_type == UPPER) && (res == LARGER)))
|
||||
{
|
||||
new_v = _append_vertex(out_d, v->point(), e1);
|
||||
new_v->add_curves(v->curves_begin(), v->curves_end());
|
||||
|
||||
|
||||
if (res == EQUAL)
|
||||
new_v->add_curves(e1->curves_begin(), e1->curves_end());
|
||||
}
|
||||
|
|
@ -980,7 +980,7 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
// In case v is also from e2, append it to the merged diagram.
|
||||
new_v = _append_vertex(out_d, v->point(), e2);
|
||||
new_v->add_curves(v->curves_begin(), v->curves_end());
|
||||
|
||||
|
||||
// if origin_of_v is EQUAL then the two diagram have a vertex at
|
||||
// exact same place.
|
||||
if (origin_of_v == EQUAL) {
|
||||
|
|
@ -993,16 +993,16 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
|
|||
else {
|
||||
// If v is from e1, check if it below (or above, in case of an upper
|
||||
// envelope) cv2 to insert it.
|
||||
const Comparison_result res =
|
||||
const Comparison_result res =
|
||||
traits->compare_y_at_x_2_object()(v->point(), e2->curve());
|
||||
|
||||
|
||||
if (res == EQUAL ||
|
||||
((env_type == LOWER) && (res == SMALLER)) ||
|
||||
((env_type == UPPER) && (res == LARGER)))
|
||||
{
|
||||
new_v = _append_vertex(out_d, v->point(), e2);
|
||||
new_v->add_curves(v->curves_begin(), v->curves_end());
|
||||
|
||||
|
||||
if (res == EQUAL)
|
||||
new_v->add_curves(e2->curves_begin(), e2->curves_end());
|
||||
}
|
||||
|
|
@ -1024,14 +1024,14 @@ _append_vertex(Envelope_diagram_1& diag,
|
|||
// Create the new vertex and the new edge.
|
||||
Vertex_handle new_v = diag.new_vertex(p);
|
||||
Edge_handle new_e = diag.new_edge();
|
||||
|
||||
|
||||
if (! e->is_empty())
|
||||
new_e->add_curves(e->curves_begin(), e->curves_end());
|
||||
|
||||
|
||||
// Connect the new vertex.
|
||||
new_v->set_left(new_e);
|
||||
new_v->set_right(diag.rightmost());
|
||||
|
||||
|
||||
if (diag.leftmost() != diag.rightmost()) {
|
||||
// The diagram is not empty. Connect the new edge to the left of the
|
||||
// rightmost edge of the diagram.
|
||||
|
|
@ -1044,18 +1044,18 @@ _append_vertex(Envelope_diagram_1& diag,
|
|||
// The diagram is empty: Make the new edge the leftmost.
|
||||
new_e->set_right(new_v);
|
||||
diag.set_leftmost(new_e);
|
||||
diag.rightmost()->set_left(new_v);
|
||||
diag.rightmost()->set_left(new_v);
|
||||
}
|
||||
|
||||
|
||||
return (new_v);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Merge the vertical segments into the envelope given as a minimization
|
||||
// (or maximization) diagram.
|
||||
//
|
||||
template <class Traits, class Diagram>
|
||||
void Envelope_divide_and_conquer_2<Traits,Diagram>::
|
||||
void Envelope_divide_and_conquer_2<Traits, Diagram>::
|
||||
_merge_vertical_segments(Curve_pointer_vector& vert_vec,
|
||||
Envelope_diagram_1& out_d)
|
||||
{
|
||||
|
|
@ -1104,7 +1104,7 @@ _merge_vertical_segments(Curve_pointer_vector& vert_vec,
|
|||
in_e_range = true;
|
||||
on_v = false;
|
||||
}
|
||||
|
||||
|
||||
// If the current vertical segment is not in the x-range of the current
|
||||
// edge, we proceed to the next edge.
|
||||
if (! in_e_range) {
|
||||
|
|
@ -1114,7 +1114,7 @@ _merge_vertical_segments(Curve_pointer_vector& vert_vec,
|
|||
|
||||
// Go over all vertical segments that share the same x-coordinate and
|
||||
// find the one(s) with the smallest endpoint (or largest endpoint, if
|
||||
// we construct an upper envelope).
|
||||
// we construct an upper envelope).
|
||||
std::list<X_monotone_curve_2> env_cvs;
|
||||
|
||||
env_cvs.push_back(**iter);
|
||||
|
|
@ -1189,7 +1189,7 @@ _merge_vertical_segments(Curve_pointer_vector& vert_vec,
|
|||
else {
|
||||
// Compare p with the current curve.
|
||||
res = comp_y_at_x(p, e->curve());
|
||||
|
||||
|
||||
if (((env_type == LOWER) && (res != LARGER)) ||
|
||||
((env_type == UPPER) && (res != SMALLER)))
|
||||
{
|
||||
|
|
@ -1220,15 +1220,15 @@ _split_edge(Envelope_diagram_1& diag, const Point_2& p, Edge_handle e)
|
|||
// Create the new vertex and the new edge.
|
||||
Vertex_handle new_v = diag.new_vertex(p);
|
||||
Edge_handle new_e = diag.new_edge();
|
||||
|
||||
|
||||
// Duplicate the curves container associated with e.
|
||||
if (! e->is_empty())
|
||||
new_e->add_curves(e->curves_begin(), e->curves_end());
|
||||
|
||||
|
||||
// Connect the new vertex between e and new_e.
|
||||
new_v->set_left(e);
|
||||
new_v->set_right(new_e);
|
||||
|
||||
|
||||
new_e->set_left(new_v);
|
||||
if (e != diag.rightmost())
|
||||
new_e->set_right(e->right());
|
||||
|
|
|
|||
|
|
@ -39,6 +39,21 @@ Release date: March 2019
|
|||
graph pointer in the case they are configured to deal with a possible different
|
||||
graph per primitive (configuration set using a template tag).
|
||||
|
||||
### 2D Arrangements
|
||||
|
||||
- Fixed a bug in the surface-sweep framework (`Surface_sweep_2`) that ensures
|
||||
that an event is never left without (left or right) curves.
|
||||
|
||||
- Fixed a constructor of `Arr_counting_traits.h`. (In particular, added missing
|
||||
const of a parameter).
|
||||
|
||||
- Fixed zone computation of a curve in cases where the lexicographic smallest
|
||||
end of the curve lies on the parameter space.
|
||||
|
||||
- Implemented missing function object `Compare_x_near_boundary` of
|
||||
`Arr_polyline_traits_2`, `Arr_polycurve_traits_2`, and
|
||||
`Arr_polycurve_basic_traits_2`.
|
||||
|
||||
Release 4.13
|
||||
------------
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -935,6 +935,10 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv,
|
|||
CGAL_SS_PRINT_CURVE(overlap_sc);
|
||||
CGAL_SS_PRINT_EOL();
|
||||
|
||||
// add the overlapping curve of the right of the left end
|
||||
_add_curve_to_right(left_event, overlap_sc);
|
||||
right_event->add_curve_to_left(overlap_sc);
|
||||
|
||||
// Remove curves from the left curves of the right end
|
||||
// and add them on the right otherwise
|
||||
if (c1->is_end_point(right_event))
|
||||
|
|
@ -947,10 +951,6 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv,
|
|||
else
|
||||
_add_curve_to_right(right_event, c2);
|
||||
|
||||
// add the overlapping curve of the right of the left end
|
||||
_add_curve_to_right(left_event, overlap_sc);
|
||||
right_event->add_curve_to_left(overlap_sc);
|
||||
|
||||
this->m_visitor->found_overlap(c1, c2, overlap_sc);
|
||||
|
||||
if (!c1->is_end_point(right_event) && !c2->is_end_point(right_event))
|
||||
|
|
|
|||
Loading…
Reference in New Issue