From bb332884fe9dd43abc939f23922f32cf952f8db9 Mon Sep 17 00:00:00 2001 From: Dror Atariah Date: Fri, 7 Jun 2013 09:44:25 +0200 Subject: [PATCH] Added manual test of Compare_endpoints_xy_2 --- .../compare_end_pts_test.cpp | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polylines-wip-tests/compare_end_pts_test.cpp diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polylines-wip-tests/compare_end_pts_test.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polylines-wip-tests/compare_end_pts_test.cpp new file mode 100644 index 00000000000..2d5c6b958fe --- /dev/null +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polylines-wip-tests/compare_end_pts_test.cpp @@ -0,0 +1,57 @@ +/* + * Test the functor: + * Compare_endpoints_xy_2 + */ +#include +#include +#include +#include +#include +#include +#include +#include + +typedef CGAL::Quotient Number_type; +typedef CGAL::Cartesian Kernel; +typedef CGAL::Arr_segment_traits_2 Segment_traits_2; +typedef CGAL::Arr_polyline_traits_2 Traits_2; +typedef Traits_2::Point_2 Point_2; +typedef Segment_traits_2::Curve_2 Segment_2; +typedef Traits_2::Curve_2 Polyline_2; +typedef Traits_2::X_monotone_curve_2 X_Polyline_2; +typedef CGAL::Arrangement_2 Arrangement_2; + +void test_pts(std::vector pts) { + Traits_2 traits; + Traits_2::Construct_x_monotone_curve_2 xpolyline_construct = + traits.construct_x_monotone_curve_2_object(); + X_Polyline_2 xpoly = xpolyline_construct(pts.begin(),pts.end()); + std::cout << "The xpoly: " << xpoly << "\n" + << "is oriented: " + << traits.compare_endpoints_xy_2_object()(xpoly) << "\n"; + xpoly = xpolyline_construct(pts.rbegin(),pts.rend()); + std::cout << "The _reversed_ xpoly: " << xpoly << "\n" + << "is oriented: " + << traits.compare_endpoints_xy_2_object()(xpoly) << "\n"; +} + +int main () +{ + + + std::vector pts; + pts.push_back(Point_2(0,0)); + pts.push_back(Point_2(1,1)); + pts.push_back(Point_2(3,-1)); + pts.push_back(Point_2(3.1,1)); + test_pts(pts); + + pts.clear(); + pts.push_back(Point_2(0,0)); + pts.push_back(Point_2(0,1)); + pts.push_back(Point_2(0,2)); + pts.push_back(Point_2(0,3)); + test_pts(pts); + + return 0; +}