diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_sgm.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_sgm.cpp index 1e228a4b8f6..0b7889b4ed7 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_sgm.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_sgm.cpp @@ -2,29 +2,41 @@ // Testing the spherical gaussian map #include + +#include + #include #include -#include #include #include +#include -typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; -typedef Kernel::Point_3 Point_3; +using Kernel = CGAL::Exact_predicates_exact_constructions_kernel; +using Point_3 = Kernel::Point_3; #if 1 -typedef CGAL::Arr_polyhedral_sgm_traits Gm_traits; +using Gm_traits = CGAL::Arr_geodesic_arc_on_sphere_traits_2; #elif 0 -typedef CGAL::Arr_polyhedral_sgm_traits Gm_traits; +using Gm_traits = CGAL::Arr_geodesic_arc_on_sphere_traits_2; #else -typedef CGAL::Arr_polyhedral_sgm_traits Gm_traits; +using Gm_traits = CGAL::Arr_geodesic_arc_on_sphere_traits_2; #endif -typedef CGAL::Arr_polyhedral_sgm Gm; -typedef CGAL::Arr_polyhedral_sgm_polyhedron_3 Gm_polyhedron; -typedef CGAL::Arr_polyhedral_sgm_initializer Gm_initializer; +using Gm = CGAL::Arr_polyhedral_sgm; +using Gm_polyhedron = CGAL::Arr_polyhedral_sgm_polyhedron_3; +using Gm_initializer = CGAL::Arr_polyhedral_sgm_initializer; -int main() -{ +struct Point_iterator : + boost::iterator_facade { + Point_iterator(Gm::Face_const_iterator it) : m_it(it) {} + void increment() { ++m_it; } + const Point_3& dereference() const { return m_it->point(); } + bool equal(Point_iterator const& o) const { return m_it == o.m_it; } + Gm::Face_const_iterator m_it; +}; + +int main() { // Construct the Gaussian map of a tetrahedron Point_3 points[] = { Point_3(1.0, 0.0, 0.0), @@ -61,9 +73,9 @@ int main() Kernel::FT sw(16); Gm::Vertex_const_handle it; - for (it = gm.vertices_begin(); it != gm.vertices_end(); ++it) { - if (it->degree() < 3) continue; - Gm::Halfedge_around_vertex_const_circulator hec3(it->incident_halfedges()); + for (auto vh : gm.vertex_handles()) { + if (vh->degree() < 3) continue; + Gm::Halfedge_around_vertex_const_circulator hec3(vh->incident_halfedges()); Gm::Halfedge_around_vertex_const_circulator hec1 = hec3++; Gm::Halfedge_around_vertex_const_circulator hec2 = hec3++; std::cout << (*hec1).face()->point() << ", " @@ -77,5 +89,13 @@ int main() } // std::cout << sw << std::endl; if ((3 * sw) != 1) return -1; + + // The following tests the code Arr_polyhedral_sgm_polyhedron_3 that + // make the polyhedron a model of the FaceGraph concepts + Gm_polyhedron P; + Point_iterator begin(gm.faces_begin()); + Point_iterator end(gm.faces_end()); + CGAL::convex_hull_3(begin, end, P); + return 0; }