From aaf173b4f6a05bf2aa3f9c1947e9c5651685f9ab Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Wed, 4 Nov 2020 18:14:03 +0200 Subject: [PATCH] Updated --- .../Arrangement_on_surface_2.txt | 2 +- .../Arrangement_on_surface_2/arr_polylines.h | 15 ++-- .../polycurve_bezier.cpp | 15 ++-- .../polycurves_basic.cpp | 7 +- .../Arrangement_on_surface_2/polylines.cpp | 70 +++++++------------ .../predefined_kernel.cpp | 49 +++---------- .../spherical_degenerate_insert1.cpp | 65 ++++++----------- .../spherical_degenerate_insert2.cpp | 56 +++++---------- .../spherical_degenerate_sweep.cpp | 15 ++-- .../spherical_insert.cpp | 22 +++--- .../spherical_overlay.cpp | 37 ++++------ 11 files changed, 122 insertions(+), 231 deletions(-) diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt index 59a9a3dfa19..d6f048608a8 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt @@ -3807,7 +3807,7 @@ disjoint line segments, defined in the input file `Europe.dat`. In the following example we use the predefined `Exact_predicates_exact_constructions_kernel` for instantiating our -segment-traits class. This kernel use interval arithmetic to filter +segment-traits class. This kernel uses interval arithmetic to filter the exact computations. The program reads a set of line segments with integer coordinates from a file and computes their arrangement. By default it opens the `fan_grids.dat` input-file, located in the diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/arr_polylines.h b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/arr_polylines.h index 00d1f910dd3..0d24316603c 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/arr_polylines.h +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/arr_polylines.h @@ -6,13 +6,14 @@ #include #include -typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; -typedef Kernel::FT Number_type; +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef Kernel::FT Number_type; -typedef CGAL::Arr_segment_traits_2 Segment_traits; -typedef CGAL::Arr_polyline_traits_2 Traits; -typedef Traits::Point_2 Point; -typedef Traits::Curve_2 Polyline; -typedef CGAL::Arrangement_2 Arrangement; +typedef CGAL::Arr_segment_traits_2 Segment_traits; +typedef CGAL::Arr_polyline_traits_2 Traits; +typedef Traits::Point_2 Point; +typedef Traits::Segment_2 Segment; +typedef Traits::Curve_2 Polyline; +typedef CGAL::Arrangement_2 Arrangement; #endif diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp index 17d7b8a7af5..e99e01fa133 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurve_bezier.cpp @@ -48,11 +48,11 @@ int main() { Bezier_curve B; in_file >> n_curves; - unsigned int k; + size_t k; for (k = 0; k < n_curves; ++k) { // Read the current curve (specified by its control points). in_file >> B; - //convert it into x-monotone bezier curve. + // convert it into x-monotone bezier curve. std::vector obj_vector; bezier_traits.make_x_monotone_2_object()(B, std::back_inserter(obj_vector)); Bezier_x_monotone_curve x_seg = @@ -61,16 +61,9 @@ int main() { } X_mono_polycurve polycurve = ctr_xpolycurve(x_curves.begin(), x_curves.end()); - - // Construct the arrangement. Arrangement_2 arr; - insert(arr, polycurve); - - // Print the arrangement size. - std::cout << "The arrangement size:" << std::endl - << " V = " << arr.number_of_vertices() - << ", E = " << arr.number_of_edges() - << ", F = " << arr.number_of_faces() << std::endl; + insert(arr, polycurve); // construct the arrangement + print_arrangement_size(arr); // print the arrangement size return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurves_basic.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurves_basic.cpp index 0e11fef65db..016c0ef74de 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurves_basic.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polycurves_basic.cpp @@ -8,6 +8,8 @@ #include #include +#include "arr_print.h" + typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; typedef CGAL::Arr_directional_non_caching_segment_basic_traits_2 Subcurve_traits; @@ -40,8 +42,7 @@ int main() { insert_non_intersecting_curve(arr, pc1); insert_non_intersecting_curve(arr, pc2); - std::cout << "# vertices: " << arr.number_of_vertices() << std::endl;; - std::cout << "# halfedges: " << arr.number_of_halfedges() << std::endl;; - std::cout << "# faces: " << arr.number_of_faces() << std::endl;; + print_arrangement_size(arr); // print the arrangement size + return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polylines.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polylines.cpp index 90f699cf7e9..2b5ccaa583d 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polylines.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polylines.cpp @@ -7,58 +7,42 @@ #include "arr_polylines.h" #include "arr_print.h" -/* Define the Arrangement traits class to be used. You can either use some user - * defined kernel and Segment_traits_2 or the defaults. - */ - -// Instantiate the traits class using a user-defined kernel and Segment_traits_2. -// Identical instantiation can be achieved using the default Kernel: -// typedef CGAL::Arr_polyline_traits_2<> Geom_traits_2; -typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; -typedef CGAL::Arr_segment_traits_2 Segment_traits_2; -typedef CGAL::Arr_polyline_traits_2 Geom_traits_2; - -typedef Geom_traits_2::Point_2 Point_2; -typedef Geom_traits_2::Segment_2 Segment_2; -typedef Geom_traits_2::Curve_2 Polyline_2; -typedef CGAL::Arrangement_2 Arrangement_2; - int main() { - Geom_traits_2 traits; - Arrangement_2 arr(&traits); + Traits traits; + Arrangement arr(&traits); auto polyline_construct = traits.construct_curve_2_object(); - Point_2 points1[5]; - points1[0] = Point_2(0, 0); - points1[1] = Point_2(2, 4); - points1[2] = Point_2(3, 0); - points1[3] = Point_2(4, 4); - points1[4] = Point_2(6, 0); - Polyline_2 pi1 = polyline_construct(&points1[0], &points1[5]); + Point points1[5]; + points1[0] = Point(0, 0); + points1[1] = Point(2, 4); + points1[2] = Point(3, 0); + points1[3] = Point(4, 4); + points1[4] = Point(6, 0); + Polyline pi1 = polyline_construct(&points1[0], &points1[5]); - std::list points2; - points2.push_back(Point_2(1, 3)); - points2.push_back(Point_2(0, 2)); - points2.push_back(Point_2(1, 0)); - points2.push_back(Point_2(2, 1)); - points2.push_back(Point_2(3, 0)); - points2.push_back(Point_2(4, 1)); - points2.push_back(Point_2(5, 0)); - points2.push_back(Point_2(6, 2)); - points2.push_back(Point_2(5, 3)); - points2.push_back(Point_2(4, 2)); - Polyline_2 pi2 = polyline_construct(points2.begin(), points2.end()); + std::list points2; + points2.push_back(Point(1, 3)); + points2.push_back(Point(0, 2)); + points2.push_back(Point(1, 0)); + points2.push_back(Point(2, 1)); + points2.push_back(Point(3, 0)); + points2.push_back(Point(4, 1)); + points2.push_back(Point(5, 0)); + points2.push_back(Point(6, 2)); + points2.push_back(Point(5, 3)); + points2.push_back(Point(4, 2)); + Polyline pi2 = polyline_construct(points2.begin(), points2.end()); - std::vector segs; - segs.push_back(Segment_2(Point_2(0, 2), Point_2(1, 2))); - segs.push_back(Segment_2(Point_2(1, 2), Point_2(3, 6))); - segs.push_back(Segment_2(Point_2(3, 6), Point_2(5, 2))); - Polyline_2 pi3 = polyline_construct(segs.begin(), segs.end()); + std::vector segs; + segs.push_back(Segment(Point(0, 2), Point(1, 2))); + segs.push_back(Segment(Point(1, 2), Point(3, 6))); + segs.push_back(Segment(Point(3, 6), Point(5, 2))); + Polyline pi3 = polyline_construct(segs.begin(), segs.end()); insert(arr, pi1); insert(arr, pi2); insert(arr, pi3); - print_arrangement(arr); + print_arrangement_size(arr); // print the arrangement size return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp index 2781b6ee36c..306f38ce5ce 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp @@ -2,19 +2,14 @@ // Constructing an arrangement of intersecting line segments using the // predefined kernel with exact constructions and exact predicates. -#include -#include -#include -#include #include -#include -typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; -typedef Kernel::FT Number_type; -typedef CGAL::Arr_segment_traits_2 Traits_2; -typedef Traits_2::Point_2 Point_2; -typedef Traits_2::X_monotone_curve_2 Segment_2; -typedef CGAL::Arrangement_2 Arrangement_2; +#include +#include + +#include "arr_exact_construction_segments.h" +#include "arr_print.h" +#include "read_objects.h" int main (int argc, char* argv[]) { // Get the name of the input file from the command line, or use the default @@ -23,48 +18,26 @@ int main (int argc, char* argv[]) { // Open the input file. std::ifstream in_file(filename); - if (! in_file.is_open()) { std::cerr << "Failed to open " << filename << " ..." << std::endl; return (1); } - // Read the segments from the file. - // The input file format should be (all coordinate values are integers): - // // number of segments. - // // source and target of segment #1. - // // source and target of segment #2. - // : : : : - // // source and target of segment #n. - - std::list segments; - - unsigned int n; - in_file >> n; - unsigned int i; - for (i = 0; i < n; ++i) { - int sx, sy, tx, ty; - in_file >> sx >> sy >> tx >> ty; - segments.push_back (Segment_2 (Point_2 (Number_type(sx), Number_type(sy)), - Point_2 (Number_type(tx), Number_type(ty)))); - } - in_file.close(); + std::list segments; + read_objects(filename, std::back_inserter(segments)); // Construct the arrangement by aggregately inserting all segments. - Arrangement_2 arr; + Arrangement arr; CGAL::Timer timer; std::cout << "Performing aggregated insertion of " - << n << " segments." << std::endl; + << segments.size() << " segments." << std::endl; timer.start(); insert(arr, segments.begin(), segments.end()); timer.stop(); - // Print the arrangement dimensions. - std::cout << "V = " << arr.number_of_vertices() - << ", E = " << arr.number_of_edges() - << ", F = " << arr.number_of_faces() << std::endl; + print_arrangement_size(arr); std::cout << "Construction took " << timer.time() << " seconds." << std::endl; diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert1.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert1.cpp index 4fb3a452a9a..1635d1c1a01 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert1.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert1.cpp @@ -1,75 +1,52 @@ //! \file examples/Arrangement_on_surface_2/aggregated_insertion.cpp // Using the global aggregated insertion functions. -#include - -#include -#include -#include -#include -#include -#include - -typedef CGAL::Exact_rational Number_type; -typedef CGAL::Cartesian Kernel; -typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Geom_traits_2; -typedef Geom_traits_2::Point_2 Point_2; -typedef Geom_traits_2::X_monotone_curve_2 X_monotone_curve_2; -typedef CGAL::Arr_spherical_topology_traits_2 Topol_traits_2; -typedef CGAL::Arrangement_on_surface_2 - Arrangement_2; -typedef Arrangement_2::Vertex_handle Vertex_handle; +#include "arr_geodesic_on_sphere.h" +#include "arr_print.h" int main() { - Geom_traits_2 traits; - Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object(); - Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv = - traits.construct_x_monotone_curve_2_object(); + Geom_traits traits; + auto ctr_p = traits.construct_point_2_object(); + auto ctr_xcv = traits.construct_x_monotone_curve_2_object(); - Arrangement_2 arr(&traits); - Point_2 sp = ctr_p(0, 0, -1); - Point_2 np = ctr_p(0, 0, 1); + Arrangement arr(&traits); + Point sp = ctr_p(0, 0, -1); + Point np = ctr_p(0, 0, 1); Vertex_handle spv = arr.insert_in_face_interior(sp, arr.reference_face()); Vertex_handle npv = arr.insert_in_face_interior(np, arr.reference_face()); #if 1 - Point_2 p1 = ctr_p(-1, 0, 0); + Point p1 = ctr_p(-1, 0, 0); #else - Point_2 p1 = ctr_p(-1, -1, 0); + Point p1 = ctr_p(-1, -1, 0); #endif - Point_2 p2 = ctr_p( 0, -1, 0); - Point_2 p3 = ctr_p( 1, 0, 0); + Point p2 = ctr_p( 0, -1, 0); + Point p3 = ctr_p( 1, 0, 0); Vertex_handle v1 = arr.insert_in_face_interior(p1, arr.reference_face()); Vertex_handle v2 = arr.insert_in_face_interior(p2, arr.reference_face()); Vertex_handle v3 = arr.insert_in_face_interior(p3, arr.reference_face()); - X_monotone_curve_2 xcv_sp1 = ctr_xcv(sp, p1); - X_monotone_curve_2 xcv_sp2 = ctr_xcv(sp, p2); - X_monotone_curve_2 xcv_sp3 = ctr_xcv(sp, p3); + X_monotone_curve xcv_sp1 = ctr_xcv(sp, p1); + X_monotone_curve xcv_sp2 = ctr_xcv(sp, p2); + X_monotone_curve xcv_sp3 = ctr_xcv(sp, p3); arr.insert_at_vertices(xcv_sp1, spv, v1); arr.insert_at_vertices(xcv_sp2, spv, v2); arr.insert_at_vertices(xcv_sp3, spv, v3); - X_monotone_curve_2 xcv_np1 = ctr_xcv(np, p1); - X_monotone_curve_2 xcv_np2 = ctr_xcv(np, p2); - X_monotone_curve_2 xcv_np3 = ctr_xcv(np, p3); + X_monotone_curve xcv_np1 = ctr_xcv(np, p1); + X_monotone_curve xcv_np2 = ctr_xcv(np, p2); + X_monotone_curve xcv_np3 = ctr_xcv(np, p3); arr.insert_at_vertices(xcv_np1, npv, v1); arr.insert_at_vertices(xcv_np2, npv, v2); arr.insert_at_vertices(xcv_np3, npv, v3); - X_monotone_curve_2 xcv_12 = ctr_xcv(p1, p2); - X_monotone_curve_2 xcv_23 = ctr_xcv(p2, p3); + X_monotone_curve xcv_12 = ctr_xcv(p1, p2); + X_monotone_curve xcv_23 = ctr_xcv(p2, p3); arr.insert_at_vertices(xcv_12, v1, v2); arr.insert_at_vertices(xcv_23, v2, v3); - // Print the size of the arrangement. - std::cout << "The arrangement size:" << std::endl - << " V = " << arr.number_of_vertices() - << ", E = " << arr.number_of_edges() - << ", F = " << arr.number_of_faces() << std::endl; - - // std::cout << "arr: " << arr << std::endl; + print_arrangement_size(arr); // print the arrangement size return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert2.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert2.cpp index df847fb9cda..6dc181a2008 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert2.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_insert2.cpp @@ -4,61 +4,39 @@ // #define CGAL_IDENTIFICATION_XY CGAL_X_MINUS_11_Y_7 // #define CGAL_ARRANGEMENT_ON_SURFACE_INSERT_VERBOSE 1 -#include - -#include -#include -#include -#include -#include -#include - -typedef CGAL::Exact_rational Number_type; -typedef CGAL::Cartesian Kernel; -typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Geom_traits_2; -typedef Geom_traits_2::Point_2 Point_2; -typedef Geom_traits_2::X_monotone_curve_2 X_monotone_curve_2; -typedef CGAL::Arr_spherical_topology_traits_2 Topol_traits_2; -typedef CGAL::Arrangement_on_surface_2 - Arrangement_2; -typedef Arrangement_2::Vertex_handle Vertex_handle; +#include "arr_geodesic_on_sphere.h" +#include "arr_print.h" int main() { - Geom_traits_2 traits; + Geom_traits traits; auto ctr_p = traits.construct_point_2_object(); auto ctr_xcv = traits.construct_x_monotone_curve_2_object(); - Arrangement_2 arr(&traits); - Point_2 sp = ctr_p(0, 0, -1); - Point_2 np = ctr_p(0, 0, 1); + Arrangement arr(&traits); + Point sp = ctr_p(0, 0, -1); + Point np = ctr_p(0, 0, 1); - Point_2 p1 = ctr_p(-1, 0, -1); - Point_2 p2 = ctr_p(-1, 0, 1); - X_monotone_curve_2 xcv_sp_p2 = ctr_xcv(sp, p2); - X_monotone_curve_2 xcv_np_p1 = ctr_xcv(np, p1); + Point p1 = ctr_p(-1, 0, -1); + Point p2 = ctr_p(-1, 0, 1); + X_monotone_curve xcv_sp_p2 = ctr_xcv(sp, p2); + X_monotone_curve xcv_np_p1 = ctr_xcv(np, p1); // std::cout << "Inserting " << xcv_sp_p2 << std::endl; insert(arr, xcv_sp_p2); // std::cout << "Inserting " << xcv_np_p1 << std::endl; insert(arr, xcv_np_p1); - Point_2 q1 = ctr_p(-1, -1, -1); - Point_2 q2 = ctr_p(-1, -1, 1); - X_monotone_curve_2 xcv_sp_q2 = ctr_xcv(sp, q2); - X_monotone_curve_2 xcv_np_q1 = ctr_xcv(np, q1); + Point q1 = ctr_p(-1, -1, -1); + Point q2 = ctr_p(-1, -1, 1); + X_monotone_curve xcv_sp_q2 = ctr_xcv(sp, q2); + X_monotone_curve xcv_np_q1 = ctr_xcv(np, q1); insert(arr, xcv_sp_q2); insert(arr, xcv_np_q1); - X_monotone_curve_2 xcv_p1_q1 = ctr_xcv(p1, q1); - X_monotone_curve_2 xcv_p2_q2 = ctr_xcv(p2, q2); + X_monotone_curve xcv_p1_q1 = ctr_xcv(p1, q1); + X_monotone_curve xcv_p2_q2 = ctr_xcv(p2, q2); insert(arr, xcv_p1_q1); insert(arr, xcv_p2_q2); - // Print the size of the arrangement. - std::cout << "The arrangement size:" << std::endl - << " V = " << arr.number_of_vertices() - << ", E = " << arr.number_of_edges() - << ", F = " << arr.number_of_faces() << std::endl; - - // std::cout << "arr: " << arr << std::endl; + print_arrangement_size(arr); // print the arrangement size return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_sweep.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_sweep.cpp index 6d7d15cd7eb..e7e841d94f2 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_sweep.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_sweep.cpp @@ -7,15 +7,14 @@ #include -#include -#include -#include +#include #include #include #include -typedef CGAL::Exact_rational Number_type; -typedef CGAL::Cartesian Kernel; +#include "arr_print.h" + +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; #if 0 typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Geom_traits_2; @@ -125,11 +124,7 @@ int main() { CGAL::insert_empty(arr, xcvs_sub.begin(), xcvs_sub.end(), points_sub.begin(), points_sub.end()); - // Print the size of the arrangement. - std::cout << "The arrangement size:" << std::endl - << " V = " << arr.number_of_vertices() - << ", E = " << arr.number_of_edges() - << ", F = " << arr.number_of_faces() << std::endl; + print_arrangement_size(arr); // print the arrangement size std::cout << "=======================================================" << std::endl << std::endl << std::endl; diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_insert.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_insert.cpp index ab493f3e991..f5885f7cbbc 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_insert.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_insert.cpp @@ -10,19 +10,17 @@ #include "arr_print.h" -typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; -typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 - Geom_traits_2; -typedef Geom_traits_2::Point_2 Point_2; -typedef Geom_traits_2::Curve_2 Curve_2; -typedef CGAL::Arr_spherical_topology_traits_2 Topol_traits_2; -typedef CGAL::Arrangement_on_surface_2 - Arrangement_2; +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Geom_traits; +typedef Geom_traits::Point_2 Point; +typedef Geom_traits::Curve_2 Curve; +typedef CGAL::Arr_spherical_topology_traits_2 Topol_traits; +typedef CGAL::Arrangement_on_surface_2 Arrangement; int main() { // Construct the arrangement from 12 geodesic arcs. - Geom_traits_2 traits; - Arrangement_2 arr(&traits); + Geom_traits traits; + Arrangement arr(&traits); auto ctr_p = traits.construct_point_2_object(); auto ctr_cv = traits.construct_curve_2_object(); @@ -31,7 +29,7 @@ int main() { // point (-11, 7, 0). The curve (-1,0,0),(0,1,0) intersects the identification // curve. - std::list arcs; + std::list arcs; arcs.push_back(ctr_cv(ctr_p(1, 0, 0), ctr_p(0, 0, -1))); arcs.push_back(ctr_cv(ctr_p(1, 0, 0), ctr_p(0, 0, 1))); @@ -47,7 +45,7 @@ int main() { arcs.push_back(ctr_cv(ctr_p(-1, 0, 0), ctr_p(0, -1, 0))); CGAL::insert(arr, arcs.begin(), arcs.end()); - print_arrangement_size(arr); + print_arrangement_size(arr); // print the arrangement size print_arrangement(arr); return 0; diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp index 542a2c78b10..2f5f6430dee 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_overlay.cpp @@ -1,47 +1,38 @@ //! \file examples/Arrangement_on_surface_2/spherical_overlay.cpp // Overlay of two arrangements embedded on the sphere. -#include -#include -#include -#include +#include #include #include -typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; -typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Geom_traits_2; -typedef Geom_traits_2::Point_2 Point_2; -typedef Geom_traits_2::X_monotone_curve_2 X_monotone_curve_2; -typedef CGAL::Arr_spherical_topology_traits_2 Topol_traits_2; -typedef CGAL::Arrangement_on_surface_2 - Arrangement_2; -typedef CGAL::Arr_default_overlay_traits Overlay_traits; +#include "arr_geodesic_on_sphere.h" + +typedef CGAL::Arr_default_overlay_traits Overlay_traits; int main() { - Geom_traits_2 traits; - Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object(); - Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv = - traits.construct_x_monotone_curve_2_object(); + Geom_traits traits; + auto ctr_p = traits.construct_point_2_object(); + auto ctr_xcv = traits.construct_x_monotone_curve_2_object(); Kernel::Direction_3 dir1(0, 0, 1); - X_monotone_curve_2 g11 = ctr_xcv(ctr_p(-1, 0, 0), ctr_p(0, -1, 0), dir1); - X_monotone_curve_2 g12 = ctr_xcv(ctr_p(0, -1, 0), ctr_p(-1, 0, 0), dir1); + X_monotone_curve g11 = ctr_xcv(ctr_p(-1, 0, 0), ctr_p(0, -1, 0), dir1); + X_monotone_curve g12 = ctr_xcv(ctr_p(0, -1, 0), ctr_p(-1, 0, 0), dir1); - Arrangement_2 arr1(&traits); + Arrangement arr1(&traits); CGAL::insert(arr1, g11); CGAL::insert(arr1, g12); std::cout << "No. of vertices: " << arr1.number_of_vertices() << std::endl; Kernel::Direction_3 dir2(0, 0, -1); - X_monotone_curve_2 g21 = ctr_xcv(ctr_p(-1, 0, 0), ctr_p(0, 1, 0), dir2); - X_monotone_curve_2 g22 = ctr_xcv(ctr_p(0, 1, 0), ctr_p(-1, 0, 0), dir2); + X_monotone_curve g21 = ctr_xcv(ctr_p(-1, 0, 0), ctr_p(0, 1, 0), dir2); + X_monotone_curve g22 = ctr_xcv(ctr_p(0, 1, 0), ctr_p(-1, 0, 0), dir2); - Arrangement_2 arr2(&traits); + Arrangement arr2(&traits); CGAL::insert(arr2, g21); CGAL::insert(arr2, g22); std::cout << "No. of vertices: " << arr2.number_of_vertices() << std::endl; - Arrangement_2 overlay_arr; + Arrangement overlay_arr; Overlay_traits overlay_traits; overlay(arr1, arr2, overlay_arr, overlay_traits); std::cout << "No. of vertices: " << overlay_arr.number_of_vertices()