diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h index 1ca8328129a..16f9a57e6b5 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h @@ -43,7 +43,7 @@ namespace CGAL { -/*! \class +/*! \class * A model of the ArrangementTraits_2 concept that counts the methods invoked. */ template @@ -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, diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h index 4b5abbee86a..96c708a59ed 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h @@ -18,15 +18,16 @@ // $Date$ // // -// Author(s) : Ron Wein s -// Efi Fogel -// Eric Berberich -// (based on old version by Iddo Hanniel -// Eyal Flato -// Oren Nechushtan -// Efi Fogel -// Ron Wein -// Idit Haran) +// Author(s): Ron Wein s +// Efi Fogel +// Eric Berberich +// (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::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 { public: - // Traits-class geometric types. - typedef ArrangementTraits_ Base_traits_2; - typedef Arr_traits_basic_adaptor_2 Base; + typedef ArrangementTraits_ Base_traits_2; + typedef Arr_traits_basic_adaptor_2 Base; + typedef Arr_traits_adaptor_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,385 @@ 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 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; + + /*! 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 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 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); + 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(); + 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); + 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(); + 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 + 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(); + 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; + } + + /*! Compare two x-monotone curves lexigoraphically. + */ + Comparison_result operator()(const X_monotone_curve_2& c1, + const X_monotone_curve_2& c2, + std::list& intersections, + Arr_all_sides_oblivious_tag 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 slopes to their right: + typedef typename Self::Compare_y_at_x_right_2 Compare_y_at_x_right_2; + Compare_y_at_x_right_2 cmp_y_at_x_right = + m_self.compare_y_at_x_right_2_object(); + res = cmp_y_at_x_right(c1, c2, c1_min); + if (res != EQUAL) return res; + + // 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, tag); + } + + /*! + */ + Comparison_result operator()(const X_monotone_curve_2& c1, + const X_monotone_curve_2& c2, + std::list& 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); + 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(); + 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); + 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(); + 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 + 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(); + 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 slopes to their right: + //! \todo + } + + + 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; + + // \todo what if open? + 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 == SMALLER) return SMALLER; + + //! \todo + } + + // \todo what if open + if (min_px1 == 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. + CGAL_assertion(min_px2 == ARR_RIGHT_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; + + 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; + + //! \todo + } + return EQUAL; + } + }; + + /*! 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: diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Construction_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Construction_test.h index 765d810c4e0..9aae6a62e83 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Construction_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Construction_test.h @@ -270,10 +270,9 @@ bool Construction_test::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 curve_compare(m_geom_traits); std::sort(curves_res.begin(), xcit, curve_compare); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_adaptor_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_adaptor_test.h index a131d189f26..aa908722862 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_adaptor_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_adaptor_test.h @@ -6,17 +6,20 @@ #include "Traits_base_test.h" -template +template class Traits_adaptor_test : - public Traits_base_test + public Traits_base_test { public: - typedef Geom_traits_T Geom_traits; - typedef Traits_base_test Base; + typedef GeomTraits Geom_traits; + typedef BaseGeomTraits Base_geom_traits; + typedef Traits_base_test Base; private: + typedef Traits_adaptor_test 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 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 -Traits_adaptor_test:: -Traits_adaptor_test(const Geom_traits_T& geom_traits) : +template +Traits_adaptor_test:: +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::ta_compare_y_at_x_left_wrapper; - m_wrappers[std::string("is_in_x_range")] = - &Traits_adaptor_test::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::ta_compare_y_position_wrapper; - m_wrappers[std::string("is_between_cw")] = - &Traits_adaptor_test::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::ta_compare_cw_around_point_wrapper; - m_wrappers[std::string("are_mergeable")] = - &Traits_adaptor_test::ta_are_mergeable_wrapper; - m_wrappers[std::string("merge")] = - &Traits_adaptor_test::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 -Traits_adaptor_test::~Traits_adaptor_test() {} +template +Traits_adaptor_test::~Traits_adaptor_test() {} -template -bool Traits_adaptor_test:: -ta_compare_y_at_x_left_wrapper(std::istringstream & str_stream) +template +bool Traits_adaptor_test:: +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 +bool Traits_adaptor_test:: +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 -bool Traits_adaptor_test:: -ta_compare_y_at_x_left_wrapper_imp(std::istringstream &, CGAL::Tag_false) +template +bool Traits_adaptor_test:: +ta_compare_y_at_x_left_wrapper_imp(std::istringstream&, CGAL::Tag_false) { CGAL_error(); return false; } -template -bool Traits_adaptor_test:: -ta_compare_y_at_x_left_wrapper_imp(std::istringstream & str_stream, +template +bool Traits_adaptor_test:: +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 -bool Traits_adaptor_test:: -ta_is_in_x_range_wrapper(std::istringstream & str_stream) +template +bool Traits_adaptor_test:: +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 -bool Traits_adaptor_test:: -ta_compare_y_position_wrapper(std::istringstream & str_stream) +template +bool Traits_adaptor_test:: +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 -bool Traits_adaptor_test:: -ta_is_between_cw_wrapper(std::istringstream & str_stream) +template +bool Traits_adaptor_test:: +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 -bool Traits_adaptor_test:: -ta_compare_cw_around_point_wrapper(std::istringstream & str_stream) +template +bool Traits_adaptor_test:: +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 -bool Traits_adaptor_test:: -ta_are_mergeable_wrapper(std::istringstream & str_stream) +template +bool Traits_adaptor_test:: +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 -bool Traits_adaptor_test:: -ta_are_mergeable_wrapper_imp(std::istringstream &, CGAL::Tag_false) +template +bool Traits_adaptor_test:: +ta_are_mergeable_wrapper_imp(std::istringstream&, CGAL::Tag_false) { CGAL_error(); return false; } -template -bool Traits_adaptor_test:: -ta_are_mergeable_wrapper_imp (std::istringstream & str_stream, CGAL::Tag_true) +template +bool Traits_adaptor_test:: +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 -bool Traits_adaptor_test::ta_merge_wrapper -(std::istringstream & str_stream) +template +bool Traits_adaptor_test::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 -bool Traits_adaptor_test:: -ta_merge_wrapper_imp(std::istringstream &, CGAL::Tag_false) +template +bool Traits_adaptor_test:: +ta_merge_wrapper_imp(std::istringstream&, CGAL::Tag_false) { CGAL_error(); return false; } -template -bool Traits_adaptor_test:: -ta_merge_wrapper_imp(std::istringstream & str_stream, CGAL::Tag_true) +template +bool Traits_adaptor_test:: +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); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake index 3d1c81422e4..1baad5bed5f 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake @@ -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() diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base index bfd9c7c30b6..b851db98535 100755 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base @@ -636,6 +636,7 @@ execute_commands_traits_adaptor() commands_indicator[PARAMETER_SPACE_X]=0 commands_indicator[PARAMETER_SPACE_Y]=0 + commands_indicator[COMPARE_XY]=0 commands_indicator[COMPARE_X_AT_LIMIT]=0 commands_indicator[COMPARE_X_NEAR_LIMIT]=0 commands_indicator[COMPARE_X_ON_BOUNDARY]=0 @@ -764,7 +765,7 @@ 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 \ + COMAPRE_XY COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT \ ARE_MERGEABLE MERGE IS_IN_X_RANGE IS_BETWEEN_CW else echo " ERROR: not executed test_traits_adaptor segment_traits" >> $ERRORFILE @@ -785,7 +786,7 @@ test_linear_traits_adaptor() compile_test_with_flags test_traits_adaptor linear "$flags" if [ -n "${SUCCESS}" ] ; then execute_commands_traits_adaptor linear linear_traits_adaptor \ - COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE \ + COMAPRE_XY COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE \ COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT else echo " ERROR: not executed test_traits_adaptor linear_traits" >> $ERRORFILE @@ -807,7 +808,7 @@ test_spherical_arcs_traits_adaptor() compile_test_with_flags test_traits_adaptor geodesic_arcs_on_sphere "$flags" if [ -n "${SUCCESS}" ] ; then execute_commands_traits_adaptor spherical_arcs spherical_arcs_traits_adaptor \ - COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE \ + COMAPRE_XY COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE \ COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT else echo " ERROR: not executed test_traits_adaptor spherical_arcs_traits" >> $ERRORFILE diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_adaptor/linear/compare_xy b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_adaptor/linear/compare_xy new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_adaptor/segments/compare_xy b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_adaptor/segments/compare_xy new file mode 100644 index 00000000000..a7e415642d6 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_adaptor/segments/compare_xy @@ -0,0 +1 @@ +compare_xy 0 8 SMALLER diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_adaptor/spherical_arcs/compare_xy b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_adaptor/spherical_arcs/compare_xy new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test02.txt index b1ab6f94e35..d2e02685a7b 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test02.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test02.txt @@ -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 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test02.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test02.wrl index dc2e1d212d5..b0b0340b5f5 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test02.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test02.wrl @@ -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 { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test03.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test03.txt index ad307e34575..536b0e2a3ef 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test03.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test03.txt @@ -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 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test03.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test03.wrl index e454612c276..cd6e82a854a 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test03.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test03.wrl @@ -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 { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test04.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test04.txt index c20a698706e..bcfab95ed3b 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test04.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test04.txt @@ -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 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test04.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test04.wrl index a443773bb47..9e8b79bbed1 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test04.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test04.wrl @@ -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 { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test05.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test05.txt index 44aa26cc32d..e4ed16a1ebc 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test05.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test05.txt @@ -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 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test05.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test05.wrl index f95dd63c57e..a661c66d873 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test05.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test05.wrl @@ -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 { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test06.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test06.txt index 8792e363b5f..658fd5f068d 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test06.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test06.txt @@ -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 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test06.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test06.wrl index 5248aa896ae..ee37345c097 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test06.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test06.wrl @@ -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 { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test07.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test07.txt index acbe5b65b46..ec675aa443a 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test07.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test07.txt @@ -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 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test07.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test07.wrl index 6bdf7a0060e..45c720f39ef 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test07.wrl +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test07.wrl @@ -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 { diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test08.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test08.txt new file mode 100644 index 00000000000..61e574fb040 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test08.txt @@ -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 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test08.wrl b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test08.wrl new file mode 100644 index 00000000000..c37bd6f5552 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/geodesic_arcs_on_sphere/test08.wrl @@ -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 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/linear/test02.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/linear/test02.txt index 19d47e982d0..aad4b278b1f 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/linear/test02.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/linear/test02.txt @@ -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 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_construction.geodesic_arcs_on_sphere.cmd b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_construction.geodesic_arcs_on_sphere.cmd index 7815b7d3418..fd1ff7f2196 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_construction.geodesic_arcs_on_sphere.cmd +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_construction.geodesic_arcs_on_sphere.cmd @@ -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 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_adaptor.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_adaptor.cpp index ca64e4b5f15..8f0e88de89b 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_adaptor.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_adaptor.cpp @@ -11,7 +11,7 @@ int main (int argc, char * argv[]) { Geom_traits traits; - Traits_adaptor_test test(traits); + Traits_adaptor_test test(traits); if (!test.parse(argc, argv)) return -1; if (!test.init()) return -1; if (!test.perform()) return -1; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_adaptor.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_adaptor.h index eea3199de9b..621bd3193ac 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_adaptor.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_adaptor.h @@ -5,7 +5,7 @@ #include "test_geom_traits.h" -typedef CGAL::Arr_traits_basic_adaptor_2 Geom_traits; +typedef CGAL::Arr_traits_adaptor_2 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; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/utils.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/utils.h index 6fe7467a20f..8ce1093e010 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/utils.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/utils.h @@ -3,6 +3,7 @@ #include #include #include +#include #include @@ -103,32 +104,25 @@ private: } }; -template +template 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_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)); } }; diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh1.pdf b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh1.pdf new file mode 100644 index 00000000000..15588b5f4f4 Binary files /dev/null and b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh1.pdf differ diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh1_1.pdf b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh1_1.pdf new file mode 100644 index 00000000000..b9ea13672ba Binary files /dev/null and b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh1_1.pdf differ diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh2.pdf b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh2.pdf new file mode 100644 index 00000000000..2dc07e3b7af Binary files /dev/null and b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh2.pdf differ diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh2_2.pdf b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh2_2.pdf new file mode 100644 index 00000000000..ef9242ab622 Binary files /dev/null and b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh2_2.pdf differ diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh3.pdf b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh3.pdf new file mode 100644 index 00000000000..9db581c7355 Binary files /dev/null and b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh3.pdf differ diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh4.pdf b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh4.pdf new file mode 100644 index 00000000000..a07d8e6e9f6 Binary files /dev/null and b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh4.pdf differ diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh4_1.pdf b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh4_1.pdf new file mode 100644 index 00000000000..49cf7d76fae Binary files /dev/null and b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh4_1.pdf differ diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh4_2.pdf b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh4_2.pdf new file mode 100644 index 00000000000..984ed6a6f61 Binary files /dev/null and b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh4_2.pdf differ diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh5.pdf b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh5.pdf new file mode 100644 index 00000000000..ec8971c5413 Binary files /dev/null and b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh5.pdf differ diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh6.pdf b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh6.pdf new file mode 100644 index 00000000000..06aefa4a033 Binary files /dev/null and b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh6.pdf differ diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh6_7.pdf b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh6_7.pdf new file mode 100644 index 00000000000..042440c22b4 Binary files /dev/null and b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh6_7.pdf differ diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh7.pdf b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh7.pdf new file mode 100644 index 00000000000..6d75c472692 Binary files /dev/null and b/Minkowski_sum_2/test/Minkowski_sum_2/data/pwh7.pdf differ diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h index fd403ae181f..e2a75d6375e 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h @@ -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))