diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.h index ad11ff92ebc..29b605e2004 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.h @@ -325,16 +325,16 @@ protected: Poly_const_max_v poly_const_max_v=poly_tr.construct_max_vertex_2_object(); // Construct needed functors from the segment traits - typedef typename Arr_poly_traits::Segment_traits_2 Segment_traits; - typedef typename Segment_traits::Construct_min_vertex_2 Seg_const_min_v; - typedef typename Segment_traits::Construct_max_vertex_2 Seg_const_max_v; - Seg_const_min_v construct_min_v = poly_tr.segment_traits_2()-> + typedef typename Arr_poly_traits::Subcurve_traits_2 Subcurve_traits; + typedef typename Subcurve_traits::Construct_min_vertex_2 Seg_const_min_v; + typedef typename Subcurve_traits::Construct_max_vertex_2 Seg_const_max_v; + Seg_const_min_v construct_min_v = poly_tr.subcurve_traits_2()-> construct_min_vertex_2_object(); - Seg_const_max_v construct_max_v = poly_tr.segment_traits_2()-> + Seg_const_max_v construct_max_v = poly_tr.subcurve_traits_2()-> construct_max_vertex_2_object(); // Iterator of the segments of an x-monotone polyline - typename X_monotone_curve_2::Segment_const_iterator seg_it; + typename X_monotone_curve_2::Subcurve_const_iterator seg_it; QVector< QPointF > pts; // holds the points of the polygon X_monotone_curve_2 cv; @@ -349,8 +349,8 @@ protected: // Determine the direction of cv (left-to-right or right-to-left) Comparison_result dir = comp_end_pts(cv); - for (seg_it = cv.begin_segments(); - seg_it != cv.end_segments() ; ++seg_it) + for (seg_it = cv.begin_subcurves(); + seg_it != cv.end_subcurves() ; ++seg_it) { if (dir == SMALLER) { diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.h index 6aaf8cf11a9..faef95b6b01 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.h @@ -259,9 +259,9 @@ public: public: // methods ArrangementPainterOstream& operator<<( const X_monotone_curve_2& curve ) { - for (typename X_monotone_curve_2::Segment_const_iterator it = - curve.begin_segments(); - it != curve.end_segments(); ++it) + for (typename X_monotone_curve_2::Subcurve_const_iterator it = + curve.begin_subcurves(); + it != curve.end_subcurves(); ++it) { this->painterOstream << *it; } diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils.h index 488e48b5d31..a34146fb31d 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils.h @@ -338,16 +338,16 @@ public: typedef typename Kernel::Segment_2 Segment_2; typedef typename Traits::Curve_2 Curve_2; typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Curve_2::Segment_const_iterator Seg_const_it; + typedef typename Curve_2::Subcurve_const_iterator Seg_const_it; double operator() ( const Point_2& p, const X_monotone_curve_2& c ) const { - Seg_const_it seg_it_s = c.begin_segments(); + Seg_const_it seg_it_s = c.begin_subcurves(); bool first = true; FT min_dist = 0; - while (seg_it_s != c.end_segments()) + while (seg_it_s != c.end_subcurves()) { Segment_2 seg = *seg_it_s; FT dist = this->squared_distance( p, seg ); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h index a01e336c242..24de3e16a1c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_basic_traits_2.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include @@ -73,7 +73,7 @@ private: typedef Arr_polycurve_basic_traits_2 Self; // Data members: - const Subcurve_traits_2* m_geometry_traits; // The base segment-traits class. + const Subcurve_traits_2* m_subcurve_traits; // The base segment-traits class. bool m_own_traits; protected: @@ -82,7 +82,7 @@ protected: public: /*! Construct default. */ Arr_polycurve_basic_traits_2() : - m_geometry_traits(new Subcurve_traits_2()), + m_subcurve_traits(new Subcurve_traits_2()), m_own_traits(true) {} @@ -91,20 +91,20 @@ public: * be used by the class. */ Arr_polycurve_basic_traits_2(const Subcurve_traits_2* geom_traits) : - m_geometry_traits(geom_traits), m_own_traits(false){ } + m_subcurve_traits(geom_traits), m_own_traits(false){ } /* Destructor * Deletes the subcurve tarits class in case it was constructed during the * construction of this. */ ~Arr_polycurve_basic_traits_2() - { if (m_own_traits) delete m_geometry_traits; } + { if (m_own_traits) delete m_subcurve_traits; } /*! Obtain the subcurve traits. * \return the subcurve traits. */ - const Subcurve_traits_2* geometry_traits_2() const - { return m_geometry_traits; } + const Subcurve_traits_2* subcurve_traits_2() const + { return m_subcurve_traits; } /// \name Types and functors defined here, required by the // ArrangementBasicTraits concept. @@ -114,7 +114,7 @@ public: * curve which is either strongly x-monotone or vertical. Again, * the polycurve is without degenerated subcurves. */ - typedef polyline::X_monotone_polyline_2 + typedef internal::X_monotone_polycurve_2 X_monotone_curve_2; typedef typename X_monotone_curve_2::Size Size; typedef typename X_monotone_curve_2::size_type size_type; @@ -145,7 +145,7 @@ public: * \pre p2 does not lie on the boundary. */ Comparison_result operator()(const Point_2& p1, const Point_2& p2) const - { return m_poly_traits.geometry_traits_2()->compare_x_2_object()(p1, p2); } + { return m_poly_traits.subcurve_traits_2()->compare_x_2_object()(p1, p2); } /*! Compare two ends of x-monotone curves in x. * \param xs1 the first curve. @@ -182,7 +182,7 @@ public: const Point_2& p2, Arr_all_sides_oblivious_tag) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); const Point_2& p1 = (ce1 == ARR_MAX_END) ? geom_traits->construct_max_vertex_2_object()(xs1) : geom_traits->construct_min_vertex_2_object()(xs1); @@ -195,7 +195,7 @@ public: const Point_2& p2, Arr_not_all_sides_oblivious_tag) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x = geom_traits->parameter_space_in_x_2_object(); const Arr_parameter_space ps_x1 = ps_x(xs1, ce1); @@ -226,7 +226,7 @@ public: Arr_curve_end ce2, Arr_all_sides_oblivious_tag) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); const Point_2& p1 = (ce1 == ARR_MAX_END) ? geom_traits->construct_max_vertex_2_object()(xs1) : geom_traits->construct_min_vertex_2_object()(xs1); @@ -243,7 +243,7 @@ public: Arr_curve_end ce2, Arr_not_all_sides_oblivious_tag) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x = geom_traits->parameter_space_in_x_2_object(); const Arr_parameter_space ps_x1 = ps_x(xs1, ce1); @@ -320,7 +320,7 @@ public: * \pre p2 does not lie on the boundary. */ Comparison_result operator()(const Point_2& p1, const Point_2& p2) const - { return m_poly_traits.geometry_traits_2()->compare_xy_2_object()(p1, p2); } + { return m_poly_traits.subcurve_traits_2()->compare_xy_2_object()(p1, p2); } /*! Compare two ends of x-monotone curves lexicographically. * \param xs1 the first curve. @@ -357,7 +357,7 @@ public: const Point_2& p2, Arr_all_sides_oblivious_tag) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); const Point_2& p1 = (ce1 == ARR_MAX_END) ? geom_traits->construct_max_vertex_2_object()(xs1) : geom_traits->construct_min_vertex_2_object()(xs1); @@ -370,7 +370,7 @@ public: const Point_2& p2, Arr_not_all_sides_oblivious_tag) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x = geom_traits->parameter_space_in_x_2_object(); typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y = @@ -407,7 +407,7 @@ public: Arr_curve_end ce2, Arr_all_sides_oblivious_tag) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); const Point_2& p1 = (ce1 == ARR_MAX_END) ? geom_traits->construct_max_vertex_2_object()(xs1) : geom_traits->construct_min_vertex_2_object()(xs1); @@ -424,7 +424,7 @@ public: Arr_curve_end ce2, Arr_not_all_sides_oblivious_tag) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x = geom_traits->parameter_space_in_x_2_object(); typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y = @@ -546,7 +546,7 @@ public: { CGAL_assertion(cv.number_of_subcurves() > 0); - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); if (geom_traits->compare_endpoints_xy_2_object()(cv[0]) == SMALLER) return geom_traits->construct_min_vertex_2_object()(cv[0]); @@ -584,7 +584,7 @@ public: { CGAL_assertion(cv.number_of_subcurves() > 0); - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); if (geom_traits->compare_endpoints_xy_2_object()(cv[0]) == SMALLER) return geom_traits-> @@ -621,7 +621,7 @@ public: // An x-monotone polycurve can represent a vertical segment only if it // is comprised of vertical segments. If the first subcurve is vertical, // all subcurves are vertical in an x-monotone polycurve - return m_poly_traits.geometry_traits_2()->is_vertical_2_object()(cv[0]); + return m_poly_traits.subcurve_traits_2()->is_vertical_2_object()(cv[0]); } }; @@ -637,7 +637,7 @@ public: const X_monotone_subcurve_2& xs2, Arr_all_sides_oblivious_tag) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); const Point_2& p = (ce1 == ARR_MAX_END) ? geom_traits->construct_max_vertex_2_object()(xs1) : geom_traits->construct_min_vertex_2_object()(xs1); @@ -650,7 +650,7 @@ public: const X_monotone_subcurve_2& xs2, Arr_not_all_sides_oblivious_tag) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x = geom_traits->parameter_space_in_x_2_object(); typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y = @@ -727,7 +727,7 @@ public: CGAL_precondition(i != INVALID_INDEX); // Compare the subcurve xcv[i] and p. - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); return geom_traits->compare_y_at_x_2_object()(p, xcv[i]); } @@ -792,7 +792,7 @@ public: CGAL_precondition(i2 != INVALID_INDEX); // Compare cv1[i1] and cv2[i2] at p's left. - return m_poly_traits.geometry_traits_2()-> + return m_poly_traits.subcurve_traits_2()-> compare_y_at_x_left_2_object()(cv1[i1], cv2[i2], p); } }; @@ -838,7 +838,7 @@ public: CGAL_precondition(i2 != INVALID_INDEX); // Compare cv1[i1] and cv2[i2] at p's right. - return m_poly_traits.geometry_traits_2()-> + return m_poly_traits.subcurve_traits_2()-> compare_y_at_x_right_2_object()(cv1[i1], cv2[i2], p); } }; @@ -866,7 +866,7 @@ public: * \return (true) if the two point are the same;(false) otherwise. */ bool operator()(const Point_2& p1, const Point_2& p2) const - { return m_poly_traits.geometry_traits_2()->equal_2_object()(p1, p2); } + { return m_poly_traits.subcurve_traits_2()->equal_2_object()(p1, p2); } /*! Check whether the two x-monotone curves are the same (have the same * graph). @@ -878,7 +878,7 @@ public: const X_monotone_curve_2& cv2) const { // Check the pairwise equality of the contained subcurves. - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Equal_2 equal = geom_traits->equal_2_object(); typename Subcurve_traits_2::Compare_x_2 compare_x = @@ -993,7 +993,7 @@ public: */ Comparison_result operator()(const X_monotone_curve_2& xcv) const { - return (m_poly_traits.geometry_traits_2()-> + return (m_poly_traits.subcurve_traits_2()-> compare_endpoints_xy_2_object()(xcv[0]) == SMALLER) ? (SMALLER) : (LARGER); } @@ -1031,7 +1031,7 @@ public: */ X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Construct_opposite_2 const_op = geom_traits->construct_opposite_2_object(); std::vector rev_segs(xcv.number_of_subcurves());; @@ -1067,7 +1067,7 @@ public: /*! Obtain an Approximate_2 functor object. */ Approximate_2 approximate_2_object() const - { return geometry_traits_2()->approximate_2_object(); } + { return subcurve_traits_2()->approximate_2_object(); } #else // The following block defines the nested types Approximate_number_type and // Approximate_2 and the member function approximate_2_object() based on the @@ -1108,7 +1108,7 @@ public: /*! Obtain an Approximate_2 functor object. */ Approximate_2 approximate_2_object_impl(boost::false_type) const - { return geometry_traits_2()->approximate_2_object(); } + { return subcurve_traits_2()->approximate_2_object(); } Approximate_2 approximate_2_object_impl(boost::true_type) const { } @@ -1147,7 +1147,7 @@ public: * allow a polycurve with degenerated subcurves. */ const Subcurve_traits_2* geom_traits = - m_poly_traits.geometry_traits_2(); + m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v = geom_traits->construct_min_vertex_2_object(); typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v = @@ -1160,9 +1160,9 @@ public: ); #ifdef CGAL_ALWAYS_LEFT_TO_RIGHT - if (m_poly_traits.geometry_traits_2()-> + if (m_poly_traits.subcurve_traits_2()-> compare_endpoints_xy_2_object()(seg) == LARGER) - return X_monotone_subcurve_2(m_poly_traits.geometry_traits_2()-> + return X_monotone_subcurve_2(m_poly_traits.subcurve_traits_2()-> construct_opposite_2_object()(seg)); #endif @@ -1228,7 +1228,7 @@ public: CGAL_precondition_code ( const Subcurve_traits_2* geom_traits = - m_poly_traits.geometry_traits_2(); + m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts = geom_traits->compare_endpoints_xy_2_object(); typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v = @@ -1285,7 +1285,7 @@ public: ); #ifdef CGAL_ALWAYS_LEFT_TO_RIGHT - if (m_poly_traits.geometry_traits_2()-> + if (m_poly_traits.subcurve_traits_2()-> compare_endpoints_xy_2_object()(*begin) == LARGER) { X_monotone_curve_2 xcv(begin, end); @@ -1346,7 +1346,7 @@ public: Arr_parameter_space operator()(const X_monotone_curve_2& xcv, Arr_curve_end ce) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); Comparison_result direction = geom_traits->compare_endpoints_xy_2_object()(xcv[0]); const X_monotone_subcurve_2& xs = @@ -1363,7 +1363,7 @@ public: */ Arr_parameter_space operator()(const Point_2 p) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); return geom_traits->parameter_space_in_x_2_object()(p); } }; @@ -1411,7 +1411,7 @@ public: Arr_parameter_space operator()(const X_monotone_curve_2& xcv, Arr_curve_end ce) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); Comparison_result direction = geom_traits->compare_endpoints_xy_2_object()(xcv[0]); const X_monotone_subcurve_2& xs = @@ -1429,7 +1429,7 @@ public: */ Arr_parameter_space operator()(const Point_2 p) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); return geom_traits->parameter_space_in_y_2_object()(p); } }; @@ -1475,7 +1475,7 @@ public: Arr_curve_end ce) const { const Subcurve_traits_2* geom_traits = - m_poly_traits.geometry_traits_2(); + m_poly_traits.subcurve_traits_2(); Comparison_result direction = geom_traits->compare_endpoints_xy_2_object()(xcv[0]); const X_monotone_subcurve_2& xs = @@ -1511,7 +1511,7 @@ public: const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + 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 = @@ -1568,7 +1568,7 @@ public: const X_monotone_curve_2& xcv, Arr_curve_end ce) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Compare_x_at_limit_2 compare_x_at_limit = geom_traits->compare_x_at_limit_2_object(); @@ -1581,7 +1581,7 @@ public: const X_monotone_curve_2 & xcv2, Arr_curve_end ce2/*! for xcv2 */) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Compare_x_at_limit_2 compare_x_at_limit = geom_traits->compare_x_at_limit_2_object(); @@ -1596,7 +1596,7 @@ public: const X_monotone_subcurve_2& xseg, Arr_curve_end ce2/*! for xseg */) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Compare_x_at_limit_2 compare_x_at_limit = geom_traits->compare_x_at_limit_2_object(); @@ -1645,7 +1645,7 @@ public: const X_monotone_curve_2 xcv2, Arr_curve_end ce) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Compare_x_near_limit_2 cmp_x_near_limit = geom_traits->compare_x_near_limit_2_object(); @@ -1688,7 +1688,7 @@ public: */ Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); return geom_traits->compare_y_on_boundary_2_object()(p1, p2); } }; @@ -1731,7 +1731,7 @@ public: const X_monotone_curve_2& xcv2, Arr_curve_end ce) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + 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 = @@ -1775,7 +1775,7 @@ public: */ bool operator()(const Point_2& p) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); return geom_traits->is_on_y_identification_2_object()(p); } @@ -1785,7 +1785,7 @@ public: */ bool operator()(const X_monotone_curve_2& xcv) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename X_monotone_curve_2::Subcurve_const_iterator it; for (it = xcv.begin_subcurves(); it != xcv.end_subcurves(); ++it) if (! geom_traits->is_on_y_identification_2_object()(*it)) return false; @@ -1820,7 +1820,7 @@ public: */ bool operator()(const Point_2& p) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); return geom_traits->is_on_x_identification_2_object()(p); } @@ -1830,7 +1830,7 @@ public: */ bool operator()(const X_monotone_curve_2& xcv) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename X_monotone_curve_2::Subcurve_const_iterator it; for (it = xcv.begin_subcurves(); it != xcv.end_subcurves(); ++it) if (! geom_traits->is_on_x_identification_2_object()(*it)) return false; @@ -1898,7 +1898,7 @@ public: CGAL_precondition_code ( const Subcurve_traits_2* geom_traits = - m_poly_traits.geometry_traits_2(); + m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts = geom_traits->compare_endpoints_xy_2_object(); Comparison_result dir = cmp_seg_endpts(seg); @@ -1954,7 +1954,7 @@ public: CGAL_precondition_code ( const Subcurve_traits_2* geom_traits = - m_poly_traits.geometry_traits_2(); + m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts = geom_traits->compare_endpoints_xy_2_object(); Comparison_result dir = cmp_seg_endpts(seg); @@ -2090,7 +2090,7 @@ public: typedef typename X_monotone_curve_2::size_type size_type; size_type num_seg = xcv.number_of_subcurves(); const Subcurve_traits_2* geom_traits = - m_poly_traits.geometry_traits_2(); + m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts = geom_traits->compare_endpoints_xy_2_object(); Comparison_result dir = cmp_seg_endpts(seg); @@ -2143,7 +2143,7 @@ public: typedef typename X_monotone_curve_2::size_type size_type; size_type num_seg = xcv.number_of_subcurves(); const Subcurve_traits_2* geom_traits = - m_poly_traits.geometry_traits_2(); + m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts = geom_traits->compare_endpoints_xy_2_object(); Comparison_result dir = cmp_seg_endpts(seg); @@ -2259,7 +2259,7 @@ public: const Point_2& src, const Point_2& tgt)const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Trim_2 trim = geom_traits->trim_2_object(); //check whether src and tgt lies on the polycurve/polycurve. @@ -2391,7 +2391,7 @@ protected: // The direction of cv. SMALLER means left-to-right and // otherwise right-to-left Comparison_result direction = - geometry_traits_2()->compare_endpoints_xy_2_object()(cv[0]); + subcurve_traits_2()->compare_endpoints_xy_2_object()(cv[0]); std::size_t from, to; if (direction == SMALLER) { from = 0; @@ -2474,7 +2474,7 @@ protected: Comparison_result operator()(const X_monotone_subcurve_2& xs, Arr_curve_end ce) { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); const Point_2& p = (ce == ARR_MAX_END) ? geom_traits->construct_max_vertex_2_object()(xs) : geom_traits->construct_min_vertex_2_object()(xs); @@ -2541,7 +2541,7 @@ protected: Arr_curve_end ce, Arr_not_all_sides_oblivious_tag) const { - const Subcurve_traits_2* geom_traits = geometry_traits_2(); + const Subcurve_traits_2* geom_traits = subcurve_traits_2(); if (geom_traits->is_vertical_2_object()(xcv[0])) { // Verify that q has the same x-coord as xcv (which is vertical) Compare_x_2 compare_x = compare_x_2_object(); @@ -2569,7 +2569,7 @@ protected: Arr_curve_end ce, Arr_all_sides_oblivious_tag) const { - const Subcurve_traits_2* geom_traits = geometry_traits_2(); + const Subcurve_traits_2* geom_traits = subcurve_traits_2(); const Point_2& p = (ce == ARR_MAX_END) ? geom_traits->construct_max_vertex_2_object()(xs) : geom_traits->construct_min_vertex_2_object()(xs); @@ -2587,7 +2587,7 @@ protected: const Point_2& p, Arr_not_all_sides_oblivious_tag) const { - const Subcurve_traits_2* geom_traits = geometry_traits_2(); + const Subcurve_traits_2* geom_traits = subcurve_traits_2(); if (geom_traits->is_vertical_2_object()(xcv[0])) { // Verify that q has the same x-coord as xcv (which is vertical) Compare_x_2 compare_x = compare_x_2_object(); @@ -2616,7 +2616,7 @@ protected: // std::size_t locate(const X_monotone_curve_2& xcv, const Point_2& q) const { - const Subcurve_traits_2* geom_traits = geometry_traits_2(); + const Subcurve_traits_2* geom_traits = subcurve_traits_2(); if (geom_traits->is_vertical_2_object()(xcv[0])) { // Verify that q has the same x-coord as cv (which is vertical) typename Subcurve_traits_2::Construct_min_vertex_2 min_vertex = @@ -2652,17 +2652,17 @@ protected: if (i == INVALID_INDEX) return INVALID_INDEX; typename Subcurve_traits_2::Equal_2 equal = - geometry_traits_2()->equal_2_object(); + subcurve_traits_2()->equal_2_object(); typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts = - geometry_traits_2()->compare_endpoints_xy_2_object(); + subcurve_traits_2()->compare_endpoints_xy_2_object(); typename Subcurve_traits_2::Compare_x_2 comp_x = - geometry_traits_2()->compare_x_2_object(); + subcurve_traits_2()->compare_x_2_object(); typename Subcurve_traits_2::Is_vertical_2 is_vert = - geometry_traits_2()->is_vertical_2_object(); + subcurve_traits_2()->is_vertical_2_object(); typename Subcurve_traits_2::Construct_max_vertex_2 get_max_v = - geometry_traits_2()->construct_max_vertex_2_object(); + subcurve_traits_2()->construct_max_vertex_2_object(); typename Subcurve_traits_2::Construct_min_vertex_2 get_min_v = - geometry_traits_2()->construct_min_vertex_2_object(); + subcurve_traits_2()->construct_min_vertex_2_object(); Comparison_result direction = cmp_seg_endpts(cv[i]); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h index 50958f34140..ecca8cba6bb 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include @@ -129,7 +129,7 @@ public: /*! A polycurve represents a general continuous piecewise-linear * curve, without degenerated subcurves. */ - typedef polyline::Polyline_2 Curve_2; + typedef internal::Polycurve_2 Curve_2; /// \name Basic predicate functors(based on the subcurve traits). //@{ @@ -194,14 +194,14 @@ public: m_poly_traits.construct_x_monotone_curve_2_object(); typename Subcurve_traits_2::Make_x_monotone_2 make_seg_x_monotone = - m_poly_traits.geometry_traits_2()->make_x_monotone_2_object(); + m_poly_traits.subcurve_traits_2()->make_x_monotone_2_object(); typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts = - m_poly_traits.geometry_traits_2()->compare_endpoints_xy_2_object(); + m_poly_traits.subcurve_traits_2()->compare_endpoints_xy_2_object(); #ifdef CGAL_ALWAYS_LEFT_TO_RIGHT typename Subcurve_traits_2::Construct_opposite_2 ctr_seg_opposite = - m_poly_traits.geometry_traits_2()->construct_opposite_2_object(); + m_poly_traits.subcurve_traits_2()->construct_opposite_2_object(); #endif // Convert the input polycurve to a sequence of CGAL objects, such @@ -236,11 +236,11 @@ public: // To be used in order to verify continuity and well-orientedness // of the input curve cv. typename Subcurve_traits_2::Construct_min_vertex_2 min_seg_v = - m_poly_traits.geometry_traits_2()->construct_min_vertex_2_object(); + m_poly_traits.subcurve_traits_2()->construct_min_vertex_2_object(); typename Subcurve_traits_2::Construct_max_vertex_2 max_seg_v = - m_poly_traits.geometry_traits_2()->construct_max_vertex_2_object(); + m_poly_traits.subcurve_traits_2()->construct_max_vertex_2_object(); typename Subcurve_traits_2::Equal_2 equal = - m_poly_traits.geometry_traits_2()->equal_2_object(); + m_poly_traits.subcurve_traits_2()->equal_2_object(); Point_2 last_target = (cmp_seg_endpts(x_seg) == SMALLER) ? max_seg_v(x_seg) : min_seg_v(x_seg); Point_2 next_src; @@ -249,7 +249,7 @@ public: // The polycurve consists of at least 2 x-monotone subcurves: Push_back_2 push_back = m_poly_traits.push_back_2_object(); typename Subcurve_traits_2::Is_vertical_2 is_seg_vertical = - m_poly_traits.geometry_traits_2()->is_vertical_2_object(); + m_poly_traits.subcurve_traits_2()->is_vertical_2_object(); bool is_start_vertical = is_seg_vertical(x_seg); Comparison_result start_dir = cmp_seg_endpts(x_seg); @@ -330,19 +330,19 @@ public: m_poly_traits.construct_x_monotone_curve_2_object(); typename Subcurve_traits_2::Make_x_monotone_2 make_seg_x_monotone = - m_poly_traits.geometry_traits_2()->make_x_monotone_2_object(); + m_poly_traits.subcurve_traits_2()->make_x_monotone_2_object(); typename Subcurve_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts = - m_poly_traits.geometry_traits_2()->compare_endpoints_xy_2_object(); + m_poly_traits.subcurve_traits_2()->compare_endpoints_xy_2_object(); typename Subcurve_traits_2::Parameter_space_in_x_2 ps_x = - m_poly_traits.geometry_traits_2()->parameter_space_in_x_2_object(); + m_poly_traits.subcurve_traits_2()->parameter_space_in_x_2_object(); typename Subcurve_traits_2::Parameter_space_in_y_2 ps_y = - m_poly_traits.geometry_traits_2()->parameter_space_in_y_2_object(); + m_poly_traits.subcurve_traits_2()->parameter_space_in_y_2_object(); #ifdef CGAL_ALWAYS_LEFT_TO_RIGHT typename Subcurve_traits_2::Construct_opposite_2 ctr_seg_opposite = - m_poly_traits.geometry_traits_2()->construct_opposite_2_object(); + m_poly_traits.subcurve_traits_2()->construct_opposite_2_object(); #endif // Convert the input polycurve to a sequence of CGAL objects, such @@ -377,11 +377,11 @@ public: // To be used in order to verify continuity and well-orientedness // of the input curve cv. typename Subcurve_traits_2::Construct_min_vertex_2 min_seg_v = - m_poly_traits.geometry_traits_2()->construct_min_vertex_2_object(); + m_poly_traits.subcurve_traits_2()->construct_min_vertex_2_object(); typename Subcurve_traits_2::Construct_max_vertex_2 max_seg_v = - m_poly_traits.geometry_traits_2()->construct_max_vertex_2_object(); + m_poly_traits.subcurve_traits_2()->construct_max_vertex_2_object(); typename Subcurve_traits_2::Equal_2 equal = - m_poly_traits.geometry_traits_2()->equal_2_object(); + m_poly_traits.subcurve_traits_2()->equal_2_object(); Point_2 last_target = (cmp_seg_endpts(x_seg) == SMALLER) ? max_seg_v(x_seg) : min_seg_v(x_seg); Point_2 next_src; @@ -390,7 +390,7 @@ public: // The polycurve consists of at least 2 x-monotone subcurves: Push_back_2 push_back = m_poly_traits.push_back_2_object(); typename Subcurve_traits_2::Is_vertical_2 is_seg_vertical = - m_poly_traits.geometry_traits_2()->is_vertical_2_object(); + m_poly_traits.subcurve_traits_2()->is_vertical_2_object(); bool is_start_vertical = is_seg_vertical(x_seg); Comparison_result start_dir = cmp_seg_endpts(x_seg); @@ -563,7 +563,7 @@ public: void operator()(const X_monotone_curve_2& xcv, const Point_2& p, X_monotone_curve_2& xcv1, X_monotone_curve_2& xcv2) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Subcurve_traits_2::Construct_min_vertex_2 min_vertex = geom_traits->construct_min_vertex_2_object(); typename Subcurve_traits_2::Construct_max_vertex_2 max_vertex = @@ -610,7 +610,7 @@ public: // The i'th subcurve should be split: The left part(seg1) // goes to xcv1, and the right part(seg2) goes to xcv2. X_monotone_subcurve_2 seg1, seg2; - m_poly_traits.geometry_traits_2()->split_2_object()(xcv[i], p, + m_poly_traits.subcurve_traits_2()->split_2_object()(xcv[i], p, seg1, seg2); xcv1.push_back(seg1); @@ -626,7 +626,7 @@ public: } else { X_monotone_subcurve_2 seg1, seg2; - m_poly_traits.geometry_traits_2()-> + m_poly_traits.subcurve_traits_2()-> split_2_object()(xcv[i], p, seg1, seg2); if (cmp_seg_endpts(seg2) == LARGER){ @@ -634,7 +634,7 @@ public: } else { // seg2 has to be reversed - seg2 = m_poly_traits.geometry_traits_2()-> + seg2 = m_poly_traits.subcurve_traits_2()-> construct_opposite_2_object()(seg2); xcv1.push_back(seg2); } @@ -644,7 +644,7 @@ public: } else { // seg2 has to be reversed - seg1 = m_poly_traits.geometry_traits_2()-> + seg1 = m_poly_traits.subcurve_traits_2()-> construct_opposite_2_object()(seg1); xcv1.push_back(seg1); } @@ -689,7 +689,7 @@ public: const X_monotone_curve_2& cv2, OutputIterator oi) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); Compare_y_at_x_2 cmp_y_at_x = m_poly_traits.compare_y_at_x_2_object(); typename Subcurve_traits_2::Equal_2 equal = geom_traits->equal_2_object(); @@ -978,7 +978,7 @@ public: bool operator()(const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2) const { - const Subcurve_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Subcurve_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); Construct_min_vertex_2 min_vertex = m_poly_traits.construct_min_vertex_2_object(); Construct_max_vertex_2 max_vertex = @@ -1057,28 +1057,26 @@ public: Equal_2 equal = m_poly_traits.equal_2_object(); c.clear(); - if ( - // Either both are left-to-right and cv2 is to the right of cv1 + if (// Either both are left-to-right and cv2 is to the right of cv1 ((cmp_seg_endpts(cv1)==SMALLER) && (equal(get_max_v(cv1),get_min_v(cv2)))) || // or both are right-to-left and cv2 is to the left of cv1 ((cmp_seg_endpts(cv1)==LARGER) && - (equal(get_min_v(cv1), get_max_v(cv2)))) - ) + (equal(get_min_v(cv1), get_max_v(cv2))))) { const std::size_t n1 = cv1.number_of_subcurves(); const std::size_t n2 = cv2.number_of_subcurves(); std::size_t i; // cv2 extends cv1 to the right: - for (i = 0; i < n1 - 1; ++i) - c.push_back(cv1[i]); + for (i = 0; i < n1 - 1; ++i) c.push_back(cv1[i]); // Try to merge the to contiguous line subcurves: - if (m_poly_traits.geometry_traits_2()-> - are_mergeable_2_object()(cv1[n1 - 1], cv2[0])) { + if (m_poly_traits.subcurve_traits_2()-> + are_mergeable_2_object()(cv1[n1 - 1], cv2[0])) + { X_monotone_subcurve_2 seg; - m_poly_traits.geometry_traits_2()-> + m_poly_traits.subcurve_traits_2()-> merge_2_object()(cv1[n1 - 1], cv2[0], seg); c.push_back(seg); } @@ -1087,8 +1085,7 @@ public: c.push_back(cv2[0]); } - for (i = 1; i < n2; ++i) - c.push_back(cv2[i]); + for (i = 1; i < n2; ++i) c.push_back(cv2[i]); } else return this->operator()(cv2,cv1,c); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h index 0b676642a2c..8feb286a7d5 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -153,7 +152,7 @@ public: CGAL_precondition(num_seg > 0); int last_seg = num_seg-1; - const Segment_traits_2* seg_traits = m_poly_traits.segment_traits_2(); + const Segment_traits_2* seg_traits = m_poly_traits.subcurve_traits_2(); typename Segment_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts = seg_traits->compare_endpoints_xy_2_object(); @@ -186,7 +185,7 @@ public: size_type num_seg = xcv.number_of_subcurves(); CGAL_precondition(num_seg > 0); - const Segment_traits_2* seg_traits = m_poly_traits.segment_traits_2(); + const Segment_traits_2* seg_traits = m_poly_traits.subcurves_traits_2(); CGAL_precondition_code ( typename Segment_traits_2::Compare_x_2 comp_x = @@ -267,7 +266,7 @@ public: ); CGAL_precondition(num_seg > 0); - const Segment_traits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const Segment_traits_2* geom_traits = m_poly_traits.subcurve_traits_2(); typename Segment_traits_2::Compare_endpoints_xy_2 cmp_seg_endpts = geom_traits->compare_endpoints_xy_2_object(); @@ -290,7 +289,7 @@ public: /*! Append a point `p` to an existing polyline `xcv` at the front. */ void operator()(const X_monotone_curve_2& xcv, Point_2& p) const { - const SegmentTraits_2* geom_traits = m_poly_traits.geometry_traits_2(); + const SegmentTraits_2* geom_traits = m_poly_traits.subcurve_traits_2(); CGAL_precondition_code ( typedef typename X_monotone_curve_2::size_type size_type; @@ -410,7 +409,7 @@ public: CGAL_precondition_code ( typename Segment_traits_2::Equal_2 equal = - this->m_poly_traits.geometry_traits_2()->equal_2_object(); + this->m_poly_traits.subcurve_traits_2()->equal_2_object(); ); // Check whether there are no points in the range: @@ -457,15 +456,15 @@ public: X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q) const { CGAL_precondition_msg - (!this->m_poly_traits.geometry_traits_2()->equal_2_object()(p,q), + (!this->m_poly_traits.subcurve_traits_2()->equal_2_object()(p,q), "Cannot construct a degenerated segment as a polyline"); - X_monotone_subcurve_2 seg = this->m_poly_traits.geometry_traits_2()-> + X_monotone_subcurve_2 seg = this->m_poly_traits.subcurve_traits_2()-> construct_x_monotone_curve_2_object()(p, q); #ifdef CGAL_ALWAYS_LEFT_TO_RIGHT - if (this->m_poly_traits.geometry_traits_2()->compare_xy_2_object()(p,q) == + if (this->m_poly_traits.subcurve_traits_2()->compare_xy_2_object()(p,q) == LARGER) - seg = m_poly_traits.geometry_traits_2()-> + seg = m_poly_traits.subcurve_traits_2()-> construct_opposite_2_object()(seg); #endif @@ -541,7 +540,7 @@ public: CGAL_precondition_code ( const Segment_traits_2* geom_traits = - this->m_poly_traits.geometry_traits_2(); + this->m_poly_traits.subcurve_traits_2(); // Initialize two comparison functors typename Segment_traits_2::Compare_x_2 compare_x = geom_traits->compare_x_2_object(); @@ -568,7 +567,7 @@ public: } #ifdef CGAL_ALWAYS_LEFT_TO_RIGHT - if (m_poly_traits.geometry_traits_2()-> + if (m_poly_traits.subcurve_traits_2()-> compare_endpoints_xy_2_object()(*segs.begin()) == LARGER) { X_monotone_curve_2 xcv(segs.begin(), segs.end()); @@ -589,7 +588,7 @@ public: * \return the segment traits. */ CGAL_DEPRECATED const Segment_traits_2* segment_traits_2() const - { return this->geometry_traits_2(); } + { return this->subcurve_traits_2(); } }; } // namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2_algorithms.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2_algorithms.h index 20c442ba8a4..42f07fb375b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2_algorithms.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2_algorithms.h @@ -57,11 +57,11 @@ struct Default_arr_traits > typedef CGAL::Arr_segment_traits_2 Traits; }; -template -struct Default_arr_traits > +template +struct Default_arr_traits > { - typedef CGAL::Arr_polyline_traits_2 Traits; + typedef CGAL::Arr_polyline_traits_2 Traits; }; template diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h index fbc38987223..48246a23dfe 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h @@ -14,12 +14,12 @@ public: TEST_GEOM_TRAITS == POLYCURVE_BEZIER_GEOM_TRAITS || \ TEST_GEOM_TRAITS == POLYLINE_GEOM_TRAITS ||\ TEST_GEOM_TRAITS == NON_CACHING_POLYLINE_GEOM_TRAITS - // Poly curves needs some testing where Segments and X-monotone segments are required - // instead of polycurves/x-monotone polycurves. + // Poly curves needs some testing where Segments and X-monotone segments are + // required instead of polycurves/x-monotone polycurves. template bool read_segment(InputStream_& is, Segment_2& seg); template - bool read_xsegment(InputStream_& is, X_monotone_segment_2& xseg); + bool read_xsegment(InputStream_& is, X_monotone_subcurve_2& xseg); #endif /*! Constructor */ @@ -166,35 +166,25 @@ bool IO_base_test::read_segment(InputStream_& is, Segment_2& seg) { Basic_number_type x, y; - is >> x >> y; Point_2 p_src(x, y); - is >> x >> y; Point_2 p_tgt(x, y); - - seg = Segment_2(p_src, p_tgt); - return true; } template <> template bool IO_base_test::read_xsegment(InputStream_& is, - X_monotone_segment_2& xseg) + X_monotone_subcurve_2& xseg) { Basic_number_type x, y; - is >> x >> y; Point_2 p_src(x, y); - is >> x >> y; Point_2 p_tgt(x, y); - - - xseg = X_monotone_segment_2(p_src, p_tgt); - + xseg = X_monotone_subcurve_2(p_src, p_tgt); return true; } @@ -324,13 +314,14 @@ bool read_general_curve(InputStream_& is, Curve& cv) template <> template bool IO_base_test::read_xcurve(InputStream_& is, - X_monotone_curve_2& xcv) //read x-curve + X_monotone_curve_2& xcv) { - //since we are dealing with polycurve, we will make more than 1 conic curves (polycurve compatible) - //and return the x-monotone-constructed polycurve. + // since we are dealing with polycurve, we will make more than 1 conic curves + // (polycurve compatible) and return the x-monotone-constructed polycurve. - //to store x-monotoneConic curves i.e in Arr_polyline_traits_2 they are called X_monotone_segment_2 - std::vector conic_x_monotone_segments; + // to store x-monotoneConic curves i.e in Arr_polyline_traits_2 they are + // called X_monotone_subcurve_2 + std::vector conic_x_monotone_segments; Segment_2 tmp_cv; @@ -349,7 +340,7 @@ bool IO_base_test::read_xcurve(InputStream_& is, if( !read_general_curve(is, tmp_cv) ) return false; - X_monotone_segment_2 tmp_xcv(tmp_cv); + X_monotone_subcurve_2 tmp_xcv(tmp_cv); conic_x_monotone_segments.push_back ( tmp_xcv ); } @@ -358,7 +349,7 @@ bool IO_base_test::read_xcurve(InputStream_& is, if( !read_general_conic(is, tmp_cv) ) return false; - X_monotone_segment_2 tmp_xcv(tmp_cv); + X_monotone_subcurve_2 tmp_xcv(tmp_cv); conic_x_monotone_segments.push_back ( tmp_xcv ); } @@ -367,7 +358,7 @@ bool IO_base_test::read_xcurve(InputStream_& is, if( !read_general_arc(is, tmp_cv) ) return false; - X_monotone_segment_2 tmp_xcv(tmp_cv); + X_monotone_subcurve_2 tmp_xcv(tmp_cv); conic_x_monotone_segments.push_back ( tmp_xcv ); } @@ -478,7 +469,7 @@ bool IO_base_test::read_segment(InputStream_& is, template <> template bool IO_base_test::read_xsegment(InputStream_& is, - X_monotone_segment_2& xseg) + X_monotone_subcurve_2& xseg) { char type; is >> type; @@ -487,7 +478,7 @@ bool IO_base_test::read_xsegment(InputStream_& is, if( !read_general_curve(is, tmp_seg) ) return false; - xseg = X_monotone_segment_2(tmp_seg); + xseg = X_monotone_subcurve_2(tmp_seg); return true; } @@ -511,7 +502,7 @@ template bool IO_base_test::read_xcurve(InputStream_& is, X_monotone_curve_2& xcv) { - std::vector x_segments; + std::vector x_segments; char type; is >> type; @@ -547,7 +538,7 @@ bool IO_base_test::read_xcurve(InputStream_& is, is >> point_x >> point_y; pt = Point_2 ( Number_type(point_x, 1), Number_type(point_y, 1) ); - X_monotone_segment_2 x_seg (c, ps, pt, c.orientation()); + X_monotone_subcurve_2 x_seg (c, ps, pt, c.orientation()); x_segments.push_back( x_seg ); } @@ -662,7 +653,7 @@ bool IO_base_test::read_segment(InputStream_& is, template <> template bool IO_base_test::read_xsegment(InputStream_& is, - X_monotone_segment_2& xseg) + X_monotone_subcurve_2& xseg) { //we dont need to check this type as it has already been checked in the IO_test.h char type; @@ -691,7 +682,7 @@ bool IO_base_test::read_xsegment(InputStream_& is, is >> point_x >> point_y; pt = Point_2 ( Number_type(point_x, 1), Number_type(point_y, 1) ); - X_monotone_segment_2 x_seg (c, ps, pt, c.orientation()); + X_monotone_subcurve_2 x_seg (c, ps, pt, c.orientation()); xseg = x_seg; @@ -760,7 +751,7 @@ bool IO_base_test::read_segment(InputStream_& is, template <> template bool IO_base_test::read_xsegment(InputStream_& is, - X_monotone_segment_2& xseg) + X_monotone_subcurve_2& xseg) { char type; is >> type; @@ -786,8 +777,8 @@ bool IO_base_test::read_xsegment(InputStream_& is, std::vector obj_vector; bezier_traits.make_x_monotone_2_object()(seg, std::back_inserter(obj_vector)); - X_monotone_segment_2 x_segment = - CGAL::object_cast((obj_vector[0])); + X_monotone_subcurve_2 x_segment = + CGAL::object_cast((obj_vector[0])); xseg = x_segment; @@ -800,7 +791,7 @@ template bool IO_base_test::read_xcurve(InputStream_& is, X_monotone_curve_2& xcv) { - std::vector x_segments; + std::vector x_segments; std::vector point_vector; Bezier_tratis bezier_traits; @@ -833,8 +824,8 @@ bool IO_base_test::read_xcurve(InputStream_& is, std::vector obj_vector; bezier_traits.make_x_monotone_2_object()(seg, std::back_inserter(obj_vector)); - X_monotone_segment_2 x_seg = - CGAL::object_cast( (obj_vector[0]) ); + X_monotone_subcurve_2 x_seg = + CGAL::object_cast((obj_vector[0])); x_segments.push_back( x_seg ); @@ -1678,7 +1669,7 @@ bool IO_base_test::read_xcurve(InputStream_& is, X_monotone_curve_2& xcv) { Base_geom_traits traits; - Base_geom_traits::Construct_x_monotone_segment_2 construct_segment_2 = + Base_geom_traits::Construct_x_monotone_subcurve_2 construct_segment_2 = traits.construct_x_monotone_segment_2_object(); char type; is >> type; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_test.h index 80e1e4e3218..c88de8d7d71 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_test.h @@ -29,10 +29,10 @@ public: TEST_GEOM_TRAITS == POLYLINE_GEOM_TRAITS ||\ TEST_GEOM_TRAITS == NON_CACHING_POLYLINE_GEOM_TRAITS - typedef typename Geom_traits_T::X_monotone_segment_2 X_monotone_segment_2; - typedef typename Geom_traits_T::Segment_2 Segment_2; - typedef typename std::vector Xsegment_vector; - typedef typename std::vector Segment_vector; + typedef typename Geom_traits_T::X_monotone_subcurve_2 X_monotone_subcurve_2; + typedef typename Geom_traits_T::Segment_2 Segment_2; + typedef typename std::vector Xsegment_vector; + typedef typename std::vector Segment_vector; //vector containers for segments and xsegments Xsegment_vector m_xsegments; @@ -299,7 +299,7 @@ bool IO_test::read_xcurves(const char* filename, if (line[0] == 's') //segment (see segment in 'Arr_polyline_traits.h') { std::istringstream line_stream(line); - typename Geom_traits::X_monotone_segment_2 xseg; + typename Geom_traits::X_monotone_subcurve_2 xseg; this->read_xsegment(line_stream, xseg); m_xsegments.push_back(xseg); line_stream.clear(); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h index 0eb8d8f248c..97400963406 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h @@ -39,7 +39,7 @@ private: TEST_GEOM_TRAITS == POLYCURVE_BEZIER_GEOM_TRAITS typedef typename Traits::Segment_2 Segment_2; - typedef typename Traits::X_monotone_segment_2 X_monotone_segment_2; + typedef typename Traits::X_monotone_subcurve_2 X_monotone_subcurve_2; #endif @@ -458,7 +458,7 @@ push_back_wrapper(std::istringstream& str_stream) else if (type == 1) { X_monotone_curve_2 base_curve = this->m_xcurves[id1]; - X_monotone_segment_2 x_segment = this->m_xsegments[segment_id]; + X_monotone_subcurve_2 x_segment = this->m_xsegments[segment_id]; std::cout << "Test: push_back ( " << x_segment << " into " @@ -535,7 +535,7 @@ push_front_wrapper(std::istringstream& str_stream) else if (type == 1) { X_monotone_curve_2 base_curve = this->m_xcurves[id1]; - X_monotone_segment_2 x_segment = this->m_xsegments[segment_id]; + X_monotone_subcurve_2 x_segment = this->m_xsegments[segment_id]; std::cout << "Test: push_front ( " << x_segment << "into" diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/polylines.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/polylines.cpp index 3e8a37ffef4..5956ae8c581 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/polylines.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/polylines.cpp @@ -28,7 +28,7 @@ typedef Geom_traits_2::Segment_2 Segment_2; typedef Geom_traits_2::Curve_2 Polyline_2; typedef CGAL::Arrangement_2 Arrangement_2; typedef Geom_traits_2::X_monotone_curve_2 X_monotone_polyline; -typedef Geom_traits_2::X_monotone_segment_2 X_monotone_segment; +typedef Geom_traits_2::X_monotone_subcurve_2 X_monotone_subcurve; int main(int argc, char* argv[]) { @@ -36,13 +36,14 @@ int main(int argc, char* argv[]) Arrangement_2 arr(&traits); Geom_traits_2::Construct_x_monotone_curve_2 x_mono_polyline_construct = - traits.construct_x_monotone_curve_2_object(); + traits.construct_x_monotone_curve_2_object(); - std::vector x_segments; - x_segments.push_back(X_monotone_segment( Point_2(0,0), Point_2(1,1) )); - x_segments.push_back(X_monotone_segment( Point_2(1,1), Point_2(10,10) )); - x_segments.push_back(X_monotone_segment( Point_2(10,10), Point_2(15,20) )); - X_monotone_polyline pi1 = x_mono_polyline_construct( x_segments.begin(), x_segments.end() ); + std::vector x_segments; + x_segments.push_back(X_monotone_subcurve( Point_2(0,0), Point_2(1,1) )); + x_segments.push_back(X_monotone_subcurve( Point_2(1,1), Point_2(10,10) )); + x_segments.push_back(X_monotone_subcurve( Point_2(10,10), Point_2(15,20) )); + X_monotone_polyline pi1 = x_mono_polyline_construct(x_segments.begin(), + x_segments.end() ); std::cout << "polline is: " << pi1 << std::endl; @@ -51,6 +52,5 @@ int main(int argc, char* argv[]) X_monotone_polyline trimmed_polyline = traits.trim_2_object()(pi1, src, tgt); std::cout << "trimmed polline is: " << trimmed_polyline << std::endl; - return 0; } diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_arc_polycurve.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_arc_polycurve.cpp index b527ddd6dc5..944887a3d42 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_arc_polycurve.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_arc_polycurve.cpp @@ -4,9 +4,9 @@ #include #ifndef CGAL_USE_CORE #include -int main () +int main() { - std::cout << "Sorry, this example needs CORE ..." << std::endl; + std::cout << "Sorry, this example needs CORE ..." << std::endl; return 0; } @@ -27,45 +27,53 @@ int main () /////////////// //circle segment traits ////////////// -typedef CGAL::Quotient Number_type; -typedef CGAL::Cartesian Kernel; -typedef CGAL::Arr_circle_segment_traits_2 Arc_traits_2; -typedef CGAL::Arr_polyline_traits_2 Polycurve_arc_traits_2; -typedef Arc_traits_2::CoordNT CoordNT; -typedef Arc_traits_2::Point_2 Arc_point_2; -typedef Arc_traits_2::Curve_2 Arc_section_2; -typedef Arc_traits_2::X_monotone_curve_2 Arc_section_x_monotone_2; -typedef CGAL::Arrangement_2 Arc_arrangment_2; +typedef CGAL::Quotient Number_type; +typedef CGAL::Cartesian Kernel; +typedef CGAL::Arr_circle_segment_traits_2 Arc_traits_2; +typedef CGAL::Arr_polyline_traits_2 Polycurve_arc_traits_2; +typedef Arc_traits_2::CoordNT CoordNT; +typedef Arc_traits_2::Point_2 Arc_point_2; +typedef Arc_traits_2::Curve_2 Arc_section_2; +typedef Arc_traits_2::X_monotone_curve_2 Arc_section_x_monotone_2; +typedef CGAL::Arrangement_2 Arc_arrangment_2; void check_equal() { Polycurve_arc_traits_2 Polycurve_traits_2; Polycurve_arc_traits_2::Equal_2 equal_2 = Polycurve_traits_2.equal_2_object(); - Polycurve_arc_traits_2::Construct_x_monotone_curve_2 construct_x_monotone_curve_2 = Polycurve_traits_2.construct_x_monotone_curve_2_object(); + Polycurve_arc_traits_2::Construct_x_monotone_curve_2 + construct_x_monotone_curve_2 = + Polycurve_traits_2.construct_x_monotone_curve_2_object(); Arc_section_2 curve1, curve2, curve3; - Kernel::Point_2 p1 = Kernel::Point_2 (-5, 0); - Kernel::Point_2 mid = Kernel::Point_2 (0, 5); - Kernel::Point_2 p2 = Kernel::Point_2 (5, 0); - curve1= Arc_section_2 (p1, mid, p2); - curve2= Arc_section_2 (p1, mid, p2); - + Kernel::Point_2 p1 = Kernel::Point_2(-5, 0); + Kernel::Point_2 mid = Kernel::Point_2(0, 5); + Kernel::Point_2 p2 = Kernel::Point_2(5, 0); + curve1= Arc_section_2(p1, mid, p2); + curve2= Arc_section_2(p1, mid, p2); // //make x_monotone - //Polycurve_arc_traits_2::X_monotone_curve_2 xmc1 = construct_x_monotone_curve_2(curve1); - // Polycurve_arc_traits_2::X_monotone_curve_2 xmc2 = construct_x_monotone_curve_2(curve2); - // Polycurve_arc_traits_2::X_monotone_curve_2 xmc3 = construct_x_monotone_curve_2(curve3); + // Polycurve_arc_traits_2::X_monotone_curve_2 xmc1 = + // construct_x_monotone_curve_2(curve1); + // Polycurve_arc_traits_2::X_monotone_curve_2 xmc2 = + // construct_x_monotone_curve_2(curve2); + // Polycurve_arc_traits_2::X_monotone_curve_2 xmc3 = + // construct_x_monotone_curve_2(curve3); // //simple equal // bool Are_equal = equal_2(xmc1, xmc1); - // std::cout << "Equal_2::Two equal semi circles are computed as: " << ( (Are_equal) ? "Equal" : "Not equal") << std::endl; + // std::cout << "Equal_2::Two equal semi circles are computed as: " + // << ((Are_equal) ? "Equal" : "Not equal") << std::endl; // Are_equal = equal_2(xmc1, xmc3); - // std::cout << "Equal_2::Two un-equal semi circles are computed as: " << ( (Are_equal) ? "Equal" : "Not equal") << std::endl; + // std::cout << "Equal_2::Two un-equal semi circles are computed as: " + // << ((Are_equal) ? "Equal" : "Not equal") << std::endl; } -void check_intersect(Polycurve_arc_traits_2::Make_x_monotone_2 make_x_monotone_2, Polycurve_arc_traits_2::Intersect_2 intersect_2) +void check_intersect(Polycurve_arc_traits_2::Make_x_monotone_2 + make_x_monotone_2, + Polycurve_arc_traits_2::Intersect_2 intersect_2) { Arc_section_2 curve1, curve2, curve3; @@ -73,47 +81,55 @@ void check_intersect(Polycurve_arc_traits_2::Make_x_monotone_2 make_x_monotone_ // circle centered at (1,1) with squared radius 3. We create the // circle with clockwise orientation, so the arc is directed from // (1 - sqrt(3), 1) to (1 + sqrt(3), 1). - Kernel::Point_2 c1 = Kernel::Point_2 (1, 1); - Kernel::Circle_2 circ1 = Kernel::Circle_2 (c1, 3, CGAL::CLOCKWISE); - CoordNT one_minus_sqrt_3 = CoordNT (1, -1, 3); - CoordNT one_plus_sqrt_3 = CoordNT (1, 1, 3); - Arc_point_2 s1 = Arc_point_2 (one_minus_sqrt_3, CoordNT (1)); - Arc_point_2 t1 = Arc_point_2 (one_plus_sqrt_3, CoordNT (1)); - curve1= Arc_section_2 (circ1, s1, t1); - curve2= Arc_section_2 (circ1, s1, t1); + Kernel::Point_2 c1 = Kernel::Point_2(1, 1); + Kernel::Circle_2 circ1 = Kernel::Circle_2(c1, 3, CGAL::CLOCKWISE); + CoordNT one_minus_sqrt_3 = CoordNT(1, -1, 3); + CoordNT one_plus_sqrt_3 = CoordNT(1, 1, 3); + Arc_point_2 s1 = Arc_point_2(one_minus_sqrt_3, CoordNT(1)); + Arc_point_2 t1 = Arc_point_2(one_plus_sqrt_3, CoordNT(1)); + curve1 = Arc_section_2(circ1, s1, t1); + curve2 = Arc_section_2(circ1, s1, t1); //push the same semi circle again - //curves.push_back (Arc_section_2 (circ1, s1, t1)); + //curves.push_back(Arc_section_2(circ1, s1, t1)); //make x_monotone std::vector X_monotone_curves; make_x_monotone_2(curve1, std::back_inserter(X_monotone_curves)); make_x_monotone_2(curve2, std::back_inserter(X_monotone_curves)); - Arc_section_x_monotone_2 X_monotone_curve1, X_monotone_curve2, X_monotone_curve3 ; - CGAL::assign( X_monotone_curve1, X_monotone_curves[ 0 ] ); - CGAL::assign( X_monotone_curve2, X_monotone_curves[ 1 ] ); + Arc_section_x_monotone_2 X_monotone_curve1, X_monotone_curve2, + X_monotone_curve3 ; + CGAL::assign(X_monotone_curve1, X_monotone_curves[0]); + CGAL::assign(X_monotone_curve2, X_monotone_curves[1]); std::vector Points_of_intersection; - - //intersect_2(X_monotone_curve1, X_monotone_curve2, std::back_inserter(Points_of_intersection)); + + //intersect_2(X_monotone_curve1, X_monotone_curve2, + // std::back_inserter(Points_of_intersection)); // Create a circular arc of the unit circle, directed clockwise from // (-1/2, sqrt(3)/2) to (1/2, sqrt(3)/2). Note that we orient the // supporting circle accordingly. - Kernel::Point_2 c6 = Kernel::Point_2 (0, 0); - CoordNT sqrt_3_div_2 = CoordNT (Number_type(0), Number_type(1,2), Number_type(3)); - Arc_point_2 s6 = Arc_point_2 (Number_type (-1, 2), sqrt_3_div_2); - Arc_point_2 t6 = Arc_point_2 (Number_type (1, 2), sqrt_3_div_2); - - curve3 = Arc_section_2 (c6, 1, CGAL::CLOCKWISE, s6, t6); + Kernel::Point_2 c6 = Kernel::Point_2(0, 0); + CoordNT sqrt_3_div_2 = + CoordNT(Number_type(0), Number_type(1,2), Number_type(3)); + Arc_point_2 s6 = Arc_point_2(Number_type(-1, 2), sqrt_3_div_2); + Arc_point_2 t6 = Arc_point_2(Number_type(1, 2), sqrt_3_div_2); + + curve3 = Arc_section_2(c6, 1, CGAL::CLOCKWISE, s6, t6); make_x_monotone_2(curve3, std::back_inserter(X_monotone_curves)); - CGAL::assign( X_monotone_curve2, X_monotone_curves[ 2 ] ); + CGAL::assign(X_monotone_curve2, X_monotone_curves[2]); Points_of_intersection.clear(); - //intersect_2(X_monotone_curve1, X_monotone_curve2, std::back_inserter(Points_of_intersection)); + //intersect_2(X_monotone_curve1, X_monotone_curve2, + // std::back_inserter(Points_of_intersection)); } -void check_compare_end_points_xy_2(Polycurve_arc_traits_2::Compare_endpoints_xy_2 compare_endpoints_xy_2, Polycurve_arc_traits_2::Make_x_monotone_2 make_x_monotone_2) +void +check_compare_end_points_xy_2(Polycurve_arc_traits_2::Compare_endpoints_xy_2 + compare_endpoints_xy_2, + Polycurve_arc_traits_2::Make_x_monotone_2 + make_x_monotone_2) { Arc_section_2 curve1, curve2; @@ -121,42 +137,41 @@ void check_compare_end_points_xy_2(Polycurve_arc_traits_2::Compare_endpoints_xy_ // circle centered at (1,1) with squared radius 3. We create the // circle with clockwise orientation, so the arc is directed from // (1 - sqrt(3), 1) to (1 + sqrt(3), 1). - Kernel::Point_2 c1 = Kernel::Point_2 (1, 1); - Kernel::Circle_2 circ1 = Kernel::Circle_2 (c1, 3, CGAL::CLOCKWISE); - CoordNT one_minus_sqrt_3 = CoordNT (1, -1, 3); - CoordNT one_plus_sqrt_3 = CoordNT (1, 1, 3); - Arc_point_2 s1 = Arc_point_2 (one_minus_sqrt_3, CoordNT (1)); - Arc_point_2 t1 = Arc_point_2 (one_plus_sqrt_3, CoordNT (1)); - curve1= Arc_section_2 (circ1, s1, t1); + Kernel::Point_2 c1 = Kernel::Point_2(1, 1); + Kernel::Circle_2 circ1 = Kernel::Circle_2(c1, 3, CGAL::CLOCKWISE); + CoordNT one_minus_sqrt_3 = CoordNT(1, -1, 3); + CoordNT one_plus_sqrt_3 = CoordNT(1, 1, 3); + Arc_point_2 s1 = Arc_point_2(one_minus_sqrt_3, CoordNT(1)); + Arc_point_2 t1 = Arc_point_2(one_plus_sqrt_3, CoordNT(1)); + curve1= Arc_section_2(circ1, s1, t1); //make x_monotone std::vector X_monotone_curves; make_x_monotone_2(curve1, std::back_inserter(X_monotone_curves)); Arc_section_x_monotone_2 X_monotone_curve1, X_monotone_curve2 ; - CGAL::assign( X_monotone_curve1, X_monotone_curves[ 0 ] ); + CGAL::assign(X_monotone_curve1, X_monotone_curves[ 0 ]); - int res = compare_endpoints_xy_2(X_monotone_curve1); - std::cout<< "The first result is: " << res << std::endl; + std::cout<< "The first result is: " << res << std::endl; - Kernel::Point_2 c2 = Kernel::Point_2 (1, 1); - Kernel::Circle_2 circ2 = Kernel::Circle_2 (c2, 3, CGAL::COUNTERCLOCKWISE); - Arc_point_2 t2 = Arc_point_2 (one_minus_sqrt_3, CoordNT (1)); - Arc_point_2 s2 = Arc_point_2 (one_plus_sqrt_3, CoordNT (1)); - curve2= Arc_section_2 (circ2, s1, t1); + Kernel::Point_2 c2 = Kernel::Point_2(1, 1); + Kernel::Circle_2 circ2 = Kernel::Circle_2(c2, 3, CGAL::COUNTERCLOCKWISE); + Arc_point_2 t2 = Arc_point_2(one_minus_sqrt_3, CoordNT(1)); + Arc_point_2 s2 = Arc_point_2(one_plus_sqrt_3, CoordNT(1)); + curve2= Arc_section_2(circ2, s1, t1); make_x_monotone_2(curve2, std::back_inserter(X_monotone_curves)); - CGAL::assign( X_monotone_curve2, X_monotone_curves[ 1 ] ); + CGAL::assign(X_monotone_curve2, X_monotone_curves[ 1 ]); res = compare_endpoints_xy_2(X_monotone_curve2); - std::cout<< "The second result is: " << res << std::endl; - + std::cout<< "The second result is: " << res << std::endl; } -void check_split( Polycurve_arc_traits_2::Split_2 split_2, Polycurve_arc_traits_2::Make_x_monotone_2 make_x_monotone_2) +void check_split(Polycurve_arc_traits_2::Split_2 split_2, + Polycurve_arc_traits_2::Make_x_monotone_2 make_x_monotone_2) { Arc_section_2 curve; @@ -164,204 +179,235 @@ void check_split( Polycurve_arc_traits_2::Split_2 split_2, Polycurve_arc_traits // circle centered at (1,1) with squared radius 3. We create the // circle with clockwise orientation, so the arc is directed from // (1 - sqrt(3), 1) to (1 + sqrt(3), 1). - Kernel::Point_2 c1 = Kernel::Point_2 (1, 1); - Kernel::Circle_2 circ1 = Kernel::Circle_2 (c1, 3, CGAL::CLOCKWISE); - CoordNT one_minus_sqrt_3 = CoordNT (1, -1, 3); - CoordNT one_plus_sqrt_3 = CoordNT (1, 1, 3); - Arc_point_2 s1 = Arc_point_2 (one_minus_sqrt_3, CoordNT (1)); - Arc_point_2 t1 = Arc_point_2 (one_plus_sqrt_3, CoordNT (1)); - curve= Arc_section_2 (circ1, s1, t1); + Kernel::Point_2 c1 = Kernel::Point_2(1, 1); + Kernel::Circle_2 circ1 = Kernel::Circle_2(c1, 3, CGAL::CLOCKWISE); + CoordNT one_minus_sqrt_3 = CoordNT(1, -1, 3); + CoordNT one_plus_sqrt_3 = CoordNT(1, 1, 3); + Arc_point_2 s1 = Arc_point_2(one_minus_sqrt_3, CoordNT(1)); + Arc_point_2 t1 = Arc_point_2(one_plus_sqrt_3, CoordNT(1)); + curve= Arc_section_2(circ1, s1, t1); //make x_monotone std::vector X_monotone_curves; make_x_monotone_2(curve, std::back_inserter(X_monotone_curves)); - Arc_section_x_monotone_2 X_monotone_curve, split_x_monotone_curve1, split_x_monotone_curve2 ; - CGAL::assign( X_monotone_curve, X_monotone_curves[ 0 ] ); - - //split_2(X_monotone_curve, Kernel::Point_2::Kernel::Point_2(1, 4), split_x_monotone_curve1, split_x_monotone_curve2); + Arc_section_x_monotone_2 X_monotone_curve, split_x_monotone_curve1, + split_x_monotone_curve2 ; + CGAL::assign(X_monotone_curve, X_monotone_curves[0]); + //split_2(X_monotone_curve, Kernel::Point_2::Kernel::Point_2(1, 4), + // split_x_monotone_curve1, split_x_monotone_curve2); } -void check_is_vertical(Polycurve_arc_traits_2::Make_x_monotone_2 make_x_monotone_2, Polycurve_arc_traits_2::Is_vertical_2 is_vertical) +void check_is_vertical(Polycurve_arc_traits_2::Make_x_monotone_2 + make_x_monotone_2, + Polycurve_arc_traits_2::Is_vertical_2 is_vertical) { std::vector curves; // Create a circular arc defined by two endpoints and a midpoint, // all having rational coordinates. This arc is the upper-right // quarter of a circle centered at the origin with radius 5. - Kernel::Point_2 p1 = Kernel::Point_2 (0, 5); - Kernel::Point_2 mid = Kernel::Point_2 (3, 4); - Kernel::Point_2 p2 = Kernel::Point_2 (5, 0); - Kernel::Point_2 p3 = Kernel::Point_2 (0, -5); - curves.push_back (Arc_section_2 (p1, mid, p2)); //quarter of a circle - curves.push_back (Arc_section_2 (p1, mid, p3)); //semi-circle + Kernel::Point_2 p1 = Kernel::Point_2(0, 5); + Kernel::Point_2 mid = Kernel::Point_2(3, 4); + Kernel::Point_2 p2 = Kernel::Point_2(5, 0); + Kernel::Point_2 p3 = Kernel::Point_2(0, -5); + curves.push_back(Arc_section_2(p1, mid, p2)); //quarter of a circle + curves.push_back(Arc_section_2(p1, mid, p3)); //semi-circle //convert all curves to x-monotone curves std::vector X_monotone_curves; - for(int i=0; i x_monotone_polycurves; Arc_section_x_monotone_2 x_monotone_polycurve1, x_monotone_polycurve2; - CGAL::assign( x_monotone_polycurve1, X_monotone_curves[ 0 ] ); - CGAL::assign( x_monotone_polycurve2, X_monotone_curves[ 1 ] ); + CGAL::assign(x_monotone_polycurve1, X_monotone_curves[0]); + CGAL::assign(x_monotone_polycurve2, X_monotone_curves[1]); bool res = is_vertical(x_monotone_polycurve1); - std::cout << "Is_verticle:: The xmonotone curve (quarter circle) is : " << ( (res)? "vertical" : "not vertical" ) << std::endl; + std::cout << "Is_verticle:: The xmonotone curve (quarter circle) is : " + << ((res)? "vertical" : "not vertical") << std::endl; res = is_vertical(x_monotone_polycurve2); - std::cout << "Is_verticle:: The xmonotone curve (Smi-circle) is : " << ( (res)? "vertical" : "not vertical" ) << std::endl; - + std::cout << "Is_verticle:: The xmonotone curve (Smi-circle) is : " + << ((res)? "vertical" : "not vertical") << std::endl; } -void check_compare_y_at_x_2(Polycurve_arc_traits_2::Make_x_monotone_2 make_x_monotone_2, Polycurve_arc_traits_2::Compare_y_at_x_2 cmp_y_at_x_2) +void check_compare_y_at_x_2(Polycurve_arc_traits_2::Make_x_monotone_2 + make_x_monotone_2, + Polycurve_arc_traits_2::Compare_y_at_x_2 + cmp_y_at_x_2) { - std::vector curves; // Create a circular arc defined by two endpoints and a midpoint, // all having rational coordinates. This arc is the upper-right // quarter of a circle centered at the origin with radius 5. - Kernel::Point_2 p1 = Kernel::Point_2 (1, 1); - Kernel::Point_2 mid = Kernel::Point_2 (4, 4); - Kernel::Point_2 p2 = Kernel::Point_2 (7, 1); - Kernel::Point_2 p3 = Kernel::Point_2 (1, 4); - curves.push_back (Arc_section_2 (p1, mid, p2)); //quarter of a circle - curves.push_back (Arc_section_2 (p1, mid, p3)); //semi-circle + Kernel::Point_2 p1 = Kernel::Point_2(1, 1); + Kernel::Point_2 mid = Kernel::Point_2(4, 4); + Kernel::Point_2 p2 = Kernel::Point_2(7, 1); + Kernel::Point_2 p3 = Kernel::Point_2(1, 4); + curves.push_back(Arc_section_2(p1, mid, p2)); //quarter of a circle + curves.push_back(Arc_section_2(p1, mid, p3)); //semi-circle //convert all curves to x-monotone curves std::vector X_monotone_curves; - for(int i=0; i curves; + std::vector curves; - //check if segment is pushed in empty curve. - Kernel::Point_2 p1 = Kernel::Point_2 (1, 1); - Kernel::Point_2 mid = Kernel::Point_2 (4, 4); - Kernel::Point_2 p2 = Kernel::Point_2 (7, 1); + //check if segment is pushed in empty curve. + Kernel::Point_2 p1 = Kernel::Point_2(1, 1); + Kernel::Point_2 mid = Kernel::Point_2(4, 4); + Kernel::Point_2 p2 = Kernel::Point_2(7, 1); - Kernel::Point_2 mid2 = Kernel::Point_2 (10, 3); - Kernel::Point_2 p3 = Kernel::Point_2 (7, 7); + Kernel::Point_2 mid2 = Kernel::Point_2(10, 3); + Kernel::Point_2 p3 = Kernel::Point_2(7, 7); - curves.push_back(Arc_section_2 (p1, mid, p2)); - curves.push_back(Arc_section_2 (p2, mid2, p3)); - - CGAL::polyline::Polyline_2 polycurve; + curves.push_back(Arc_section_2(p1, mid, p2)); + curves.push_back(Arc_section_2(p2, mid2, p3)); - ////pushing segments in polycurve - push_back_2(polycurve, curves[0]); - std::cout<< "size of polycurve after 1 push_back: " << polycurve.size() << std::endl; + CGAL::internal::Polycurve_2 polycurve; - push_back_2(polycurve, curves[1]); - std::cout<< "size of polycurve after 2 push_backs: " << polycurve.size() << std::endl; //throws a warning "size is depricated" + ////pushing segments in polycurve + push_back_2(polycurve, curves[0]); + std::cout << "size of polycurve after 1 push_back: " + << polycurve.number_of_subcurves()() << std::endl; - //pushing xmonotone segments in xmonotone polycurves - // CGAL::polyline::Polyline_2 x_monotone_polycurve; + push_back_2(polycurve, curves[1]); + //throws a warning "size is depricated" + std::cout << "size of polycurve after 2 push_backs: " + << polycurve.number_of_subcurves()() << std::endl; - // Kernel::Point_2 p5 = Kernel::Point_2 (7, 1); - // Kernel::Point_2 p6 = Kernel::Point_2 (-3, -3); - // Kernel::Point_2 p7 = Kernel::Point_2 (13, 1); - // curves.push_back(Arc_section_2 (p5, p6, p7)); + //pushing xmonotone segments in xmonotone polycurves + // CGAL::polyline::Polyline_2 + // x_monotone_polycurve; + + // Kernel::Point_2 p5 = Kernel::Point_2(7, 1); + // Kernel::Point_2 p6 = Kernel::Point_2(-3, -3); + // Kernel::Point_2 p7 = Kernel::Point_2(13, 1); + // curves.push_back(Arc_section_2(p5, p6, p7)); // std::vector X_monotone_curves; // make_x_monotone_2(curves[0], std::back_inserter(X_monotone_curves)); // make_x_monotone_2(curves[1], std::back_inserter(X_monotone_curves)); // Arc_section_x_monotone_2 x_monotone_polycurve1, x_monotone_polycurve2; - // CGAL::assign( x_monotone_polycurve1, X_monotone_curves[ 0 ] ); - // CGAL::assign( x_monotone_polycurve2, X_monotone_curves[ 1 ] ); + // CGAL::assign(x_monotone_polycurve1, X_monotone_curves[0]); + // CGAL::assign(x_monotone_polycurve2, X_monotone_curves[1]); // push_back_2(x_monotone_polycurve, x_monotone_polycurve1); - // std::cout<< "size of x-monotone-polycurve after 1 push_back: " << polycurve.size() << std::endl; - - // push_back_2(x_monotone_polycurve, x_monotone_polycurve2); - // std::cout<< "size of x-monotone-polycurve after 2 push_backs: " << polycurve.size() << std::endl; //throws a warning "size is depricated" - - + // std::cout << "size of x-monotone-polycurve after 1 push_back: " + // << polycurve.size() << std::endl; + // push_back_2(x_monotone_polycurve, x_monotone_polycurve2); + // std::cout << "size of x-monotone-polycurve after 2 push_backs: " + // << polycurve.size() << std::endl; + // throws a warning "size is depricated" } -int main () +int main() { - Polycurve_arc_traits_2 Polycurve_traits_2; - //Compare_x_2 - //Polycurve_arc_traits_2::Compare_x_2 compare_x_2 = Polycurve_traits_2.compare_xy_2_object(); + // Compare_x_2 + // Polycurve_arc_traits_2::Compare_x_2 compare_x_2 = + // Polycurve_traits_2.compare_xy_2_object(); - //number of points - //Polycurve_arc_traits_2::Number_of_points_2 num_of_points = Polycurve_traits_2.number_of_points_2_object(); + // number of points + // Polycurve_arc_traits_2::Number_of_points_2 num_of_points = + // Polycurve_traits_2.number_of_points_2_object(); //construct min vertex - Polycurve_arc_traits_2::Construct_min_vertex_2 cnst_min_vertex = Polycurve_traits_2.construct_min_vertex_2_object(); + Polycurve_arc_traits_2::Construct_min_vertex_2 cnst_min_vertex = + Polycurve_traits_2.construct_min_vertex_2_object(); //construct max vertex - Polycurve_arc_traits_2::Construct_max_vertex_2 cnst_max_vertex_2 = Polycurve_traits_2.construct_max_vertex_2_object(); + Polycurve_arc_traits_2::Construct_max_vertex_2 cnst_max_vertex_2 = + Polycurve_traits_2.construct_max_vertex_2_object(); //is vertical (return bool) - Polycurve_arc_traits_2::Is_vertical_2 is_vertical = Polycurve_traits_2.is_vertical_2_object(); + Polycurve_arc_traits_2::Is_vertical_2 is_vertical = + Polycurve_traits_2.is_vertical_2_object(); //Compare y at x 2 (return comparison_result) - Polycurve_arc_traits_2::Compare_y_at_x_2 cmp_y_at_x_2 = Polycurve_traits_2.compare_y_at_x_2_object(); + Polycurve_arc_traits_2::Compare_y_at_x_2 cmp_y_at_x_2 = + Polycurve_traits_2.compare_y_at_x_2_object(); //compare y at x left - Polycurve_arc_traits_2::Compare_y_at_x_left_2 cmp_y_at_x_left_2 = Polycurve_traits_2.compare_y_at_x_left_2_object(); + Polycurve_arc_traits_2::Compare_y_at_x_left_2 cmp_y_at_x_left_2 = + Polycurve_traits_2.compare_y_at_x_left_2_object(); //compare y at x right - Polycurve_arc_traits_2::Compare_y_at_x_right_2 cmp_y_at_x_right_2 = Polycurve_traits_2.compare_y_at_x_right_2_object(); + Polycurve_arc_traits_2::Compare_y_at_x_right_2 cmp_y_at_x_right_2 = + Polycurve_traits_2.compare_y_at_x_right_2_object(); //equal_2 - Polycurve_arc_traits_2::Equal_2 equal_2 = Polycurve_traits_2.equal_2_object(); + Polycurve_arc_traits_2::Equal_2 equal_2 = + Polycurve_traits_2.equal_2_object(); //compare end points xy_2 - Polycurve_arc_traits_2::Compare_endpoints_xy_2 compare_endpoints_xy_2 = Polycurve_traits_2.compare_endpoints_xy_2_object(); + Polycurve_arc_traits_2::Compare_endpoints_xy_2 compare_endpoints_xy_2 = + Polycurve_traits_2.compare_endpoints_xy_2_object(); //construct opposite - Polycurve_arc_traits_2::Construct_opposite_2 construct_opposite_2 = Polycurve_traits_2.construct_opposite_2_object(); + Polycurve_arc_traits_2::Construct_opposite_2 construct_opposite_2 = + Polycurve_traits_2.construct_opposite_2_object(); //make x_monotone - Polycurve_arc_traits_2::Make_x_monotone_2 make_x_monotone_2 = Polycurve_traits_2.make_x_monotone_2_object(); + Polycurve_arc_traits_2::Make_x_monotone_2 make_x_monotone_2 = + Polycurve_traits_2.make_x_monotone_2_object(); //push back - Polycurve_arc_traits_2::Push_back_2 push_back_2 = Polycurve_traits_2.push_back_2_object(); + Polycurve_arc_traits_2::Push_back_2 push_back_2 = + Polycurve_traits_2.push_back_2_object(); //push front - Polycurve_arc_traits_2::Push_front_2 push_front_2 = Polycurve_traits_2.push_front_2_object(); + Polycurve_arc_traits_2::Push_front_2 push_front_2 = + Polycurve_traits_2.push_front_2_object(); //split_2 - Polycurve_arc_traits_2::Split_2 split_2 = Polycurve_traits_2.split_2_object(); + Polycurve_arc_traits_2::Split_2 split_2 = + Polycurve_traits_2.split_2_object(); //Intersect_2 - Polycurve_arc_traits_2::Intersect_2 intersect_2 = Polycurve_traits_2.intersect_2_object(); + Polycurve_arc_traits_2::Intersect_2 intersect_2 = + Polycurve_traits_2.intersect_2_object(); //Are_mergable - Polycurve_arc_traits_2::Are_mergeable_2 are_mergeable_2 = Polycurve_traits_2.are_mergeable_2_object(); + Polycurve_arc_traits_2::Are_mergeable_2 are_mergeable_2 = + Polycurve_traits_2.are_mergeable_2_object(); //Merge_2 - Polycurve_arc_traits_2::Merge_2 merge_2 = Polycurve_traits_2.merge_2_object(); + Polycurve_arc_traits_2::Merge_2 merge_2 = + Polycurve_traits_2.merge_2_object(); //construct_curve_2 - Polycurve_arc_traits_2::Construct_curve_2 construct_curve_2 = Polycurve_traits_2.construct_curve_2_object(); + Polycurve_arc_traits_2::Construct_curve_2 construct_curve_2 = + Polycurve_traits_2.construct_curve_2_object(); //construct x_monotone curve_2 - Polycurve_arc_traits_2::Construct_x_monotone_curve_2 construct_x_monotone_curve_2 = Polycurve_traits_2.construct_x_monotone_curve_2_object(); - - + Polycurve_arc_traits_2::Construct_x_monotone_curve_2 + construct_x_monotone_curve_2 = + Polycurve_traits_2.construct_x_monotone_curve_2_object(); //check_equal(); check_intersect(make_x_monotone_2, intersect_2); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_circular_arc_polycurve.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_circular_arc_polycurve.cpp index e41cdb83bda..84a86f283e0 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_circular_arc_polycurve.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_circular_arc_polycurve.cpp @@ -6,7 +6,7 @@ #include int main () { - std::cout << "Sorry, this example needs CORE ..." << std::endl; + std::cout << "Sorry, this example needs CORE ..." << std::endl; return 0; } @@ -25,47 +25,49 @@ int main () /////////////// //circle segment traits ////////////// -typedef CGAL::Quotient Number_type; -typedef CGAL::Cartesian Kernel; -typedef CGAL::Arr_circle_segment_traits_2 Arc_traits_2; -typedef CGAL::Arr_polyline_traits_2 Polycurve_arc_traits_2; +typedef CGAL::Quotient Number_type; +typedef CGAL::Cartesian Kernel; +typedef CGAL::Arr_circle_segment_traits_2 Arc_traits_2; +typedef CGAL::Arr_polyline_traits_2 Polycurve_arc_traits_2; -typedef Arc_traits_2::CoordNT CoordNT; -typedef Arc_traits_2::Point_2 Point_2; -typedef Arc_traits_2::Curve_2 Arc_section_2; -typedef Arc_traits_2::X_monotone_curve_2 Arc_x_monotone_section_2; - -typedef Polycurve_arc_traits_2::X_monotone_curve_2 X_monotone_polycurve; -typedef Polycurve_arc_traits_2::Curve_2 Polycurve; -typedef Kernel::Circle_2 Circle_2; - -typedef Arc_traits_2::Has_construct_x_monotone_curve_from_two_points_category Has_construct_x_monotone_curve_from_two_points_category; +typedef Arc_traits_2::CoordNT CoordNT; +typedef Arc_traits_2::Point_2 Point_2; +typedef Arc_traits_2::Curve_2 Arc_section_2; +typedef Arc_traits_2::X_monotone_curve_2 Arc_x_monotone_section_2; +typedef Polycurve_arc_traits_2::X_monotone_curve_2 X_monotone_polycurve; +typedef Polycurve_arc_traits_2::Curve_2 Polycurve; +typedef Kernel::Circle_2 Circle_2; template bool check_compare_y_at_x_2(Curve& cv) { Polycurve_arc_traits_2 traits; - Polycurve_arc_traits_2::Compare_y_at_x_2 cmp_y_at_x_2 = traits.compare_y_at_x_2_object(); - + Polycurve_arc_traits_2::Compare_y_at_x_2 cmp_y_at_x_2 = + traits.compare_y_at_x_2_object(); + //create points - Polycurve_arc_traits_2::Point_2 point_above_line = Polycurve_arc_traits_2::Point_2(4,4), - point_below_line = Polycurve_arc_traits_2::Point_2(3,1), - point_on_line = Polycurve_arc_traits_2::Point_2(0,1); + Polycurve_arc_traits_2::Point_2 point_above_line = + Polycurve_arc_traits_2::Point_2(4,4), + point_below_line = Polycurve_arc_traits_2::Point_2(3,1), + point_on_line = Polycurve_arc_traits_2::Point_2(0,1); CGAL::Comparison_result result; result = cmp_y_at_x_2(point_above_line, cv); - std::cout << "Compare_y_at_x_2:: for point above the curve computed Answer is: "<< (result == CGAL::SMALLER ? "Below": + std::cout << "Compare_y_at_x_2:: for point above the curve computed Answer is: " + << (result == CGAL::SMALLER ? "Below": (result == CGAL::LARGER ? "Above" : "On-line")) << std::endl; result = cmp_y_at_x_2(point_below_line, cv); - std::cout << "Compare_y_at_x_2:: for point below the curve computed Answer is: "<< (result == CGAL::SMALLER ? "Below": + std::cout << "Compare_y_at_x_2:: for point below the curve computed Answer is: " + << (result == CGAL::SMALLER ? "Below": (result == CGAL::LARGER ? "Above" : "On-line")) << std::endl; result = cmp_y_at_x_2(point_on_line, cv); - std::cout << "Compare_y_at_x_2:: for point on the curve computed Answer is: "<< (result == CGAL::SMALLER ? "Below": + std::cout << "Compare_y_at_x_2:: for point on the curve computed Answer is: " + << (result == CGAL::SMALLER ? "Below": (result == CGAL::LARGER ? "Above" : "On-line")) << std::endl; return true; @@ -79,7 +81,6 @@ void check_intersect(const Curve& cv1, const Curve& cv2) // std::vector object_vec; // traits.intersect_2_object()(cv1, cv2, object_vec); // std::cout<< "number of intersections is: " << object_vec.size(); - } template @@ -88,54 +89,50 @@ void check_make_x_monotone(Curve cv) Polycurve_arc_traits_2 traits; std::vector object_vec; - traits.make_x_monotone_2_object()(cv, std::back_inserter(object_vec) ); - std::cout << "Number of x-monotone curves: " << object_vec.size() << std::endl; + traits.make_x_monotone_2_object()(cv, std::back_inserter(object_vec)); + std::cout << "Number of x-monotone curves: " + << object_vec.size() << std::endl; } template void check_trim(Curve& xcv, int sx, int sy, int tx, int ty) { Polycurve_arc_traits_2 traits; - Point_2 source ( sx, sy ); - Point_2 target ( tx, ty); + Point_2 source(sx, sy); + Point_2 target(tx, ty); Polycurve_arc_traits_2::Trim_2 trim_polycurve = traits.trim_2_object(); X_monotone_polycurve trimmed_curve = trim_polycurve(xcv, source, target); std::cout << "polycurvecurve: " << xcv << std::endl< curves; std::vector x_curves; - // Create a circular arc of the circle, directed clockwise from // (-1, 0) to (1, 0). Note that we orient the // supporting circle accordingly. - Kernel::Point_2 c6 = Kernel::Point_2 (0, 0); - Point_2 s6 = Point_2 ( Number_type (-1, 1), Number_type (0, 1) ); - Point_2 t6 = Point_2 ( Number_type (1, 1), Number_type (0, 1)); - Arc_section_2 circ_arc1 (c6, 1, CGAL::CLOCKWISE, s6, t6); + Kernel::Point_2 c6 = Kernel::Point_2(0, 0); + Point_2 s6 = Point_2(Number_type(-1, 1), Number_type(0, 1)); + Point_2 t6 = Point_2(Number_type(1, 1), Number_type(0, 1)); + Arc_section_2 circ_arc1(c6, 1, CGAL::CLOCKWISE, s6, t6); - curves.push_back (circ_arc1); + curves.push_back(circ_arc1); // Create a circular arc of the unit circle, directed clockwise from // (1, 0) to (3, 0). Note that we orient the // supporting circle accordingly. - Kernel::Point_2 c1 = Kernel::Point_2 (3, 0); - Point_2 s1 = Point_2 ( Number_type (1, 1), Number_type (0, 1) ); - Point_2 t1 = Point_2 ( Number_type (5, 1), Number_type (0, 1)); - Arc_section_2 circ_arc2 (c1, 2, CGAL::CLOCKWISE, s1, t1); - curves.push_back (circ_arc2); - - + Kernel::Point_2 c1 = Kernel::Point_2(3, 0); + Point_2 s1 = Point_2(Number_type(1, 1), Number_type(0, 1)); + Point_2 t1 = Point_2(Number_type(5, 1), Number_type(0, 1)); + Arc_section_2 circ_arc2(c1, 2, CGAL::CLOCKWISE, s1, t1); + curves.push_back(circ_arc2); Circle_2 circ = Circle_2(c6, 1, CGAL::CLOCKWISE); Arc_x_monotone_section_2 xc1(circ, s6, t6, CGAL::CLOCKWISE); @@ -145,51 +142,56 @@ int main (int argc, char* argv[]) Arc_x_monotone_section_2 xc2(circ1, s1, t1, CGAL::CLOCKWISE); x_curves.push_back(xc2); + // Polycurve circ_arc_polycurve = + // traits.construct_curve_2_object()(curves.begin(), curves.end()); + X_monotone_polycurve x_polycurve_1 = + traits.construct_x_monotone_curve_2_object()(x_curves.begin(), + x_curves.end()); - - - //Polycurve circ_arc_polycurve = traits.construct_curve_2_object() ( curves.begin(), curves.end() ); - X_monotone_polycurve x_polycurve_1 = traits.construct_x_monotone_curve_2_object()( x_curves.begin(), x_curves.end() ); - - Kernel::Point_2 cen = Kernel::Point_2 (-2, 0); + Kernel::Point_2 cen = Kernel::Point_2(-2, 0); Circle_2 circ2 = Circle_2(cen, 2, CGAL::CLOCKWISE); - Point_2 s2 = Point_2 ( Number_type (-4, 1), Number_type (0, 1) ); - Point_2 t2 = Point_2 ( Number_type (0, 1), Number_type (0, 1)); + Point_2 s2 = Point_2(Number_type(-4, 1), Number_type(0, 1)); + Point_2 t2 = Point_2(Number_type(0, 1), Number_type(0, 1)); Arc_x_monotone_section_2 xc3(circ2, s2, t2, CGAL::CLOCKWISE); x_curves.clear(); x_curves.push_back(xc3); - X_monotone_polycurve x_polycurve_2 = traits.construct_x_monotone_curve_2_object()( x_curves.begin(), x_curves.end() ); + X_monotone_polycurve x_polycurve_2 = + traits.construct_x_monotone_curve_2_object()(x_curves.begin(), + x_curves.end()); //testing for arc construction from two points. - //Arc_x_monotone_section_2 x_segment( Kernel::Point_2(0, 0), Kernel::Point_2(2, 0) ); + //Arc_x_monotone_section_2 x_segment(Kernel::Point_2(0, 0), + // Kernel::Point_2(2, 0)); //x_curves.clear(); //x_curves.push_back(x_segment); - //X_monotone_polycurve x_polycurve_3 = traits.construct_x_monotone_curve_2_object()( x_curves.begin(), x_curves.end() ); + //X_monotone_polycurve x_polycurve_3 = + //traits.construct_x_monotone_curve_2_object()(x_curves.begin(), + // x_curves.end()); //std::cout<< "x_polycurve_3: " << x_polycurve_3 << std::endl; - //Another polycurve curves.clear(); - - Kernel::Point_2 center = Kernel::Point_2 (-10, 10); - Point_2 source = Point_2 ( Number_type (-10, 1), Number_type (13, 1) ); - Point_2 target = Point_2 ( Number_type (-7, 1), Number_type (10, 1)); - Arc_section_2 circ_arc (center, 3, CGAL::CLOCKWISE, source, target); - curves.push_back( circ_arc ); - center = Kernel::Point_2 (-20, 10); - source = Point_2 ( Number_type (-7, 1), Number_type (10, 1) ); - target = Point_2 ( Number_type (-20, 1), Number_type (23, 1)); + Kernel::Point_2 center = Kernel::Point_2(-10, 10); + Point_2 source = Point_2(Number_type(-10, 1), Number_type(13, 1)); + Point_2 target = Point_2(Number_type(-7, 1), Number_type(10, 1)); + Arc_section_2 circ_arc(center, 3, CGAL::CLOCKWISE, source, target); + curves.push_back(circ_arc); + + center = Kernel::Point_2(-20, 10); + source = Point_2(Number_type(-7, 1), Number_type(10, 1)); + target = Point_2(Number_type(-20, 1), Number_type(23, 1)); circ_arc = Arc_section_2(center, 13, CGAL::CLOCKWISE, source, target); - curves.push_back( circ_arc ); + curves.push_back(circ_arc); - center = Kernel::Point_2 (-20, 25); - source = Point_2 ( Number_type (-20, 1), Number_type (23, 1) ); - target = Point_2 ( Number_type (-20, 1), Number_type (27, 1)); + center = Kernel::Point_2(-20, 25); + source = Point_2(Number_type(-20, 1), Number_type(23, 1)); + target = Point_2(Number_type(-20, 1), Number_type(27, 1)); circ_arc = Arc_section_2(center, 2, CGAL::CLOCKWISE, source, target); - curves.push_back( circ_arc ); + curves.push_back(circ_arc); - Polycurve curve_1 = traits.construct_curve_2_object()(curves.begin(), curves.end() ); + Polycurve curve_1 = + traits.construct_curve_2_object()(curves.begin(), curves.end()); ////////////////////// //Functor testing @@ -199,30 +201,25 @@ int main (int argc, char* argv[]) // check_intersect(x_polycurve_1, x_polycurve_2); //check_make_x_monotone(curve_1); - //checking if the cgal_assertion for curve construction for two points work or not. - //Point_2 push_back_point( Number_type (10, 1), Number_type (0, 1)); + //checking if the cgal_assertion for curve construction for two points work + //or not. + //Point_2 push_back_point(Number_type(10, 1), Number_type(0, 1)); //traits.push_back_2_object()(x_polycurve_1, push_back_point); + // //checking for trim. + // Arc_traits_2 arc_traits; + // source = Point_2(Number_type(1, 1), Number_type(0, 1)); + // target = Point_2(Number_type(3, 1), Number_type(2, 1)); + // // source = Point_2(Number_type(2, 1), Number_type(-2, 1)); + // // target = Point_2(Number_type(3, 1), Number_type(4, 1)); + // std::cout << " curve is : " << xc2 << std::endl; + // Arc_x_monotone_section_2 trimmed_curve = + // arc_traits.trim_2_object()(xc2, source, target); + // std::cout << "trimmed conic curve is : " << trimmed_curve << std::endl; - -//CHECK ARC TRIMMING - // if(Has_construct_x_monotone_curve_from_two_points_category()) - // std::cout << "It has a line segment constructor. " << std::endl; - - // //checking for trim. - // Arc_traits_2 arc_traits; - // source = Point_2 ( Number_type (1, 1), Number_type (0, 1) ); - // target = Point_2 ( Number_type (3, 1), Number_type (2, 1)); - // // source = Point_2 ( Number_type (2, 1), Number_type (-2, 1) ); - // // target = Point_2 ( Number_type (3, 1), Number_type (4, 1)); - // std::cout << " curve is : " << xc2 << std::endl; - // Arc_x_monotone_section_2 trimmed_curve = arc_traits.trim_2_object()(xc2, source, target); - // std::cout << "trimmed conic curve is : " << trimmed_curve << std::endl; - - - -check_trim(x_polycurve_1, atoi(argv[1]), atoi(argv[2]), atoi(argv[3]), atoi(argv[4])); - std::cout<< std::endl; + check_trim(x_polycurve_1, atoi(argv[1]), atoi(argv[2]), + atoi(argv[3]), atoi(argv[4])); + std::cout << std::endl; return 0; } diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_conic_polycurve.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_conic_polycurve.cpp index cbf72208e43..a6e6e855028 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_conic_polycurve.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_conic_polycurve.cpp @@ -3,9 +3,9 @@ #include #ifndef CGAL_USE_CORE #include -int main () +int main() { - std::cout << "Sorry, this example needs CORE ..." << std::endl; + std::cout << "Sorry, this example needs CORE ..." << std::endl; return 0; } @@ -27,203 +27,223 @@ int main () //#include - //////////////////// //conic traits //////////////////// -typedef CGAL::CORE_algebraic_number_traits Nt_traits; -typedef Nt_traits::Rational Rational; -typedef Nt_traits::Algebraic Algebraic; -typedef CGAL::Cartesian Rat_kernel; -typedef Rat_kernel::Point_2 Rat_point_2; -typedef Rat_kernel::Segment_2 Rat_segment_2; -typedef Rat_kernel::Circle_2 Rat_circle_2; -typedef CGAL::Cartesian Alg_kernel; -typedef CGAL::Arr_conic_traits_2 Conic_traits_2; -typedef Conic_traits_2::Point_2 Conic_point_2; -typedef Conic_traits_2::Curve_2 Conic_curve_2; -typedef Conic_traits_2::X_monotone_curve_2 Conic_x_monotone_curve_2; -typedef CGAL::Arr_polyline_traits_2 Polycurve_conic_traits_2; -typedef Polycurve_conic_traits_2::X_monotone_curve_2 Pc_x_monotone_curve_2; -//typedef Polycurve_conic_traits_2::Point_2 polypoint; - -typedef Conic_traits_2::Has_construct_x_monotone_curve_from_two_points_category Has_construct_x_monotone_curve_from_two_points_category; - +typedef CGAL::CORE_algebraic_number_traits Nt_traits; +typedef Nt_traits::Rational Rational; +typedef Nt_traits::Algebraic Algebraic; +typedef CGAL::Cartesian Rat_kernel; +typedef Rat_kernel::Point_2 Rat_point_2; +typedef Rat_kernel::Segment_2 Rat_segment_2; +typedef Rat_kernel::Circle_2 Rat_circle_2; +typedef CGAL::Cartesian Alg_kernel; +typedef CGAL::Arr_conic_traits_2 + Conic_traits_2; +typedef Conic_traits_2::Point_2 Conic_point_2; +typedef Conic_traits_2::Curve_2 Conic_curve_2; +typedef Conic_traits_2::X_monotone_curve_2 Conic_x_monotone_curve_2; +typedef CGAL::Arr_polyline_traits_2 Polycurve_conic_traits_2; +typedef Polycurve_conic_traits_2::X_monotone_curve_2 Pc_x_monotone_curve_2; +// typedef Polycurve_conic_traits_2::Point_2 polypoint; // typedef CGAL::Arr_polyline_traits_2< -// CGAL::Arr_conic_traits_2, -// CGAL::Cartesian, -// CGAL::CORE_algebraic_number_traits> -// >::Point_2 test_point_2; - +// CGAL::Arr_conic_traits_2, +// CGAL::Cartesian, +// CGAL::CORE_algebraic_number_traits> +// >::Point_2 test_point_2; - void check_equal() - { - +void check_equal() +{ bool are_equal; - + Polycurve_conic_traits_2 traits; Polycurve_conic_traits_2::Equal_2 equal = traits.equal_2_object(); - Polycurve_conic_traits_2::Construct_x_monotone_curve_2 construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); + Polycurve_conic_traits_2::Construct_x_monotone_curve_2 + construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); //create some curves - Conic_point_2 ps1 (Rational(1,4), 4); - Conic_point_2 pt1 (2, Rational(1,2)); - Conic_curve_2 c1 (0, 0, 1, 0, 0, -1, CGAL::COUNTERCLOCKWISE, ps1, pt1); - + Conic_point_2 ps1(Rational(1,4), 4); + Conic_point_2 pt1(2, Rational(1,2)); + Conic_curve_2 c1(0, 0, 1, 0, 0, -1, CGAL::COUNTERCLOCKWISE, ps1, pt1); - Conic_point_2 ps2 (Rational(1,4), 4); - Conic_point_2 pt2 (2, Rational(1,2)); - Conic_curve_2 c2 (0, 0, 1, 0, 0, -1, CGAL::COUNTERCLOCKWISE, ps2, pt2); + Conic_point_2 ps2(Rational(1,4), 4); + Conic_point_2 pt2(2, Rational(1,2)); + Conic_curve_2 c2(0, 0, 1, 0, 0, -1, CGAL::COUNTERCLOCKWISE, ps2, pt2); + Rat_point_2 ps3(Rational(1,4), 4); + Rat_point_2 pmid3(Rational(3,2), 2); + Rat_point_2 pt3(2, Rational(1,3)); + Conic_curve_2 c3(ps3, pmid3, pt3); - Rat_point_2 ps3 (Rational(1,4), 4); - Rat_point_2 pmid3(Rational(3,2), 2); - Rat_point_2 pt3 (2, Rational(1,3)); - Conic_curve_2 c3 (ps3, pmid3, pt3); - - Rat_point_2 ps4 (1, 5); - Rat_point_2 pmid4(Rational(3,2), 3); - Rat_point_2 pt4 (3, Rational(1,3)); - Conic_curve_2 c4 (ps4, pmid4, pt4); - + Rat_point_2 ps4(1, 5); + Rat_point_2 pmid4(Rational(3,2), 3); + Rat_point_2 pt4(3, Rational(1,3)); + Conic_curve_2 c4(ps4, pmid4, pt4); // //make x_monotone - Polycurve_conic_traits_2::X_monotone_curve_2 xmc1 = construct_x_monotone_curve_2(c1); - Polycurve_conic_traits_2::X_monotone_curve_2 xmc2 = construct_x_monotone_curve_2(c2); - Polycurve_conic_traits_2::X_monotone_curve_2 xmc3 = construct_x_monotone_curve_2(c3); - Polycurve_conic_traits_2::X_monotone_curve_2 xmc4 = construct_x_monotone_curve_2(c4); + Polycurve_conic_traits_2::X_monotone_curve_2 xmc1 = + construct_x_monotone_curve_2(c1); + Polycurve_conic_traits_2::X_monotone_curve_2 xmc2 = + construct_x_monotone_curve_2(c2); + Polycurve_conic_traits_2::X_monotone_curve_2 xmc3 = + construct_x_monotone_curve_2(c3); + Polycurve_conic_traits_2::X_monotone_curve_2 xmc4 = + construct_x_monotone_curve_2(c4); are_equal = equal(xmc1, xmc2); - std::cout << "Two equal conic arcs are computed as: " << ( (are_equal) ? "equal" : "Not equal") << std::endl; + std::cout << "Two equal conic arcs are computed as: " + << ((are_equal) ? "equal" : "Not equal") << std::endl; are_equal = equal(xmc3, xmc2); - std::cout << "Two un-equal conic arcs are computed as: " << ( (are_equal) ? "equal" : "Not equal") << std::endl; + std::cout << "Two un-equal conic arcs are computed as: " + << ((are_equal) ? "equal" : "Not equal") << std::endl; are_equal = equal(xmc3, xmc4); - std::cout << "Two un-equal conic arcs are computed as: " << ( (are_equal) ? "equal" : "Not equal") << std::endl; - + std::cout << "Two un-equal conic arcs are computed as: " + << ((are_equal) ? "equal" : "Not equal") << std::endl; } template - void check_intersect( curve_type &xcv1, curve_type &xcv2 ) + void check_intersect(curve_type &xcv1, curve_type &xcv2) { - Polycurve_conic_traits_2 traits; - std::vector intersection_points; - - traits.intersect_2_object()(xcv1, xcv2, std::back_inserter(intersection_points)); - std::cout<< "Number of intersection Points: " << intersection_points.size() << std::endl; + traits.intersect_2_object()(xcv1, xcv2, + std::cout<< "Number of intersection Points: " << intersection_points.size() + << std::endl; //dynamic cast the cgal_objects - // std::vector< std::pair > pm_vector; + // std::vector< std::pair > pm_vector; // for(int i=0; i pm = - // CGAL::object_cast< std::pair > (&(intersection_points[i])); + // std::pair pm = + // CGAL::object_cast > + // (&(intersection_points[i])); // pm_vector.push_back(pm); // } - } void check_compare_end_points_xy_2() { Polycurve_conic_traits_2 traits; - Polycurve_conic_traits_2::Construct_x_monotone_curve_2 construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); - Polycurve_conic_traits_2::Compare_endpoints_xy_2 compare_endpoints_xy_2 = traits.compare_endpoints_xy_2_object(); + Polycurve_conic_traits_2::Construct_x_monotone_curve_2 + construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); + Polycurve_conic_traits_2::Compare_endpoints_xy_2 compare_endpoints_xy_2 = + traits.compare_endpoints_xy_2_object(); //create some curves - Conic_point_2 ps1 (Rational(1,4), 4); - Conic_point_2 pt1 (2, Rational(1,2)); - Conic_curve_2 c1 (0, 0, 1, 0, 0, -1, CGAL::COUNTERCLOCKWISE, ps1, pt1); + Conic_point_2 ps1(Rational(1,4), 4); + Conic_point_2 pt1(2, Rational(1,2)); + Conic_curve_2 c1(0, 0, 1, 0, 0, -1, CGAL::COUNTERCLOCKWISE, ps1, pt1); // Insert a parabolic arc that is supported by a parabola y = -x^2 // (or: x^2 + y = 0) and whose endpoints are (-sqrt(3), -3) ~ (-1.73, -3) - // and (sqrt(2), -2) ~ (1.41, -2). Notice that since the x-coordinates + // and (sqrt(2), -2) ~ (1.41, -2). Notice that since the x-coordinates // of the endpoints cannot be acccurately represented, we specify them // as the intersections of the parabola with the lines y = -3 and y = -2. // Note that the arc is clockwise oriented. - Conic_curve_2 c2 = Conic_curve_2 (1, 0, 0, 0, 1, 0, // The parabola. - CGAL::CLOCKWISE, - Conic_point_2 (-1.73, -3), // Approximation of the source. - 0, 0, 0, 0, 1, 3, // The line: y = -3. - Conic_point_2 (1.41, -2), // Approximation of the target. - 0, 0, 0, 0, 1, 2); // The line: y = -2. - CGAL_assertion (c2.is_valid()); + Conic_curve_2 + c2 = Conic_curve_2(1, 0, 0, 0, 1, 0, // The parabola. + CGAL::CLOCKWISE, + Conic_point_2(-1.73, -3), // Approximation of the source. + 0, 0, 0, 0, 1, 3, // The line: y = -3. + Conic_point_2(1.41, -2), // Approximation of the target. + 0, 0, 0, 0, 1, 2); // The line: y = -2. + CGAL_assertion(c2.is_valid()); //make polyline x-monotone curves - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = construct_x_monotone_curve_2(c1); - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc2 = construct_x_monotone_curve_2(c2); + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = + construct_x_monotone_curve_2(c1); + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc2 = + construct_x_monotone_curve_2(c2); CGAL::Comparison_result res = compare_endpoints_xy_2(polyline_xmc1); - std::cout << "compare_end_points_xy_2 for counterclockwise curve: "<< (res == CGAL::SMALLER ? "SMALLER": + std::cout << "compare_end_points_xy_2 for counterclockwise curve: " + << (res == CGAL::SMALLER ? "SMALLER": (res == CGAL::LARGER ? "LARGER" : "EQUAL")) << std::endl; res = compare_endpoints_xy_2(polyline_xmc2); - std::cout<< "compare_end_points_xy_2 for clockwise curve: "<< (res == CGAL::SMALLER ? "SMALLER": + std::cout<< "compare_end_points_xy_2 for clockwise curve: " + << (res == CGAL::SMALLER ? "SMALLER": (res == CGAL::LARGER ? "LARGER" : "EQUAL")) << std::endl; } template -void check_split( Curve_type &xcv1, Curve_type &xcv2 ) +void check_split(Curve_type &xcv1, Curve_type &xcv2) { Polycurve_conic_traits_2 traits; //split x poly-curves - Conic_curve_2 c6(1,1,0,6,-26,162,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(-7), Algebraic(13) ), Conic_point_2( Algebraic(-3), Algebraic(9) ) ); - Conic_curve_2 c7(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(-3), Algebraic(9) ), Conic_point_2( Algebraic(0), Algebraic(0) ) ); - Conic_curve_2 c8(0,1,0,-1,0,0, CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(0), Algebraic(0) ), Conic_point_2( Algebraic(4), Algebraic(-2) ) ); + Conic_curve_2 c6(1,1,0,6,-26,162,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(-7), Algebraic(13)), + Conic_point_2(Algebraic(-3), Algebraic(9))); + Conic_curve_2 c7(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(-3), Algebraic(9)), + Conic_point_2(Algebraic(0), Algebraic(0))); + Conic_curve_2 c8(0,1,0,-1,0,0, CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(0), Algebraic(0)), + Conic_point_2(Algebraic(4), Algebraic(-2))); - Conic_x_monotone_curve_2 xc6 (c6); - Conic_x_monotone_curve_2 xc7 (c7); - Conic_x_monotone_curve_2 xc8 (c8); + Conic_x_monotone_curve_2 xc6(c6); + Conic_x_monotone_curve_2 xc7(c7); + Conic_x_monotone_curve_2 xc8(c8); std::vector xmono_conic_curves_2; - + xmono_conic_curves_2.push_back(xc6); xmono_conic_curves_2.push_back(xc7); - Pc_x_monotone_curve_2 split_expected_1 = traits.construct_x_monotone_curve_2_object()(xmono_conic_curves_2.begin(), xmono_conic_curves_2.end()); + Pc_x_monotone_curve_2 split_expected_1 = + traits.construct_x_monotone_curve_2_object()(xmono_conic_curves_2.begin(), + xmono_conic_curves_2.end()); xmono_conic_curves_2.clear(); xmono_conic_curves_2.push_back(xc8); - Pc_x_monotone_curve_2 split_expected_2 = traits.construct_x_monotone_curve_2_object()(xmono_conic_curves_2.begin(), xmono_conic_curves_2.end()); + Pc_x_monotone_curve_2 split_expected_2 = + traits.construct_x_monotone_curve_2_object()(xmono_conic_curves_2.begin(), + xmono_conic_curves_2.end()); Polycurve_conic_traits_2::X_monotone_curve_2 split_curve_1, split_curve_2; - Polycurve_conic_traits_2::Point_2 point_of_split = Polycurve_conic_traits_2::Point_2(0,0); + Polycurve_conic_traits_2::Point_2 + point_of_split = Polycurve_conic_traits_2::Point_2(0,0); - //Split functor + //Split functor traits.split_2_object()(xcv2, point_of_split, split_curve_1, split_curve_2); - bool split_1_chk = traits.equal_2_object() (split_curve_1, split_expected_1); - bool split_2_chk = traits.equal_2_object() (split_curve_2, split_expected_2); + bool split_1_chk = traits.equal_2_object()(split_curve_1, split_expected_1); + bool split_2_chk = traits.equal_2_object()(split_curve_2, split_expected_2); if(split_1_chk && split_2_chk) - std::cout<< "Split is working fine" << std::endl; + std::cout << "Split is working fine" << std::endl; else - std::cout<< "Something is wrong with split" << std::endl; - + std::cout << "Something is wrong with split" << std::endl; } void check_is_vertical() { Polycurve_conic_traits_2 traits; - Polycurve_conic_traits_2::Construct_x_monotone_curve_2 construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); - Polycurve_conic_traits_2::Is_vertical_2 is_vertical = traits.is_vertical_2_object(); + Polycurve_conic_traits_2::Construct_x_monotone_curve_2 + construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); + Polycurve_conic_traits_2::Is_vertical_2 is_vertical = + traits.is_vertical_2_object(); //create a curve - Rat_point_2 ps1 (1, 10); - Rat_point_2 pmid1(5, 4); - Rat_point_2 pt1 (10, 1); - Conic_curve_2 c1 (ps1, pmid1, pt1); + Rat_point_2 ps1(1, 10); + Rat_point_2 pmid1(5, 4); + Rat_point_2 pt1(10, 1); + Conic_curve_2 c1(ps1, pmid1, pt1); //make x-monotone curve - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = construct_x_monotone_curve_2(c1); + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = + construct_x_monotone_curve_2(c1); bool result = is_vertical(polyline_xmc1); - std::cout << "Is_verticle:: Expected first result is not vertivle: Computed: " << ( (result)? "vertical" : "not vertical" ) << std::endl; - + std::cout << "Is_verticle:: Expected first result is not vertivle: Computed: " + << ((result)? "vertical" : "not vertical") << std::endl; } /*! */ @@ -250,16 +270,18 @@ bool read_app_point(stream& is, Conic_point_2& p) //waqar: my modification // long int rat_x_num, rat_x_den, rat_y_num, rat_y_den; // is >> rat_x_num >> rat_x_den >> rat_y_num >> rat_y_den; - - //Basic_number_type x(rat_x), y(rat_y); - // p = Conic_point_2( Rational(rat_x_num, rat_x_den), Rational(rat_y_num, rat_y_den) ); - //return true; + + // Basic_number_type x(rat_x), y(rat_y); + // p = Conic_point_2(Rational(rat_x_num, rat_x_den), + // Rational(rat_y_num, rat_y_den)); + // return true; } /*! */ template bool read_orientation_and_end_points(stream& is, CGAL::Orientation& orient, - Conic_point_2& source, Conic_point_2& target) + Conic_point_2& source, + Conic_point_2& target) { // Read the orientation. if (!read_orientation(is, orient)) return false; @@ -300,12 +322,14 @@ bool read_general_arc(stream& is, Curve& cv) Rational r2, s2, t2, u2, v2, w2; is >> r2 >> s2 >> t2 >> u2 >> v2 >> w2; - std::cout << "line is: " << r << s << t << u << v << w << i_orient << r1 << s1 << t1 << u1 << v1 << w1 << r2 << s2 << t2 << u2 << v2 << w2 << std::endl; + std::cout << "line is: " << r << s << t << u << v << w << i_orient + << r1 << s1 << t1 << u1 << v1 << w1 + << r2 << s2 << t2 << u2 << v2 << w2 << std::endl; // Create the conic arc. cv = Curve(r, s, t, u, v, w, orient, - app_source, r1, s1, t1, u1, v1, w1, - app_target, r2, s2, t2, u2, v2, w2); + app_source, r1, s1, t1, u1, v1, w1, + app_target, r2, s2, t2, u2, v2, w2); return true; } @@ -321,8 +345,6 @@ bool read_general_conic(stream& is, Curve& cv) return true; } - - // /*! */ template bool read_general_curve(stream& is, Curve& cv) @@ -336,13 +358,14 @@ bool read_general_curve(stream& is, Curve& cv) return false; // Create the conic (or circular) arc. - //std::cout<< "arc coefficients: " << r << " " << s << " " << t << " " << u << " " << v << " " << w << std::endl; - //std::cout<< "Read Points : " << source.x() << " " << source.y() << " " << target.x() << " " << target.y() << std::endl; + // std::cout << "arc coefficients: " << r << " " << s << " " << t << " " + // << u << " " << v << " " << w << std::endl; + // std::cout << "Read Points : " << source.x() << " " << source.y() << " " + // << target.x() << " " << target.y() << std::endl; cv = Curve(r, s, t, u, v, w, orient, source, target); return true; } -std::istream& skip_comments(std::istream& is, - std::string& line) +std::istream& skip_comments(std::istream& is, std::string& line) { while (std::getline(is, line)) if (!line.empty() && (line[0] != '#')) break; @@ -352,25 +375,32 @@ std::istream& skip_comments(std::istream& is, bool check_compare_y_at_x_2() { Polycurve_conic_traits_2 traits; - Polycurve_conic_traits_2::Compare_y_at_x_2 cmp_y_at_x_2 = traits.compare_y_at_x_2_object(); + Polycurve_conic_traits_2::Compare_y_at_x_2 cmp_y_at_x_2 = + traits.compare_y_at_x_2_object(); //polycurve constructors - Polycurve_conic_traits_2::Construct_x_monotone_curve_2 construct_x_mono_polycurve = traits.construct_x_monotone_curve_2_object(); - Polycurve_conic_traits_2::Construct_curve_2 construct_polycurve = traits.construct_curve_2_object(); + Polycurve_conic_traits_2::Construct_x_monotone_curve_2 + construct_x_mono_polycurve = traits.construct_x_monotone_curve_2_object(); + Polycurve_conic_traits_2::Construct_curve_2 construct_polycurve = + traits.construct_curve_2_object(); //create a curve - Rat_point_2 ps1 (1, 10); - Rat_point_2 pmid1(5, 4); - Rat_point_2 pt1 (10, 1); - Conic_curve_2 c1 (ps1, pmid1, pt1); + Rat_point_2 ps1(1, 10); + Rat_point_2 pmid1(5, 4); + Rat_point_2 pt1(10, 1); + Conic_curve_2 c1(ps1, pmid1, pt1); //create a curve - Rat_point_2 ps2 (10, 1); - Rat_point_2 pmid2(15, 5); - Rat_point_2 pt2 (20, 10); - Conic_curve_2 c2 (ps2, pmid2, pt2); + Rat_point_2 ps2(10, 1); + Rat_point_2 pmid2(15, 5); + Rat_point_2 pt2(20, 10); + Conic_curve_2 c2(ps2, pmid2, pt2); - Conic_curve_2 c3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(0), Algebraic(0) ), Conic_point_2( Algebraic(3), Algebraic(9) ) ); - Conic_curve_2 c4(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(3), Algebraic(9) ), Conic_point_2( Algebraic(5), Algebraic(25) ) ); + Conic_curve_2 c3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(0), Algebraic(0)), + Conic_point_2(Algebraic(3), Algebraic(9))); + Conic_curve_2 c4(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(3), Algebraic(9)), + Conic_point_2(Algebraic(5), Algebraic(25))); std::vector conic_curves, conic_curves_2, Conic_curves_3; conic_curves.push_back(c1); @@ -379,50 +409,61 @@ bool check_compare_y_at_x_2() //conic_curves_2.push_back(c3); //conic_curves_2.push_back(c4); - Conic_x_monotone_curve_2 xc1 (c1); - Conic_x_monotone_curve_2 xc2 (c2); - Conic_x_monotone_curve_2 xc3 (c3); - Conic_x_monotone_curve_2 xc4 (c4); + Conic_x_monotone_curve_2 xc1(c1); + Conic_x_monotone_curve_2 xc2(c2); + Conic_x_monotone_curve_2 xc3(c3); + Conic_x_monotone_curve_2 xc4(c4); - std::vector xmono_conic_curves, xmono_conic_curves_2; /* VERY IMPORTANT - For efficiency reasons, we recommend users not to construct x-monotone conic arc directly, - but rather use the Make_x_monotone_2 functor supplied by the conic-arc traits class to convert conic curves to x-monotone curves. - */ + * For efficiency reasons, we recommend users not to construct x-monotone + * conic arc directly, but rather use the Make_x_monotone_2 functor supplied + * by the conic-arc traits class to convert conic curves to x-monotone curves. + */ xmono_conic_curves.push_back(xc1); xmono_conic_curves.push_back(xc2); xmono_conic_curves_2.push_back(xc3); xmono_conic_curves_2.push_back(xc4); //construct x-monotone poly-curve - Polycurve_conic_traits_2::X_monotone_curve_2 conic_x_mono_polycurve = construct_x_mono_polycurve(xmono_conic_curves.begin(), xmono_conic_curves.end()); - Polycurve_conic_traits_2::X_monotone_curve_2 conic_x_mono_polycurve_2 = construct_x_mono_polycurve(xmono_conic_curves_2.begin(), xmono_conic_curves_2.end()); + Polycurve_conic_traits_2::X_monotone_curve_2 conic_x_mono_polycurve = + construct_x_mono_polycurve(xmono_conic_curves.begin(), + xmono_conic_curves.end()); + Polycurve_conic_traits_2::X_monotone_curve_2 conic_x_mono_polycurve_2 = + construct_x_mono_polycurve(xmono_conic_curves_2.begin(), + xmono_conic_curves_2.end()); //construct poly-curve - Polycurve_conic_traits_2::Curve_2 conic_polycurve = construct_polycurve( conic_curves.begin(), conic_curves.end() ); - //Polycurve_conic_traits_2::Curve_2 conic_polycurve_2 = construct_polycurve( conic_curves_2.begin(), conic_curves_2.end() ); + Polycurve_conic_traits_2::Curve_2 conic_polycurve = + construct_polycurve(conic_curves.begin(), conic_curves.end()); + //Polycurve_conic_traits_2::Curve_2 conic_polycurve_2 = + // construct_polycurve(conic_curves_2.begin(), conic_curves_2.end()); //make x-monotone curve - //Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = construct_x_monotone_curve_2(c1); - + //Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = + // construct_x_monotone_curve_2(c1); + //create points - Polycurve_conic_traits_2::Point_2 point_above_line = Polycurve_conic_traits_2::Point_2(2,10), - point_below_line = Polycurve_conic_traits_2::Point_2(4,7), - point_on_line = Polycurve_conic_traits_2::Point_2(2,4); + Polycurve_conic_traits_2::Point_2 + point_above_line = Polycurve_conic_traits_2::Point_2(2,10), + point_below_line = Polycurve_conic_traits_2::Point_2(4,7), + point_on_line = Polycurve_conic_traits_2::Point_2(2,4); CGAL::Comparison_result result; result = cmp_y_at_x_2(point_above_line, conic_x_mono_polycurve_2); - std::cout << "Compare_y_at_x_2:: for point above the curve computed Answer is: "<< (result == CGAL::SMALLER ? "Below": + std::cout << "Compare_y_at_x_2:: for point above the curve computed Answer is: " + << (result == CGAL::SMALLER ? "Below": (result == CGAL::LARGER ? "Above" : "On-line")) << std::endl; result = cmp_y_at_x_2(point_below_line, conic_x_mono_polycurve_2); - std::cout << "Compare_y_at_x_2:: for point below the curve computed Answer is: "<< (result == CGAL::SMALLER ? "Below": + std::cout << "Compare_y_at_x_2:: for point below the curve computed Answer is: " + << (result == CGAL::SMALLER ? "Below": (result == CGAL::LARGER ? "Above" : "On-line")) << std::endl; result = cmp_y_at_x_2(point_on_line, conic_x_mono_polycurve_2); - std::cout << "Compare_y_at_x_2:: for point on the curve computed Answer is: "<< (result == CGAL::SMALLER ? "Below": + std::cout << "Compare_y_at_x_2:: for point on the curve computed Answer is: " + << (result == CGAL::SMALLER ? "Below": (result == CGAL::LARGER ? "Above" : "On-line")) << std::endl; return true; @@ -431,169 +472,186 @@ bool check_compare_y_at_x_2() void check_are_mergable() { Polycurve_conic_traits_2 traits; - Polycurve_conic_traits_2::Construct_x_monotone_curve_2 construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); - Polycurve_conic_traits_2::Are_mergeable_2 are_mergeable_2 = traits.are_mergeable_2_object(); + Polycurve_conic_traits_2::Construct_x_monotone_curve_2 + construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); + Polycurve_conic_traits_2::Are_mergeable_2 are_mergeable_2 = + traits.are_mergeable_2_object(); //create a curve - Rat_point_2 ps1 (1, 10); - Rat_point_2 pmid1(5, 4); - Rat_point_2 pt1 (10, 1); - Conic_curve_2 c1 (ps1, pmid1, pt1); + Rat_point_2 ps1(1, 10); + Rat_point_2 pmid1(5, 4); + Rat_point_2 pt1(10, 1); + Conic_curve_2 c1(ps1, pmid1, pt1); - Rat_point_2 ps2 (10, 1); - Rat_point_2 pmid2(15, 14); - Rat_point_2 pt2 (20, 20); - Conic_curve_2 c2 (ps2, pmid2, pt2); + Rat_point_2 ps2(10, 1); + Rat_point_2 pmid2(15, 14); + Rat_point_2 pt2(20, 20); + Conic_curve_2 c2(ps2, pmid2, pt2); - Rat_point_2 ps3 (Rational(1,4), 4); - Rat_point_2 pmid3(Rational(3,2), 2); - Rat_point_2 pt3 (2, Rational(1,3)); - Conic_curve_2 c3 (ps3, pmid3, pt3); + Rat_point_2 ps3(Rational(1,4), 4); + Rat_point_2 pmid3(Rational(3,2), 2); + Rat_point_2 pt3(2, Rational(1,3)); + Conic_curve_2 c3(ps3, pmid3, pt3); - //construct x-monotone curve (compatible with polyline class) - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = construct_x_monotone_curve_2(c1); - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc2 = construct_x_monotone_curve_2(c2); - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc3 = construct_x_monotone_curve_2(c3); + //construct x-monotone curve(compatible with polyline class) + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = + construct_x_monotone_curve_2(c1); + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc2 = + construct_x_monotone_curve_2(c2); + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc3 = + construct_x_monotone_curve_2(c3); - bool result; - - result = are_mergeable_2(polyline_xmc1, polyline_xmc2); - std::cout << "Are_mergable:: Mergable x-monotone polycurves are Computed as: " << ( (result)? "Mergable" : "Not-Mergable" ) << std::endl; + bool result = are_mergeable_2(polyline_xmc1, polyline_xmc2); + std::cout << "Are_mergable:: Mergable x-monotone polycurves are Computed as: " + << ((result)? "Mergable" : "Not-Mergable") << std::endl; result = are_mergeable_2(polyline_xmc1, polyline_xmc3); - std::cout << "Are_mergable:: Non-Mergable x-monotone polycurves are Computed as: " << ( (result)? "Mergable" : "Not-Mergable" ) << std::endl; - + std::cout << "Are_mergable:: Non-Mergable x-monotone polycurves are Computed as: " + << ((result)? "Mergable" : "Not-Mergable") << std::endl; } void check_merge_2() { Polycurve_conic_traits_2 traits; - Polycurve_conic_traits_2::Construct_x_monotone_curve_2 construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); + Polycurve_conic_traits_2::Construct_x_monotone_curve_2 + construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); Polycurve_conic_traits_2::Merge_2 merge_2 = traits.merge_2_object(); //create a curve - Rat_point_2 ps1 (1, 10); - Rat_point_2 pmid1(5, 4); - Rat_point_2 pt1 (10, 1); - Conic_curve_2 c1 (ps1, pmid1, pt1); + Rat_point_2 ps1(1, 10); + Rat_point_2 pmid1(5, 4); + Rat_point_2 pt1(10, 1); + Conic_curve_2 c1(ps1, pmid1, pt1); - Rat_point_2 ps2 (10, 1); - Rat_point_2 pmid2(15, 14); - Rat_point_2 pt2 (20, 20); - Conic_curve_2 c2 (ps2, pmid2, pt2); + Rat_point_2 ps2(10, 1); + Rat_point_2 pmid2(15, 14); + Rat_point_2 pt2(20, 20); + Conic_curve_2 c2(ps2, pmid2, pt2); //construct x-monotone curve (compatible with polyline class) - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = construct_x_monotone_curve_2(c1); - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc2 = construct_x_monotone_curve_2(c2); - - Polycurve_conic_traits_2::X_monotone_curve_2 merged_xmc; + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = + construct_x_monotone_curve_2(c1); + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc2 = + construct_x_monotone_curve_2(c2); + Polycurve_conic_traits_2::X_monotone_curve_2 merged_xmc; merge_2(polyline_xmc1, polyline_xmc2, merged_xmc); - std::cout<< "Merge_2:: Mergable x-monotone curves merged successfully"<< std:: endl; - + std::cout<< "Merge_2:: Mergable x-monotone curves merged successfully" + << std:: endl; } void check_construct_opposite() { Polycurve_conic_traits_2 traits; - Polycurve_conic_traits_2::Construct_x_monotone_curve_2 construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); - Polycurve_conic_traits_2::Construct_opposite_2 construct_opposite_2 = traits.construct_opposite_2_object(); + Polycurve_conic_traits_2::Construct_x_monotone_curve_2 + construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); + Polycurve_conic_traits_2::Construct_opposite_2 construct_opposite_2 = + traits.construct_opposite_2_object(); //create a curve - Rat_point_2 ps1 (1, 10); - Rat_point_2 pmid1(5, 4); - Rat_point_2 pt1 (10, 1); - Conic_curve_2 c1 (ps1, pmid1, pt1); + Rat_point_2 ps1(1, 10); + Rat_point_2 pmid1(5, 4); + Rat_point_2 pt1(10, 1); + Conic_curve_2 c1(ps1, pmid1, pt1); //construct x-monotone curve (compatible with polyline class) - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = construct_x_monotone_curve_2(c1); - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_opposite_curve = construct_opposite_2(polyline_xmc1); + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = + construct_x_monotone_curve_2(c1); + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_opposite_curve = + construct_opposite_2(polyline_xmc1); std::cout<< "Construct_opposite_2:: Opposite curve created"; - - } void check_compare_y_at_x_right() { Polycurve_conic_traits_2 traits; - Polycurve_conic_traits_2::Construct_x_monotone_curve_2 construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); - Polycurve_conic_traits_2::Compare_y_at_x_right_2 cmp_y_at_x_right_2 = traits.compare_y_at_x_right_2_object(); + Polycurve_conic_traits_2::Construct_x_monotone_curve_2 + construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); + Polycurve_conic_traits_2::Compare_y_at_x_right_2 cmp_y_at_x_right_2 = + traits.compare_y_at_x_right_2_object(); //create constructing curves - Rat_point_2 ps2 (1, 10); - Rat_point_2 pmid2(5, 4); - Rat_point_2 pt2 (10, 1); - Conic_curve_2 c1 (ps2, pmid2, pt2); - - Rat_point_2 ps3 (10, 1); - Rat_point_2 pmid3(5, 4); - Rat_point_2 pt3 (1, 10); - Conic_curve_2 c2 (ps3, pmid3, pt3); + Rat_point_2 ps2(1, 10); + Rat_point_2 pmid2(5, 4); + Rat_point_2 pt2(10, 1); + Conic_curve_2 c1(ps2, pmid2, pt2); + Rat_point_2 ps3(10, 1); + Rat_point_2 pmid3(5, 4); + Rat_point_2 pt3(1, 10); + Conic_curve_2 c2(ps3, pmid3, pt3); //construct x-monotone curve (compatible with polyline class) - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = construct_x_monotone_curve_2(c1); - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc2 = construct_x_monotone_curve_2(c2); - Polycurve_conic_traits_2::Point_2 intersection_point = Polycurve_conic_traits_2::Point_2(5,4); + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = + construct_x_monotone_curve_2(c1); + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc2 = + construct_x_monotone_curve_2(c2); + Polycurve_conic_traits_2::Point_2 intersection_point = + Polycurve_conic_traits_2::Point_2(5,4); CGAL::Comparison_result result; - result = cmp_y_at_x_right_2(polyline_xmc1, polyline_xmc2, intersection_point); - std::cout << "Compare_y_at_x_right:: Expected Answer: equal, Computed answer: "<< (result == CGAL::SMALLER ? "smaller": + std::cout << "Compare_y_at_x_right:: Expected Answer: equal, Computed answer: " + << (result == CGAL::SMALLER ? "smaller": (result == CGAL::LARGER ? "Larger" : "equal")) << std::endl; } void check_compare_y_at_x_left() { Polycurve_conic_traits_2 traits; - Polycurve_conic_traits_2::Construct_x_monotone_curve_2 construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); - Polycurve_conic_traits_2::Compare_y_at_x_left_2 cmp_y_at_x_left_2 = traits.compare_y_at_x_left_2_object(); + Polycurve_conic_traits_2::Construct_x_monotone_curve_2 + construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); + Polycurve_conic_traits_2::Compare_y_at_x_left_2 cmp_y_at_x_left_2 = + traits.compare_y_at_x_left_2_object(); //create constructing curves - Rat_point_2 ps2 (1, 10); - Rat_point_2 pmid2(5, 4); - Rat_point_2 pt2 (10, 1); - Conic_curve_2 c1 (ps2, pmid2, pt2); + Rat_point_2 ps2(1, 10); + Rat_point_2 pmid2(5, 4); + Rat_point_2 pt2(10, 1); + Conic_curve_2 c1(ps2, pmid2, pt2); - Rat_point_2 ps3 (10, 1); - Rat_point_2 pmid3(5, 4); - Rat_point_2 pt3 (1, 10); - Conic_curve_2 c2 (ps3, pmid3, pt3); + Rat_point_2 ps3(10, 1); + Rat_point_2 pmid3(5, 4); + Rat_point_2 pt3(1, 10); + Conic_curve_2 c2(ps3, pmid3, pt3); - - //construct x-monotone curve (compatible with polyline class) - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = construct_x_monotone_curve_2(c1); - Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc2 = construct_x_monotone_curve_2(c2); - Polycurve_conic_traits_2::Point_2 intersection_point = Polycurve_conic_traits_2::Point_2(5,4); + //construct x-monotone curve(compatible with polyline class) + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc1 = + construct_x_monotone_curve_2(c1); + Polycurve_conic_traits_2::X_monotone_curve_2 polyline_xmc2 = + construct_x_monotone_curve_2(c2); + Polycurve_conic_traits_2::Point_2 intersection_point = + Polycurve_conic_traits_2::Point_2(5,4); CGAL::Comparison_result result; result = cmp_y_at_x_left_2(polyline_xmc1, polyline_xmc2, intersection_point); - std::cout << "Compare_y_at_x_left:: Expected Answer: equal, Computed answer: "<< (result == CGAL::SMALLER ? "smaller": + std::cout << "Compare_y_at_x_left:: Expected Answer: equal, Computed answer: " + << (result == CGAL::SMALLER ? "smaller": (result == CGAL::LARGER ? "Larger" : "equal")) << std::endl; } template -void check_make_x_monotne_curve( Curve_type c1) +void check_make_x_monotne_curve(Curve_type c1) { Polycurve_conic_traits_2 traits; - std::vector obj_vec; + traits.make_x_monotone_2_object()(c1, std::back_inserter(obj_vec)); - traits.make_x_monotone_2_object() (c1, std::back_inserter(obj_vec)); + std::cout << "The polycurve is: " << c1 << std::endl; - std::cout << "The polycurve is: " << c1 << std::endl; + std::cout<< "The poly curve have been split into " << obj_vec.size() + << " polycurves" << std::endl; - std::cout<< "The poly curve have been split into " << obj_vec.size() << " polycurves" << std::endl; - - //const Pc_x_monotone_curve_2 *split_curve_1 = CGAL::object_cast (&(obj_vec[0])); - //const Pc_x_monotone_curve_2 *split_curve_2 = CGAL::object_cast (&(obj_vec[1])); + //const Pc_x_monotone_curve_2 *split_curve_1 = + // CGAL::object_cast (&(obj_vec[0])); + //const Pc_x_monotone_curve_2 *split_curve_2 = + // CGAL::object_cast (&(obj_vec[1])); //std::cout << "The split curve 1 is: " << *split_curve_1 << std::endl; - //std::cout << "The split curve 2 is: " << *split_curve_2 << std::endl; - + //std::cout << "The split curve 2 is: " << *split_curve_2 << std::endl; } template @@ -604,9 +662,7 @@ void check_push_front(Curve base_curve, Segment curve_tobe_pushed) std::cout << "Base curve: " << base_curve << std::endl; std::cout << "push curve: " << curve_tobe_pushed << std::endl; - - traits.push_front_2_object()( base_curve, curve_tobe_pushed); - + traits.push_front_2_object()(base_curve, curve_tobe_pushed); std::cout << "result curve: " << base_curve << std::endl; } @@ -618,23 +674,27 @@ void check_push_back(Curve& base_curve, Segment curve_tobe_pushed) std::cout << "Base curve: " << base_curve << std::endl; std::cout << "push curve: " << curve_tobe_pushed << std::endl; - traits.push_back_2_object()( base_curve, curve_tobe_pushed); + traits.push_back_2_object()(base_curve, curve_tobe_pushed); std::cout << "result curve: " << base_curve << std::endl; } template -void check_compare_x_2(const Segment& seg1, const Segment& seg2 ) +void check_compare_x_2(const Segment& seg1, const Segment& seg2) { Polycurve_conic_traits_2 traits; CGAL::Comparison_result result; - result = traits.compare_x_2_object()(seg1, CGAL::ARR_MIN_END, seg2, CGAL::ARR_MIN_END); - std::cout << "Compare_x_2:: Expected Answer: Larger, Computed answer: "<< (result == CGAL::SMALLER ? "smaller": + result = traits.compare_x_2_object()(seg1, CGAL::ARR_MIN_END, seg2, + CGAL::ARR_MIN_END); + std::cout << "Compare_x_2:: Expected Answer: Larger, Computed answer: " + << (result == CGAL::SMALLER ? "smaller": (result == CGAL::LARGER ? "Larger" : "equal")) << std::endl; - result = traits.compare_x_2_object()(seg1, CGAL::ARR_MIN_END, seg2, CGAL::ARR_MAX_END); - std::cout << "Compare_x_2:: Expected Answer: Equal, Computed answer: "<< (result == CGAL::SMALLER ? "smaller": + result = traits.compare_x_2_object()(seg1, CGAL::ARR_MIN_END, seg2, + CGAL::ARR_MAX_END); + std::cout << "Compare_x_2:: Expected Answer: Equal, Computed answer: " + << (result == CGAL::SMALLER ? "smaller": (result == CGAL::LARGER ? "Larger" : "equal")) << std::endl; } @@ -642,24 +702,19 @@ template void check_compare_points(Curve& cv) { Polycurve_conic_traits_2 traits; - - CGAL::Arr_parameter_space result = traits.parameter_space_in_x_2_object()(cv, CGAL::ARR_MAX_END); + CGAL::Arr_parameter_space result = + traits.parameter_space_in_x_2_object()(cv, CGAL::ARR_MAX_END); } -// void check_enable_if(int a, int b, boost::enable_if::type > ) -// { -// std::cout << a+b << std::endl; -// } - template void check_trim(curve& xcv, int sx, int sy, int tx, int ty) { Polycurve_conic_traits_2 traits; - // Conic_point_2 source ( Algebraic(-16), Algebraic(-4) ); - // Conic_point_2 target ( Algebraic(4), Algebraic(16)); - Conic_point_2 source ( sx, sy ); - Conic_point_2 target ( tx, ty); + // Conic_point_2 source(Algebraic(-16), Algebraic(-4)); + // Conic_point_2 target(Algebraic(4), Algebraic(16)); + Conic_point_2 source(sx, sy); + Conic_point_2 target(tx, ty); Polycurve_conic_traits_2::Trim_2 trim_polycurve = traits.trim_2_object(); Pc_x_monotone_curve_2 trimmed_curve = trim_polycurve(xcv, source, target); @@ -669,145 +724,186 @@ void check_trim(curve& xcv, int sx, int sy, int tx, int ty) } -int main (int argc, char* argv[]) +int main(int argc, char* argv[]) { Polycurve_conic_traits_2 traits; //polycurve constructors - Polycurve_conic_traits_2::Construct_x_monotone_curve_2 construct_x_mono_polycurve = traits.construct_x_monotone_curve_2_object(); - Polycurve_conic_traits_2::Construct_curve_2 construct_polycurve = traits.construct_curve_2_object(); + Polycurve_conic_traits_2::Construct_x_monotone_curve_2 + construct_x_mono_polycurve = traits.construct_x_monotone_curve_2_object(); + Polycurve_conic_traits_2::Construct_curve_2 construct_polycurve = + traits.construct_curve_2_object(); //create a curve + Conic_curve_2 c3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(0), Algebraic(0)), + Conic_point_2(Algebraic(3), Algebraic(9))); + Conic_curve_2 c4(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(3), Algebraic(9)), + Conic_point_2(Algebraic(5), Algebraic(25))); + Conic_curve_2 c5(0,1,0,1,0,0, CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(-25), Algebraic(-5)), + Conic_point_2(Algebraic(0), Algebraic(0))); - Conic_curve_2 c3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(0), Algebraic(0) ), Conic_point_2( Algebraic(3), Algebraic(9) ) ); - Conic_curve_2 c4(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(3), Algebraic(9) ), Conic_point_2( Algebraic(5), Algebraic(25) ) ); - Conic_curve_2 c5(0,1,0,1,0,0, CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(-25), Algebraic(-5) ), Conic_point_2( Algebraic(0), Algebraic(0) ) ); + Conic_curve_2 c6(1,1,0,6,-26,162,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(-7), Algebraic(13)), + Conic_point_2(Algebraic(-3), Algebraic(9))); + Conic_curve_2 c7(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(-3), Algebraic(9)), + Conic_point_2(Algebraic(0), Algebraic(0))); + Conic_curve_2 c8(0,1,0,-1,0,0, CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(0), Algebraic(0)), + Conic_point_2(Algebraic(4), Algebraic(-2))); - - Conic_curve_2 c6(1,1,0,6,-26,162,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(-7), Algebraic(13) ), Conic_point_2( Algebraic(-3), Algebraic(9) ) ); - Conic_curve_2 c7(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(-3), Algebraic(9) ), Conic_point_2( Algebraic(0), Algebraic(0) ) ); - Conic_curve_2 c8(0,1,0,-1,0,0, CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(0), Algebraic(0) ), Conic_point_2( Algebraic(4), Algebraic(-2) ) ); - - Conic_curve_2 c9(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(-5), Algebraic(25) ), Conic_point_2( Algebraic(5), Algebraic(25) ) ); - Conic_curve_2 c10( 58, 72, -48, 0, 0, -360 ); + Conic_curve_2 c9(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(-5), Algebraic(25)), + Conic_point_2(Algebraic(5), Algebraic(25))); + Conic_curve_2 c10(58, 72, -48, 0, 0, -360); //This vector is used to store curves that will be used to create polycurve std::vector conic_curves; conic_curves.push_back(c9); //construct poly-curve - Polycurve_conic_traits_2::Curve_2 conic_polycurve = construct_polycurve( conic_curves.begin(), conic_curves.end() ); + Polycurve_conic_traits_2::Curve_2 conic_polycurve = + construct_polycurve(conic_curves.begin(), conic_curves.end()); - Conic_curve_2 c11( 0,1,0,-1,0,0,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(25), Algebraic(-5) ), Conic_point_2( Algebraic(0), Algebraic(0) ) ); - Conic_curve_2 c12( 1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(0), Algebraic(0) ), Conic_point_2( Algebraic(5), Algebraic(25) ) ); + Conic_curve_2 c11(0,1,0,-1,0,0,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(25), Algebraic(-5)), + Conic_point_2(Algebraic(0), Algebraic(0))); + Conic_curve_2 c12(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(0), Algebraic(0)), + Conic_point_2(Algebraic(5), Algebraic(25))); conic_curves.clear(); conic_curves.push_back(c11); conic_curves.push_back(c12); - + //construct poly-curve - Polycurve_conic_traits_2::Curve_2 conic_polycurve_2 = construct_polycurve( conic_curves.begin(), conic_curves.end() ); + Polycurve_conic_traits_2::Curve_2 conic_polycurve_2 = + construct_polycurve(conic_curves.begin(), conic_curves.end()); /* VERY IMPORTANT - For efficiency reasons, we recommend users not to construct x-monotone conic arc directly, - but rather use the Make_x_monotone_2 functor supplied by the conic-arc traits class to convert conic curves to x-monotone curves. - */ - Conic_x_monotone_curve_2 xc3 (c3); - Conic_x_monotone_curve_2 xc4 (c4); - Conic_x_monotone_curve_2 xc5 (c5); - Conic_x_monotone_curve_2 xc6 (c6); - Conic_x_monotone_curve_2 xc7 (c7); - Conic_x_monotone_curve_2 xc8 (c8); - + * For efficiency reasons, we recommend users not to construct + * x-monotone conic arc directly, but rather use the Make_x_monotone_2 + * functor supplied by the conic-arc traits class to convert conic curves + * to x-monotone curves. + */ + Conic_x_monotone_curve_2 xc3(c3); + Conic_x_monotone_curve_2 xc4(c4); + Conic_x_monotone_curve_2 xc5(c5); + Conic_x_monotone_curve_2 xc6(c6); + Conic_x_monotone_curve_2 xc7(c7); + Conic_x_monotone_curve_2 xc8(c8); - //This vector is used to store curves that will be used to create X-monotone-polycurve + + //This vector is used to store curves that will be used to create + //X-monotone-polycurve std::vector xmono_conic_curves_2; xmono_conic_curves_2.push_back(xc5); xmono_conic_curves_2.push_back(xc3); xmono_conic_curves_2.push_back(xc4); - + //construct x-monotone poly-curve - Pc_x_monotone_curve_2 conic_x_mono_polycurve_1 = construct_x_mono_polycurve(xmono_conic_curves_2.begin(), xmono_conic_curves_2.end()); + Pc_x_monotone_curve_2 conic_x_mono_polycurve_1 = + construct_x_mono_polycurve(xmono_conic_curves_2.begin(), + xmono_conic_curves_2.end()); xmono_conic_curves_2.clear(); xmono_conic_curves_2.push_back(xc6); xmono_conic_curves_2.push_back(xc7); xmono_conic_curves_2.push_back(xc8); //construct x-monotone poly-curve - Pc_x_monotone_curve_2 conic_x_mono_polycurve_2 = construct_x_mono_polycurve(xmono_conic_curves_2.begin(), xmono_conic_curves_2.end()); + Pc_x_monotone_curve_2 conic_x_mono_polycurve_2 = + construct_x_mono_polycurve(xmono_conic_curves_2.begin(), + xmono_conic_curves_2.end()); xmono_conic_curves_2.clear(); xmono_conic_curves_2.push_back(xc5); - Pc_x_monotone_curve_2 x_polycurve_push = construct_x_mono_polycurve(xmono_conic_curves_2.begin(), xmono_conic_curves_2.end()); - Polycurve_conic_traits_2::X_monotone_segment_2 xcurve_push = Polycurve_conic_traits_2::X_monotone_segment_2(c5);//traits.construct_x_monotone_curve_2_object()(c5); + Pc_x_monotone_curve_2 x_polycurve_push = + construct_x_mono_polycurve(xmono_conic_curves_2.begin(), + xmono_conic_curves_2.end()); + Polycurve_conic_traits_2::X_monotone_subcurve_2 xcurve_push = + Polycurve_conic_traits_2::X_monotone_subcurve_2(c5); + //traits.construct_x_monotone_curve_2_object()(c5); xmono_conic_curves_2.clear(); xmono_conic_curves_2.push_back(xc3); xmono_conic_curves_2.push_back(xc4); - Pc_x_monotone_curve_2 base_curve = construct_x_mono_polycurve(xmono_conic_curves_2.begin(), xmono_conic_curves_2.end()); + Pc_x_monotone_curve_2 base_curve = + construct_x_mono_polycurve(xmono_conic_curves_2.begin(), + xmono_conic_curves_2.end()); //curves for push_back - Conic_curve_2 c13(1,1,0,-50,12,660,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(25), Algebraic(-7) ), Conic_point_2( Algebraic(25), Algebraic(-5) ) ); - Conic_curve_2 c14(0,1,0,-1,0,0,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(25), Algebraic(-5) ), Conic_point_2( Algebraic(0), Algebraic(0) ) ); - Conic_curve_2 c15(-1,0,0,0,1,0,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(0), Algebraic(0) ), Conic_point_2( Algebraic(5), Algebraic(25) ) ); + Conic_curve_2 c13(1,1,0,-50,12,660,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(25), Algebraic(-7)), + Conic_point_2(Algebraic(25), Algebraic(-5))); + Conic_curve_2 c14(0,1,0,-1,0,0,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(25), Algebraic(-5)), + Conic_point_2(Algebraic(0), Algebraic(0))); + Conic_curve_2 c15(-1,0,0,0,1,0,CGAL::COUNTERCLOCKWISE, + Conic_point_2(Algebraic(0), Algebraic(0)), + Conic_point_2(Algebraic(5), Algebraic(25))); conic_curves.clear(); conic_curves.push_back(c13); conic_curves.push_back(c14); - Polycurve_conic_traits_2::Curve_2 base_curve_push_back = construct_polycurve( conic_curves.begin(), conic_curves.end() ); + Polycurve_conic_traits_2::Curve_2 base_curve_push_back = + construct_polycurve(conic_curves.begin(), conic_curves.end()); conic_curves.push_back(c15); - Polycurve_conic_traits_2::Curve_2 Expected_push_back_result = construct_polycurve( conic_curves.begin(), conic_curves.end() ); - + Polycurve_conic_traits_2::Curve_2 Expected_push_back_result = + construct_polycurve(conic_curves.begin(), conic_curves.end()); // //checking the orientattion consistency - // Conic_curve_2 c21(0,1,0,1,0,0,CGAL::CLOCKWISE, Conic_point_2( Algebraic(9), Algebraic(-3) ), Conic_point_2( Algebraic(0), Algebraic(0) ) ); - // Conic_curve_2 c20(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(0), Algebraic(0) ), Conic_point_2( Algebraic(3), Algebraic(9) ) ); - // Conic_x_monotone_curve_2 xc20 (c20); - // Conic_x_monotone_curve_2 xc21 (c21); + // Conic_curve_2 c21(0,1,0,1,0,0,CGAL::CLOCKWISE, + // Conic_point_2(Algebraic(9), Algebraic(-3)), + // Conic_point_2(Algebraic(0), Algebraic(0))); + // Conic_curve_2 c20(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, + // Conic_point_2(Algebraic(0), Algebraic(0)), + // Conic_point_2(Algebraic(3), Algebraic(9))); + // Conic_x_monotone_curve_2 xc20(c20); + // Conic_x_monotone_curve_2 xc21(c21); // xmono_conic_curves_2.clear(); // xmono_conic_curves_2.push_back(xc20); // xmono_conic_curves_2.push_back(xc21); - // Pc_x_monotone_curve_2 eric_polycurve = construct_x_mono_polycurve(xmono_conic_curves_2.begin(), xmono_conic_curves_2.end()); - // std::cout << "the polycurve is: " << eric_polycurve << std::endl; - - - - + // Pc_x_monotone_curve_2 eric_polycurve = + // construct_x_mono_polycurve(xmono_conic_curves_2.begin(), + // xmono_conic_curves_2.end()); + // std::cout << "the polycurve is: " << eric_polycurve << std::endl; // std::cout<< std::endl; - //check_compare_x_2(xc3, xc5); + //check_compare_x_2(xc3, xc5); // check_equal(); // std::cout<< std::endl; - - //check_intersect( conic_x_mono_polycurve_1, conic_x_mono_polycurve_2 ); + + //check_intersect(conic_x_mono_polycurve_1, conic_x_mono_polycurve_2); //std::cout<< std::endl; - + // check_compare_end_points_xy_2(); // std::cout<< std::endl; - //check_split( conic_x_mono_polycurve_1, conic_x_mono_polycurve_2 ); + //check_split(conic_x_mono_polycurve_1, conic_x_mono_polycurve_2); // std::cout<< std::endl; - //check_make_x_monotne_curve( conic_polycurve_2 ); + //check_make_x_monotne_curve(conic_polycurve_2); //std::cout<< std::endl; // check_is_vertical(); // std::cout<< std::endl; - //check_compare_y_at_x_2(); - //std::cout<< std::endl; + //check_compare_y_at_x_2(); + //std::cout<< std::endl; - //adds the segment to the right. - //check_push_back(base_curve_push_back, c15); - //std::cout<< std::endl; + //adds the segment to the right. + //check_push_back(base_curve_push_back, c15); + //std::cout<< std::endl; - - //adds the segment to the left. - //check_push_front(base_curve, xcurve_push); - //std::cout<< std::endl; + //adds the segment to the left. + //check_push_front(base_curve, xcurve_push); + //std::cout<< std::endl; // check_are_mergable(); // std::cout<< std::endl; @@ -823,29 +919,31 @@ int main (int argc, char* argv[]) // check_compare_y_at_x_left(); // std::cout<< std::endl; - //check_compare_points(conic_x_mono_polycurve_1); + //check_compare_points(conic_x_mono_polycurve_1); - //number of segments - //std::cout<< "Number of segments: " << traits.number_of_points_2_object()(base_curve_push_back) << std::endl; + //number of segments + //std::cout << "Number of segments: " + // << traits.number_of_points_2_object()(base_curve_push_back) + // << std::endl; - check_trim(conic_x_mono_polycurve_1, atoi(argv[1]), atoi(argv[2]), atoi(argv[3]), atoi(argv[4])); - std::cout<< std::endl; + check_trim(conic_x_mono_polycurve_1, atoi(argv[1]), atoi(argv[2]), + atoi(argv[3]), atoi(argv[4])); + std::cout << std::endl; - //std::cout << (atoi(argv[1]) + atoi(argv[2])) << std::endl; - // Conic_traits_2 con_traits; - // Conic_curve_2 cc3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, Conic_point_2( Algebraic(0), Algebraic(0) ), Conic_point_2( Algebraic(3), Algebraic(9) ) ); - // Conic_x_monotone_curve_2 xcc3 (cc3); - // Conic_point_2 ps2 (0, 0); - // Conic_point_2 pt2 (3, 9); - // std::cout << "conic curve is : " << xcc3 << std::endl; - // Conic_x_monotone_curve_2 trimmed_curve = con_traits.trim_2_object()(xc3, ps2, pt2); - // std::cout << "trimmed conic curve is : " << trimmed_curve << std::endl; - - // if(Has_construct_x_monotone_curve_from_two_points_category()) - // std::cout << "It has a line segment constructor. " << std::endl; - + //std::cout << (atoi(argv[1]) + atoi(argv[2])) << std::endl; + // Conic_traits_2 con_traits; + // Conic_curve_2 cc3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE, + // Conic_point_2(Algebraic(0), Algebraic(0)), + // Conic_point_2(Algebraic(3), Algebraic(9))); + // Conic_x_monotone_curve_2 xcc3(cc3); + // Conic_point_2 ps2(0, 0); + // Conic_point_2 pt2(3, 9); + // std::cout << "conic curve is : " << xcc3 << std::endl; + // Conic_x_monotone_curve_2 trimmed_curve = + // con_traits.trim_2_object()(xc3, ps2, pt2); + // std::cout << "trimmed conic curve is : " << trimmed_curve << std::endl; return 0; } -#endif \ No newline at end of file +#endif diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_geom_traits.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_geom_traits.h index c737ce59b7a..82cf62db149 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_geom_traits.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_geom_traits.h @@ -99,19 +99,19 @@ typedef CGAL::Arr_non_caching_segment_traits_2 Base_geom_traits; #elif TEST_GEOM_TRAITS == POLYLINE_GEOM_TRAITS typedef CGAL::Arr_segment_traits_2 Segment_traits; typedef CGAL::Arr_polyline_traits_2 Base_geom_traits; -// Poly curves needs some testing where Segments and X-monotone segments are required -// instead of polycurves/x-monotone polycurves. -typedef Base_geom_traits::Segment_2 Segment_2; -typedef Base_geom_traits::X_monotone_segment_2 X_monotone_segment_2; +// Poly curves needs some testing where Segments and X-monotone segments are +// required instead of polycurves/x-monotone polycurves. +typedef Base_geom_traits::Segment_2 Segment_2; +typedef Base_geom_traits::X_monotone_subcurve_2 X_monotone_subcurve_2; #define GEOM_TRAITS_TYPE "Polylines" #elif TEST_GEOM_TRAITS == NON_CACHING_POLYLINE_GEOM_TRAITS typedef CGAL::Arr_non_caching_segment_traits_2 Segment_traits; typedef CGAL::Arr_polyline_traits_2 Base_geom_traits; -// Poly curves needs some testing where Segments and X-monotone segments are required -// instead of polycurves/x-monotone polycurves. -typedef Base_geom_traits::Segment_2 Segment_2; -typedef Base_geom_traits::X_monotone_segment_2 X_monotone_segment_2; +// Poly curves needs some testing where Segments and X-monotone segments are +// required instead of polycurves/x-monotone polycurves. +typedef Base_geom_traits::Segment_2 Segment_2; +typedef Base_geom_traits::X_monotone_subcurve_2 X_monotone_subcurve_2; #define GEOM_TRAITS_TYPE "Non Caching Polylines" #elif TEST_GEOM_TRAITS == CORE_CONIC_GEOM_TRAITS @@ -132,138 +132,147 @@ typedef CGAL::Arr_linear_traits_2 Base_geom_traits; #define GEOM_TRAITS_TYPE "Linear Lines" #elif TEST_GEOM_TRAITS == LINE_ARC_GEOM_TRAITS -typedef Kernel Linear_kernel; -typedef CGAL::Algebraic_kernel_for_circles_2_2 Algebraic_kernel; +typedef Kernel Linear_kernel; +typedef CGAL::Algebraic_kernel_for_circles_2_2 + Algebraic_kernel; typedef CGAL::Circular_kernel_2 - Circular_kernel; -typedef Circular_kernel::Line_arc_2 Line_arc_2; -typedef CGAL::Arr_line_arc_traits_2 Base_geom_traits; + Circular_kernel; +typedef Circular_kernel::Line_arc_2 Line_arc_2; +typedef CGAL::Arr_line_arc_traits_2 Base_geom_traits; #define GEOM_TRAITS_TYPE "Line Arc" #elif TEST_GEOM_TRAITS == CIRCULAR_ARC_GEOM_TRAITS -typedef Kernel Linear_kernel; -typedef CGAL::Algebraic_kernel_for_circles_2_2 Algebraic_kernel; +typedef Kernel Linear_kernel; +typedef CGAL::Algebraic_kernel_for_circles_2_2 + Algebraic_kernel; typedef CGAL::Circular_kernel_2 - Circular_kernel; -typedef CGAL::Arr_circular_arc_traits_2 Base_geom_traits; + Circular_kernel; +typedef CGAL::Arr_circular_arc_traits_2 + Base_geom_traits; #define GEOM_TRAITS_TYPE "Circular Arc" #elif TEST_GEOM_TRAITS == CIRCULAR_LINE_ARC_GEOM_TRAITS -typedef Kernel Linear_kernel; -typedef CGAL::Algebraic_kernel_for_circles_2_2 Algebraic_kernel; +typedef Kernel Linear_kernel; +typedef CGAL::Algebraic_kernel_for_circles_2_2 + Algebraic_kernel; typedef CGAL::Circular_kernel_2 - Circular_kernel; -typedef Circular_kernel::Circular_arc_2 Circular_arc_2; -typedef Circular_kernel::Line_arc_2 Line_arc_2; -typedef CGAL::Arr_circular_line_arc_traits_2 Base_geom_traits; + Circular_kernel; +typedef Circular_kernel::Circular_arc_2 Circular_arc_2; +typedef Circular_kernel::Line_arc_2 Line_arc_2; +typedef CGAL::Arr_circular_line_arc_traits_2 + Base_geom_traits; #define GEOM_TRAITS_TYPE "Circular Line Arc" #elif TEST_GEOM_TRAITS == CIRCLE_SEGMENT_GEOM_TRAITS -typedef CGAL::Cartesian Rat_kernel; -typedef CGAL::Arr_circle_segment_traits_2 Base_geom_traits; -typedef Rat_kernel::FT Rat_nt; -typedef Rat_kernel::Circle_2 Circle_2; -typedef Rat_kernel::Line_2 Line_2; -typedef Rat_kernel::Segment_2 Segment_2; -typedef Rat_kernel::Point_2 Rat_point_2; +typedef CGAL::Cartesian Rat_kernel; +typedef CGAL::Arr_circle_segment_traits_2 Base_geom_traits; +typedef Rat_kernel::FT Rat_nt; +typedef Rat_kernel::Circle_2 Circle_2; +typedef Rat_kernel::Line_2 Line_2; +typedef Rat_kernel::Segment_2 Segment_2; +typedef Rat_kernel::Point_2 Rat_point_2; #define GEOM_TRAITS_TYPE "Circle Segments" #elif TEST_GEOM_TRAITS == BEZIER_GEOM_TRAITS -typedef CGAL::CORE_algebraic_number_traits Nt_traits; -typedef Nt_traits::Rational Rational; -typedef Nt_traits::Algebraic Algebraic; -typedef CGAL::Cartesian Rat_kernel; -typedef CGAL::Cartesian Alg_kernel; +typedef CGAL::CORE_algebraic_number_traits Nt_traits; +typedef Nt_traits::Rational Rational; +typedef Nt_traits::Algebraic Algebraic; +typedef CGAL::Cartesian Rat_kernel; +typedef CGAL::Cartesian Alg_kernel; typedef CGAL::Arr_Bezier_curve_traits_2 - Base_geom_traits; -typedef Base_geom_traits::Bezier_cache Bezier_cache; + Base_geom_traits; +typedef Base_geom_traits::Bezier_cache Bezier_cache; #define GEOM_TRAITS_TYPE "Bezier" #elif TEST_GEOM_TRAITS == GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS -typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Base_geom_traits; +typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 + Base_geom_traits; #define GEOM_TRAITS_TYPE "Geodesic Arc on Sphere" #elif TEST_GEOM_TRAITS == RATIONAL_ARC_GEOM_TRAITS // TODO: This is for old Ron's traits---remove. -//typedef CGAL::CORE_algebraic_number_traits Nt_traits; //OS - new +//typedef CGAL::CORE_algebraic_number_traits Nt_traits; //OS - new //typedef Nt_traits::Rational Rational; //typedef Nt_traits::Algebraic Algebraic; //typedef CGAL::Arr_rational_arc_traits_2 Base_geom_traits; -//typedef Base_geom_traits::Rat_vector Rat_vector; +//typedef Base_geom_traits::Rat_vector Rat_vector; //#define GEOM_TRAITS_TYPE "Rational Arc" -typedef CGAL::Arr_rational_function_traits_2 Base_geom_traits; -typedef Base_geom_traits::Rational Rational; -typedef Base_geom_traits::Algebraic_real_1 Algebraic_real_1; -typedef Base_geom_traits::Rat_vector Rat_vector; +typedef CGAL::Arr_rational_function_traits_2 Base_geom_traits; +typedef Base_geom_traits::Rational Rational; +typedef Base_geom_traits::Algebraic_real_1 Algebraic_real_1; +typedef Base_geom_traits::Rat_vector Rat_vector; #define GEOM_TRAITS_TYPE "Rational Arc" - #elif TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS -typedef CGAL::Arr_algebraic_segment_traits_2 Base_geom_traits; +typedef CGAL::Arr_algebraic_segment_traits_2 + Base_geom_traits; #define GEOM_TRAITS_TYPE "Algebraic" #elif TEST_GEOM_TRAITS == POLYCURVE_CONIC_GEOM_TRAITS -typedef CGAL::CORE_algebraic_number_traits Nt_traits; -typedef Nt_traits::Rational Rational; -typedef Nt_traits::Algebraic Algebraic; -typedef CGAL::Cartesian Rat_kernel; -typedef CGAL::Cartesian Alg_kernel; -typedef CGAL::Arr_conic_traits_2 Conic_traits_2; -typedef CGAL::Arr_polycurve_traits_2 Base_geom_traits; +typedef CGAL::CORE_algebraic_number_traits Nt_traits; +typedef Nt_traits::Rational Rational; +typedef Nt_traits::Algebraic Algebraic; +typedef CGAL::Cartesian Rat_kernel; +typedef CGAL::Cartesian Alg_kernel; +typedef CGAL::Arr_conic_traits_2 + Conic_traits_2; +typedef CGAL::Arr_polycurve_traits_2 Base_geom_traits; //needed when we want to construct ellips, parabola and hyperbolas -typedef Conic_traits_2::Rat_point_2 Rat_point; -typedef Conic_traits_2::Rat_circle_2 Rat_circle; -typedef Conic_traits_2::Rat_segment_2 Rat_segment; +typedef Conic_traits_2::Rat_point_2 Rat_point; +typedef Conic_traits_2::Rat_circle_2 Rat_circle; +typedef Conic_traits_2::Rat_segment_2 Rat_segment; -// Poly curves needs some testing where Segments and X-monotone segments are required -// instead of polycurves/x-monotone polycurves. -typedef Base_geom_traits::Segment_2 Segment_2; -typedef Base_geom_traits::X_monotone_segment_2 X_monotone_segment_2; +// Poly curves needs some testing where Segments and X-monotone segments are +// required instead of polycurves/x-monotone polycurves. +typedef Base_geom_traits::Segment_2 Segment_2; +typedef Base_geom_traits::X_monotone_subcurve_2 X_monotone_subcurve_2; #define GEOM_TRAITS_TYPE "Polycurves_conics" #elif TEST_GEOM_TRAITS == POLYCURVE_CIRCULAR_ARC_GEOM_TRAITS -typedef CGAL::Cartesian Rat_kernel; -typedef CGAL::Arr_circle_segment_traits_2 Circle_segment_traits_2; -typedef CGAL::Arr_polycurve_traits_2 Base_geom_traits; +typedef CGAL::Cartesian Rat_kernel; +typedef CGAL::Arr_circle_segment_traits_2 Circle_segment_traits_2; +typedef CGAL::Arr_polycurve_traits_2 + Base_geom_traits; -typedef Rat_kernel::FT Rat_nt; -typedef Rat_kernel::Circle_2 Circle_2; -typedef Rat_kernel::Line_2 Line_2; -typedef Rat_kernel::Point_2 Rat_point_2; -typedef Circle_segment_traits_2::Point_2 Point_2; +typedef Rat_kernel::FT Rat_nt; +typedef Rat_kernel::Circle_2 Circle_2; +typedef Rat_kernel::Line_2 Line_2; +typedef Rat_kernel::Point_2 Rat_point_2; +typedef Circle_segment_traits_2::Point_2 Point_2; // Poly curves needs some testing where Segments and X-monotone segments are required // instead of polycurves/x-monotone polycurves. -typedef Base_geom_traits::Segment_2 Segment_2; -typedef Base_geom_traits::X_monotone_segment_2 X_monotone_segment_2; +typedef Base_geom_traits::Segment_2 Segment_2; +typedef Base_geom_traits::X_monotone_subcurve_2 X_monotone_subcurve_2; #define GEOM_TRAITS_TYPE "Polycurves_circular_arcs" #elif TEST_GEOM_TRAITS == POLYCURVE_BEZIER_GEOM_TRAITS -typedef CGAL::CORE_algebraic_number_traits Nt_traits; -typedef Nt_traits::Rational Rational; -typedef Nt_traits::Algebraic Algebraic; -typedef CGAL::Cartesian Rat_kernel; -typedef CGAL::Cartesian Alg_kernel; -typedef CGAL::Arr_Bezier_curve_traits_2 Bezier_tratis; -typedef Bezier_tratis::Bezier_cache Bezier_cache; -typedef Rat_kernel::Point_2 Control_point_2; -typedef Bezier_tratis::Point_2 Point_2; +typedef CGAL::CORE_algebraic_number_traits Nt_traits; +typedef Nt_traits::Rational Rational; +typedef Nt_traits::Algebraic Algebraic; +typedef CGAL::Cartesian Rat_kernel; +typedef CGAL::Cartesian Alg_kernel; +typedef CGAL::Arr_Bezier_curve_traits_2 + Bezier_tratis; +typedef Bezier_tratis::Bezier_cache Bezier_cache; +typedef Rat_kernel::Point_2 Control_point_2; +typedef Bezier_tratis::Point_2 Point_2; -typedef CGAL::Arr_polycurve_traits_2 Base_geom_traits; -// Poly curves needs some testing where Segments and X-monotone segments are required -// instead of polycurves/x-monotone polycurves. -typedef Base_geom_traits::Segment_2 Segment_2; -typedef Base_geom_traits::X_monotone_segment_2 X_monotone_segment_2; +typedef CGAL::Arr_polycurve_traits_2 Base_geom_traits; +// Poly curves needs some testing where Segments and X-monotone segments are +// required instead of polycurves/x-monotone polycurves. +typedef Base_geom_traits::Segment_2 Segment_2; +typedef Base_geom_traits::X_monotone_subcurve_2 X_monotone_subcurve_2; #define GEOM_TRAITS_TYPE "polycurve_bezier" @@ -272,8 +281,8 @@ typedef Base_geom_traits::X_monotone_segment_2 X_monotone_segment_2 #error No geometry traits (GEOM_TRAITS) specified! #endif -typedef Base_geom_traits::Point_2 Base_point_2; -typedef Base_geom_traits::Curve_2 Base_curve_2; -typedef Base_geom_traits::X_monotone_curve_2 Base_x_monotone_curve_2; +typedef Base_geom_traits::Point_2 Base_point_2; +typedef Base_geom_traits::Curve_2 Base_curve_2; +typedef Base_geom_traits::X_monotone_curve_2 Base_x_monotone_curve_2; #endif