From 52c6d3044d98daf080ba4beb7e3847c1ef16baf6 Mon Sep 17 00:00:00 2001 From: Waqar Khan Date: Sat, 24 May 2014 21:55:36 +0200 Subject: [PATCH] * Permissios of the files changed * Trim functionality added to conic and circular_arc traits. * Examples for conic_polycurve and circular_arc_polycurve added. --- .../Arrangement_on_surface_2/polycurve.cpp | 0 .../polycurve_circular_arc.cpp | 13 ++- .../polycurve_conic.cpp | 0 .../CGAL/Arr_circle_segment_traits_2.h | 33 +++++++ .../include/CGAL/Arr_conic_traits_2.h | 33 ++++++- .../Arr_geometry_traits/Circle_segment_2.h | 98 ++++++++++--------- .../include/CGAL/Arr_polyline_traits_2.h | 51 +++++++++- .../include/CGAL/Arr_segment_traits_2.h | 4 + .../Arrangement_on_surface_2/IO_base_test.h | 0 .../test/Arrangement_on_surface_2/IO_test.h | 0 .../Traits_base_test.h | 0 .../Arrangement_on_surface_2/Traits_test.h | 4 +- .../Arrangement_on_surface_2/cgal_test_base | 30 +++--- .../data/polycurves_conics/intersect | 3 +- .../test_arc_polycurve.cpp | 0 .../test_circular_arc_polycurve.cpp | 30 +++++- .../test_configuration.h | 0 .../test_conic_polycurve.cpp | 36 ++++++- .../test_geom_traits.h | 0 .../Arrangement_on_surface_2/test_traits.cpp | 0 20 files changed, 254 insertions(+), 81 deletions(-) mode change 100755 => 100644 Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve.cpp mode change 100755 => 100644 Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp mode change 100755 => 100644 Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_conic.cpp mode change 100755 => 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h mode change 100755 => 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_test.h mode change 100755 => 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h mode change 100755 => 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h mode change 100755 => 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_arc_polycurve.cpp mode change 100755 => 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_circular_arc_polycurve.cpp mode change 100755 => 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_configuration.h mode change 100755 => 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_conic_polycurve.cpp mode change 100755 => 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_geom_traits.h mode change 100755 => 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits.cpp diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve.cpp old mode 100755 new mode 100644 diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp old mode 100755 new mode 100644 index 694483166db..34081b52db7 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_circular_arc.cpp @@ -136,14 +136,13 @@ int main () std::cout << "Opposite of X-monotone Polycurve 1: " << opposite_x_monotone_polycurve_1 << std::endl; //Waqar: fix this once the intersect functor for circular arc polycurve is fixed. - - // Polycurve_circ_arc_arrangment polycurve_arrangment(&traits); - // insert(polycurve_arrangment, polycurve_1); - // insert(polycurve_arrangment, polycurve_2); - // insert(polycurve_arrangment, x_polycurve_1); - // insert(polycurve_arrangment, x_polycurve_2); + Polycurve_circ_arc_arrangment polycurve_arrangment(&traits); + insert(polycurve_arrangment, polycurve_1); + //insert(polycurve_arrangment, polycurve_2); + //insert(polycurve_arrangment, x_polycurve_1); + //insert(polycurve_arrangment, x_polycurve_2); // std::cout << "Arrangment Statistics: " << std::endl; - // print_arrangement (polycurve_arrangment); + print_arrangement (polycurve_arrangment); return 0; diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_conic.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_conic.cpp old mode 100755 new mode 100644 diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h index 74b93713ae2..823f4de898c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h @@ -32,6 +32,7 @@ #include + namespace CGAL { /*! \class @@ -58,6 +59,8 @@ public: typedef Tag_true Has_left_category; typedef Tag_true Has_merge_category; typedef Tag_false Has_do_intersect_category; + typedef Tag_false Has_construct_x_monotone_curve_from_two_points_category; + //typedef boost::false_type Has_construct_x_monotone_curve_from_two_points_category; typedef Arr_oblivious_side_tag Left_side_category; typedef Arr_oblivious_side_tag Bottom_side_category; @@ -695,6 +698,36 @@ public: return Construct_opposite_2(); } + class Trim_2 + { + /*!\brief + * Returns a trimmed version of an arc + * + * \param cv The arc + * \param p the new first endpoint + * \param q the new second endpoint + * \return The trimmed arc + * + * \pre p != q + * \pre both points must be interior and must lie on \c cv + */ + public: + + X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv, + const Point_2& src, + const Point_2 tgt)const + { + return (xcv.trim(src, tgt)); + } + + }; + + //get a Trim_2 functor object + Trim_2 trim_2_object() const + { + return Trim_2(); + } + }; } //namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h index ca8ac4278fb..18bc04cfdb2 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h @@ -73,6 +73,8 @@ public: typedef Tag_true Has_left_category; typedef Tag_true Has_merge_category; typedef Tag_false Has_do_intersect_category; + //typedef boost::true_type Has_line_segment_constructor; + typedef Tag_true Has_construct_x_monotone_curve_from_two_points_category; typedef Arr_oblivious_side_tag Left_side_category; typedef Arr_oblivious_side_tag Bottom_side_category; @@ -814,9 +816,38 @@ public: { return Construct_opposite_2(); } + + class Trim_2 + { + /*!\brief + * Returns a trimmed version of an arc + * + * \param cv The arc + * \param p the new first endpoint + * \param q the new second endpoint + * \return The trimmed arc + * + * \pre p != q + * \pre both points must be interior and must lie on \c cv + */ + public: + + X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv, + const Point_2& src, + const Point_2 tgt)const + { + return (xcv.trim(src, tgt)); + } + + }; + + //get a Trim_2 functor object + Trim_2 trim_2_object() const + { + return Trim_2(); + } //@} }; } //namespace CGAL - #endif diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Circle_segment_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Circle_segment_2.h index 7fc88d90e12..0ecc98e9227 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Circle_segment_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Circle_segment_2.h @@ -796,7 +796,8 @@ public: _first(), _second(), _third(), - _source(), _target(), + _source(), + _target(), _info (0) {} @@ -869,50 +870,6 @@ public: _info = (_info | IS_DIRECTED_RIGHT_MASK); } - // waqar - // Adding an almost duplicate constructor as the original one is cause conflict when used with - // polycurve_circular_arcs - /*! - * Construct a segment arc from two kernel points - * \param source the source point. - * \ param target the target point. - * \pre source and target are not equal. - */ - //bad idea - // _X_monotone_circle_segment_2 (const Point_2& source, - // const Point_2& target) : - // _source(source.x(), source.y()), - // _target(target.x(), target.y()), - // _info (0) - // { - // //std:: cout << source.x(); - // typename Kernel::Point_2 kernel_source (source.x(), source.y()); - // typename Kernel::Point_2 kernel_target; //(target.x(), target.y()); - - // // Line_2 line(kernel_source, kernel_target); - // // _first = line.a(); - // // _second = line.b(); - // // _third = line.c(); - - // // // Check if the segment is directed left or right: - // // Comparison_result res = CGAL::compare (kernel_source.x(), kernel_target.x()); - - // // if (res == EQUAL) - // // { - // // CGAL_precondition (CGAL::sign(_second) == ZERO); - - // // // We have a vertical segment - compare the points by their - // // // y-coordinates: - // // _info = (_info | IS_VERTICAL_SEGMENT_MASK); - // // res = CGAL::compare (kernel_source.y(), kernel_target.y()); - // // } - - // // CGAL_precondition (res != EQUAL); - // // if (res == SMALLER) - // // _info = (_info | IS_DIRECTED_RIGHT_MASK); - // } - //end of duplicate contructor - /*! * Construct a circular arc. * \param line The supporting line. @@ -2478,6 +2435,57 @@ protected: ++oi; } + //waqar + /* + * check if the point lies on the circular arc. + * + * I could have skipped this function and used circ_point_position() instead + * but I think the implementation of that function is wrong as it is not squaring the radius + * in order to check whether the point satisfies the circle equation. + */ + Comparison_result contain_point(const Point_2& p) const + { + Comparison_result res = CGAL::compare (CGAL::square (p.x() - x0()), + CGAL::square(sqr_r()) - CGAL::square (p.y() - y0())); + return res; + } + /*! + * Trim the arc given its new endpoints. + * \param ps The new source point. + * \param pt The new target point. + * \return The new trimmed arc. + * \pre Both ps and pt lies on the arc and must conform with the current + * direction of the arc. + */ + Self trim (const Point_2& ps, + const Point_2& pt) const + { + Self arc = *this; + Kernel ker; + // Make sure that both ps and pt lie on the arc. + CGAL_precondition (this->contain_point (ps) == EQUAL); + CGAL_precondition (this->contain_point (pt) == EQUAL ); + + //make sure ps and pt are not the same + CGAL_precondition(CGAL::compare(ps.x(), pt.x()) != EQUAL && + CGAL::compare(ps.y(), pt.y()) != EQUAL); + + // Make sure that the endpoints conform with the direction of the arc. + Point_2 source = ps; + Point_2 target = pt; + if( this->is_directed_right() && (ps.x() > pt.x()) ) + { + //since the direction of the arc should not be changed. we will interchange the source and the target. + source = pt; + target = ps; + } + + arc._source = source; + arc._target = target; + + return (arc); + } + //@} }; 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 a55bd243382..ee43c84e869 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 @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -55,6 +56,8 @@ namespace CGAL { typedef typename Segment_traits_2::Top_side_category Top_side_category; typedef typename Segment_traits_2::Right_side_category Right_side_category; + typedef typename Segment_traits_2::Has_construct_x_monotone_curve_from_two_points_category Has_construct_x_monotone_curve_from_two_points_category; + typedef typename Arr_are_all_sides_oblivious_tag ::result @@ -1117,6 +1120,9 @@ namespace CGAL { /* Append a point `p` to an existing polyline `cv` at the back. */ void operator()(Curve_2& cv, const Point_2& p) const { + //waqar + //CGAL_static_assertion_msg((Has_construct_x_monotone_curve_from_two_points_category()), "X_monotone_curve_2 does not support construction from two points!"); + //typename boost::enable_if_c< Has_construct_x_monotone_curve_from_two_points_category::value >::type* = 0 typedef typename Curve_2::Segments_size_type size_type; size_type num_seg = cv.number_of_segments(); CGAL_precondition(num_seg > 0); @@ -1153,6 +1159,8 @@ namespace CGAL { /* Append a point `p` to an existing polyline `xcv` at the back. */ void operator()(X_monotone_curve_2& xcv, const Point_2& p) const { + //waqar + //CGAL_static_assertion_msg((Has_construct_x_monotone_curve_from_two_points_category()), "X_monotone_curve_2 does not support construction from two points!"); typedef typename X_monotone_curve_2::Segments_size_type size_type; size_type num_seg = xcv.number_of_segments(); CGAL_precondition(num_seg > 0); @@ -1269,6 +1277,9 @@ namespace CGAL { /* Append a point `p` to an existing polyline `cv` at the front. */ void operator()(Curve_2& cv, const Point_2& p) const { + //waqar + //CGAL_static_assertion_msg((Has_construct_x_monotone_curve_from_two_points_category()), "X_monotone_curve_2 does not support construction from two points!"); + CGAL_precondition_code ( typedef typename Curve_2::Segments_size_type size_type; @@ -1300,6 +1311,9 @@ namespace CGAL { /* Append a point `p` to an existing polyline `xcv` at the front. */ void operator()(const X_monotone_curve_2& xcv, Point_2& p) const { + //waqar + //CGAL_static_assertion_msg((Has_construct_x_monotone_curve_from_two_points_category()), "X_monotone_curve_2 does not support construction from two points!"); + const Segment_traits_2* seg_traits = m_poly_traits.segment_traits_2(); CGAL_precondition_code ( @@ -1545,10 +1559,16 @@ namespace CGAL { * \return The past-the-end iterator. */ template - OutputIterator operator()(const X_monotone_curve_2& cv1, - const X_monotone_curve_2& cv2, - OutputIterator oi) const + OutputIterator + //waqar + //typename boost::enable_if_c::type + operator()(const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2, + OutputIterator oi) const + //typename boost::enable_if_c< Has_line_segment_constructor::value >::type* = 0) const { + //waqar + //CGAL_static_assertion_msg((Has_line_segment_constructor::value), "X_monotone_curve_2 does not support construction from Line_segment!"); const Segment_traits_2* seg_traits = m_poly_traits.segment_traits_2(); Compare_y_at_x_2 cmp_y_at_x = m_poly_traits.compare_y_at_x_2_object(); typename Segment_traits_2::Equal_2 equal = seg_traits->equal_2_object(); @@ -1794,7 +1814,8 @@ namespace CGAL { *oi++ = make_object(ip); } } - return oi; + + return oi; } }; @@ -2804,6 +2825,28 @@ namespace CGAL { return from; } + class Trim_2 + { + /*!\brief + * add comments + */ + public: + + X_monotone_curve_2 operator()(const X_monotone_curve_2& xcv, + const Point_2& src, + const Point_2 tgt)const + { + return (xcv); + } + + }; + + //get a Trim_2 functor object + Trim_2 trim_2_object() const + { + return Trim_2(); + } + // A utility class that compare a curve-end with a point. template class Compare_points { diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h index acfd210d79e..ecdf3651543 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h @@ -33,6 +33,8 @@ #include #include + + namespace CGAL { template @@ -65,6 +67,7 @@ public: typedef Tag_true Has_left_category; typedef Tag_true Has_merge_category; typedef Tag_false Has_do_intersect_category; + typedef Tag_true Has_construct_x_monotone_curve_from_two_points_category; typedef Arr_oblivious_side_tag Left_side_category; typedef Arr_oblivious_side_tag Bottom_side_category; @@ -1183,4 +1186,5 @@ InputStream& operator>> (InputStream& is, Arr_segment_2& seg) } //namespace CGAL + #endif 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 old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 index d3b0f224cea..39fdb99a51d --- 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 @@ -910,7 +910,7 @@ bool Traits_test:: intersect_wrapper(std::istringstream& str_stream) { //I am disabling this test only for polycurve_circular_arc tarits until it is resolved - #if TEST_GEOM_TRAITS != POLYCURVE_CIRCULAR_ARC_GEOM_TRAITS + //#if TEST_GEOM_TRAITS != POLYCURVE_CIRCULAR_ARC_GEOM_TRAITS typedef Geom_traits_T Traits; typedef typename Traits::Point_2 Point_2; @@ -965,7 +965,7 @@ intersect_wrapper(std::istringstream& str_stream) object_vec.clear(); - #endif + //#endif return true; } diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base index 6dcdef110f9..22a4bdd1261 100755 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base @@ -1142,21 +1142,21 @@ test_polycurve_circular_arc_traits() execute_commands_new_structure Polycurves_circular_arcs polycurve_circular_arc_traits \ COMPARE_Y_AT_X \ EQUAL \ - # IS_VERTICAL \ - # SPLIT \ - # ARE_MERGEABLE \ - # COMPARE_Y_AT_X_LEFT \ - # COMPARE_Y_AT_X_RIGHT \ - # MAKE_X_MONOTONE \ - # PUSH_BACK \ - # PUSH_FRONT \ - # COMPARE_X_POLYCURVE \ - # COMPARE_XY_POLYCURVE \ - # NUMBER_OF_POINTS \ - # VERTEX \ - # CONSTRUCT_OPPOSITE \ - # MERGE \ - # COMPARE_ENDPOINTS_XY + IS_VERTICAL \ + SPLIT \ + ARE_MERGEABLE \ + COMPARE_Y_AT_X_LEFT \ + COMPARE_Y_AT_X_RIGHT \ + MAKE_X_MONOTONE \ + PUSH_BACK \ + PUSH_FRONT \ + COMPARE_X_POLYCURVE \ + COMPARE_XY_POLYCURVE \ + NUMBER_OF_POINTS \ + VERTEX \ + CONSTRUCT_OPPOSITE \ + MERGE \ + COMPARE_ENDPOINTS_XY #INTERSECT else diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polycurves_conics/intersect b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polycurves_conics/intersect index 5d144a62f33..dfd331ce790 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polycurves_conics/intersect +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polycurves_conics/intersect @@ -1,6 +1,7 @@ ## -*- comment-start: "#"; -*- # Format -# +# +# # # Intersection type: 0 if intersection is just a point, 1 if a curve is overlapping # 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 old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 index 7d422affa64..7c06f1b6d2f --- 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 @@ -40,6 +40,8 @@ typedef Polycurve_arc_traits_2::X_monotone_curve_2 X_mono 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; + template bool check_compare_y_at_x_2(Curve& cv) @@ -144,10 +146,10 @@ int main () 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) ); - 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() ); + //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() ); //std::cout<< "x_polycurve_3: " << x_polycurve_3 << std::endl; @@ -180,7 +182,25 @@ int main () // check_compare_y_at_x_2(x_polycurve_1); // check_intersect(x_polycurve_1, x_polycurve_2); - check_make_x_monotone(curve_1); + //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)); + //traits.push_back_2_object()(x_polycurve_1, push_back_point); + + + 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; return 0; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_configuration.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_configuration.h old mode 100755 new mode 100644 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 old mode 100755 new mode 100644 index 6e2fc977dda..08e554aad13 --- 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 @@ -21,6 +21,9 @@ int main () #include #include #include +#include +#include +#include //#include @@ -44,6 +47,8 @@ typedef CGAL::Arr_polyline_traits_2 Polycu 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::Arr_polyline_traits_2< // CGAL::Arr_conic_traits_2, @@ -641,6 +646,11 @@ void check_compare_points(Curve& cv) 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; +// } + int main () { Polycurve_conic_traits_2 traits; @@ -732,6 +742,19 @@ int main () 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); + // 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; + + + // std::cout<< std::endl; @@ -782,11 +805,22 @@ int main () // 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; + Conic_traits_2 con_traits; + Conic_point_2 ps2 (1, 1); + Conic_point_2 pt2 (2, 4); + std::cout << "conic curve is : " << xc3 << 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; + + return 0; } 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 old mode 100755 new mode 100644 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits.cpp old mode 100755 new mode 100644