Added a call to convex_hull_3() to test the code of Arr_polyhedral_sgm_polyhedron_3, which makes the Polyhedron atype a model of the FaceGraph concept

This commit is contained in:
Efi Fogel 2024-04-27 20:39:40 +03:00
parent aff5bc4126
commit 152cc70ec8
1 changed files with 34 additions and 14 deletions

View File

@ -2,29 +2,41 @@
// Testing the spherical gaussian map // Testing the spherical gaussian map
#include <iostream> #include <iostream>
#include <boost/iterator/iterator_facade.hpp>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h> #include <CGAL/Polyhedron_3.h>
#include <CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h>
#include <CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h> #include <CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h>
#include <CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h> #include <CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h>
#include <CGAL/convex_hull_3.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
typedef Kernel::Point_3 Point_3; using Point_3 = Kernel::Point_3;
#if 1 #if 1
typedef CGAL::Arr_polyhedral_sgm_traits<Kernel, -1, 0> Gm_traits; using Gm_traits = CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel, -1, 0>;
#elif 0 #elif 0
typedef CGAL::Arr_polyhedral_sgm_traits<Kernel, -8, 6> Gm_traits; using Gm_traits = CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel, -8, 6>;
#else #else
typedef CGAL::Arr_polyhedral_sgm_traits<Kernel, -11, 7> Gm_traits; using Gm_traits = CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel, -11, 7>;
#endif #endif
typedef CGAL::Arr_polyhedral_sgm<Gm_traits> Gm; using Gm = CGAL::Arr_polyhedral_sgm<Gm_traits>;
typedef CGAL::Arr_polyhedral_sgm_polyhedron_3<Gm, Kernel> Gm_polyhedron; using Gm_polyhedron = CGAL::Arr_polyhedral_sgm_polyhedron_3<Gm, Kernel>;
typedef CGAL::Arr_polyhedral_sgm_initializer<Gm, Gm_polyhedron> Gm_initializer; using Gm_initializer = CGAL::Arr_polyhedral_sgm_initializer<Gm, Gm_polyhedron>;
int main() struct Point_iterator :
{ boost::iterator_facade<Point_iterator, Point_3,
std::forward_iterator_tag, Point_3> {
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 // Construct the Gaussian map of a tetrahedron
Point_3 points[] = { Point_3 points[] = {
Point_3(1.0, 0.0, 0.0), Point_3(1.0, 0.0, 0.0),
@ -61,9 +73,9 @@ int main()
Kernel::FT sw(16); Kernel::FT sw(16);
Gm::Vertex_const_handle it; Gm::Vertex_const_handle it;
for (it = gm.vertices_begin(); it != gm.vertices_end(); ++it) { for (auto vh : gm.vertex_handles()) {
if (it->degree() < 3) continue; if (vh->degree() < 3) continue;
Gm::Halfedge_around_vertex_const_circulator hec3(it->incident_halfedges()); Gm::Halfedge_around_vertex_const_circulator hec3(vh->incident_halfedges());
Gm::Halfedge_around_vertex_const_circulator hec1 = hec3++; Gm::Halfedge_around_vertex_const_circulator hec1 = hec3++;
Gm::Halfedge_around_vertex_const_circulator hec2 = hec3++; Gm::Halfedge_around_vertex_const_circulator hec2 = hec3++;
std::cout << (*hec1).face()->point() << ", " std::cout << (*hec1).face()->point() << ", "
@ -77,5 +89,13 @@ int main()
} }
// std::cout << sw << std::endl; // std::cout << sw << std::endl;
if ((3 * sw) != 1) return -1; 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; return 0;
} }