Skip to content

Commit

Permalink
Added a call to convex_hull_3() to test the code of Arr_polyhedral_sg…
Browse files Browse the repository at this point in the history
…m_polyhedron_3, which makes the Polyhedron atype a model of the FaceGraph concept
  • Loading branch information
efifogel committed Apr 27, 2024
1 parent aff5bc4 commit 152cc70
Showing 1 changed file with 34 additions and 14 deletions.
48 changes: 34 additions & 14 deletions Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_sgm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,41 @@

// Testing the spherical gaussian map
#include <iostream>

#include <boost/iterator/iterator_facade.hpp>

#include <CGAL/Exact_predicates_exact_constructions_kernel.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_polyhedron_3.h>
#include <CGAL/convex_hull_3.h>

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<Kernel, -1, 0> Gm_traits;
using Gm_traits = CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel, -1, 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
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

typedef CGAL::Arr_polyhedral_sgm<Gm_traits> Gm;
typedef CGAL::Arr_polyhedral_sgm_polyhedron_3<Gm, Kernel> Gm_polyhedron;
typedef CGAL::Arr_polyhedral_sgm_initializer<Gm, Gm_polyhedron> Gm_initializer;
using Gm = CGAL::Arr_polyhedral_sgm<Gm_traits>;
using Gm_polyhedron = CGAL::Arr_polyhedral_sgm_polyhedron_3<Gm, Kernel>;
using Gm_initializer = CGAL::Arr_polyhedral_sgm_initializer<Gm, Gm_polyhedron>;

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()
{
int main() {
// Construct the Gaussian map of a tetrahedron
Point_3 points[] = {
Point_3(1.0, 0.0, 0.0),
Expand Down Expand Up @@ -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() << ", "
Expand All @@ -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;
}

0 comments on commit 152cc70

Please sign in to comment.