diff --git a/Boolean_set_operations_2/test/Boolean_set_operations_2/test_general_polygon_constructions.cpp b/Boolean_set_operations_2/test/Boolean_set_operations_2/test_general_polygon_constructions.cpp index fb4749c91d3..234600fd40c 100644 --- a/Boolean_set_operations_2/test/Boolean_set_operations_2/test_general_polygon_constructions.cpp +++ b/Boolean_set_operations_2/test/Boolean_set_operations_2/test_general_polygon_constructions.cpp @@ -1,4 +1,6 @@ #include +#include +#include #include #include #include @@ -11,46 +13,47 @@ using Polyline_traits = CGAL::Arr_polyline_traits_2; int main() { - std::vector points - = { Point_2 (0, 0), - Point_2 (1, 0), - Point_2 (2, 1), - Point_2 (1, 1), - Point_2 (0, 0.5) }; - - auto point_to_segment - = [&](const Point_2& p) -> Segment_2 - { - const Point_2* it = &p; - if (it == &points.back()) - return Segment_2 (p, points[0]); - return Segment_2 (p, *(++ it)); + std::vector points = { + Point_2(0, 0), + Point_2(1, 0), + Point_2(2, 1), + Point_2(1, 1), + Point_2(0, 0.5) }; - // Case 1: Segment-based GPS from Segment_2 range with transform - // iterator - CGAL::General_polygon_2 - gps_1 (boost::make_transform_iterator - (points.begin(), point_to_segment), - boost::make_transform_iterator - (points.end(), point_to_segment)); + auto point_to_segment = [&](const Point_2& p) -> Segment_2 { + const Point_2* it = &p; + if (it == &points.back()) return Segment_2(p, points[0]); + return Segment_2(p, *(++it)); + }; + // Case 1: Segment-based GPS from Segment_2 range with transform iterator + CGAL::General_polygon_2gp1 + (boost::make_transform_iterator(points.begin(), point_to_segment), + boost::make_transform_iterator(points.end(), point_to_segment)); // Case 5: Polyline-based GPS from Point range with internal // converter - Polyline_traits::Curve_2 curve - (boost::make_transform_iterator - (points.begin(), point_to_segment), - boost::make_transform_iterator - (points.end(), point_to_segment)); - CGAL::General_polygon_2 - gps_6 (curve); + Polyline_traits::Curve_2 curve(boost::make_transform_iterator + (points.begin(), point_to_segment), + boost::make_transform_iterator + (points.end(), point_to_segment)); + CGAL::General_polygon_2gp2(curve); - CGAL::General_polygon_2 - gps_7 (Polyline_traits::make_curve_2 (points)); + Polyline_traits traits; + CGAL::General_polygon_2gp3(traits.make_curve_2(points)); - CGAL::General_polygon_2 - gps_8 (Polyline_traits::make_curve_2 (points, true)); + CGAL::General_polygon_2gp4(traits.make_curve_2(points, true)); + + auto ctr = traits.construct_curve_2_object(); + auto gp5 = ctr(points.begin(), points.end()); + + CGAL::Polygon_2 gp6(points.begin(), points.end()); + auto gp7 = test_conversion(gp6); + if (gp7 != gp6) { + std::cerr << "Conversion failed\n"; + return 1; + } return EXIT_SUCCESS; }