From 37d4f89148048adf492dac503fb83854634fa04c Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Tue, 18 Apr 2017 13:01:03 +0300 Subject: [PATCH 1/6] Made the polyhedron a model of FaceGraph --- .../Arr_polyhedral_sgm_polyhedron_3.h | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h index 64d63bbae04..e598b34ecb9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Efi Fogel @@ -160,7 +160,7 @@ public: /*! Set the vertex */ void set_vertex(Arr_vertex_handle vertex) { m_vertex = vertex; } - + /*! Set the "marked" flag */ void set_marked(bool marked) { m_marked = marked; } @@ -216,6 +216,24 @@ struct Arr_polyhedral_sgm_polyhedron_3 : Arr_polyhedral_sgm_polyhedron_3() {} }; +//! Make the polyhedron a model of FaceGraph +namespace boost { + +template +struct graph_traits > : + public graph_traits > > +{}; + +template +struct property_map, Tag> : + public property_map >, + Tag> +{}; + +} + } //namespace CGAL #endif From 8f63f6857e2f1b125baa85c2e71a9cecdbef5b68 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Tue, 18 Apr 2017 15:00:44 +0300 Subject: [PATCH 2/6] Removed out of CGAL namespace --- .../Arr_polyhedral_sgm_polyhedron_3.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h index e598b34ecb9..7854c1e8500 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h @@ -216,6 +216,8 @@ struct Arr_polyhedral_sgm_polyhedron_3 : Arr_polyhedral_sgm_polyhedron_3() {} }; +} //namespace CGAL + //! Make the polyhedron a model of FaceGraph namespace boost { @@ -234,6 +236,4 @@ struct property_map, Tag> : } -} //namespace CGAL - #endif From 4a793170daa1484adbb01101939f237c796bac86 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Tue, 18 Apr 2017 15:01:01 +0300 Subject: [PATCH 3/6] Introduced Spherical Gaussian map test --- .../Arrangement_on_surface_2/cgal_test_base | 2 + .../Arrangement_on_surface_2/test_sgm.cpp | 69 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_sgm.cpp diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base index c330edd7f48..6d659f7bf1c 100755 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base @@ -1711,6 +1711,8 @@ compile_and_run test_spherical_removal compile_and_run test_io +compile_and_run test_sgm + # if any error occured then append the full error description file to error file if [ -f $FULL_ERROR_DESCRIPTION_FILE ] ; then 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 new file mode 100644 index 00000000000..30a2ca6e57d --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_sgm.cpp @@ -0,0 +1,69 @@ +#define CGAL_IDENTIFICATION_XY 2 + +// Testing the spherical gaussian map +#include +#include +#include +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef Kernel::Point_3 Point_3; +typedef CGAL::Arr_polyhedral_sgm_traits Gm_traits; +typedef CGAL::Arr_polyhedral_sgm Gm; +typedef CGAL::Arr_polyhedral_sgm_polyhedron_3 Gm_polyhedron; +typedef CGAL::Arr_polyhedral_sgm_initializer Gm_initializer; + +int main() +{ + // Construct the Gaussian map of a tetrahedron + Point_3 points[] = { + Point_3(1.0, 0.0, 0.0), + Point_3(0.0, 1.0, 0.0), + Point_3(0.0, 0.0, 1.0), + Point_3(0.0, 0.0, 0.0) + }; + Gm_polyhedron P1; + CGAL::convex_hull_3(points, &points[4], P1); + Gm gm1; + Gm_initializer gm_initializer1(gm1); + gm_initializer1(P1); + if (! gm1.is_valid()) return -1; + + // Construct the Gaussian map of the reflection of a tetrahedron + Gm_polyhedron P2; + for (Point_3* p = points; p != &points[4]; ++p) { + Kernel::Vector_3 v = CGAL::ORIGIN - *p; + *p = CGAL::ORIGIN + v; + } + CGAL::convex_hull_3(points, &points[4], P2); + Gm gm2; + Gm_initializer gm_initializer2(gm2); + gm_initializer2(P2); + if (! gm2.is_valid()) return -1; + + // Compute the Minowski sum of the Gaussian maps + Gm gm; + gm.minkowski_sum(gm1, gm2); + if (! gm.is_valid()) return -1; + + 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()); + Gm::Halfedge_around_vertex_const_circulator hec1 = hec3++; + Gm::Halfedge_around_vertex_const_circulator hec2 = hec3++; + Kernel::Plane_3 plane((*hec1).face()->point(), (*hec2).face()->point(), + (*hec3).face()->point()); + Kernel::Vector_3 v(CGAL::ORIGIN, plane.projection(CGAL::ORIGIN)); + Kernel::FT tmp = v.squared_length(); + if (tmp < sw) sw = tmp; + } + // std::cout << sw << std::endl; + CGAL::Gmpq res(1,3); + if (sw.exact() != res) return -1; + return 0; +} From b50ccf6e1f3b9a190e9e7bc36bd0e2795a6bad68 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Mon, 1 May 2017 02:22:49 +0300 Subject: [PATCH 4/6] Pacify VS --- .../include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h index 9a750fae761..24b4e3f1491 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h @@ -2936,7 +2936,7 @@ public: CGAL_precondition(!kernel.equal_3_object()(source, target)); CGAL_precondition(!kernel.equal_3_object() (kernel.construct_opposite_direction_3_object()(source), - target)); + static_cast(target))); this->m_normal = this->construct_normal_3(source, target); // Check whether one of the endpoints coincides with a pole: */ From b2b676759c4da08bd7d176e42e28de45130279a2 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Mon, 1 May 2017 02:50:43 +0300 Subject: [PATCH 5/6] Added test test_sgm --- .../test/Arrangement_on_surface_2/cgal_test.cmake | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake index 7bf32e47fa5..9439aa934ce 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake @@ -581,8 +581,8 @@ function(test_segment_traits_adaptor) compile_test_with_flags(test_traits_adaptor segments "${flags}") # if [ -n "${SUCCESS}" ] ; then - execute_commands_traits_adaptor( segments segments_traits_adaptor - COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT + execute_commands_traits_adaptor( segments segments_traits_adaptor + COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE IS_BETWEEN_CW) endfunction() @@ -597,8 +597,8 @@ function(test_linear_traits_adaptor) compile_test_with_flags( test_traits_adaptor linear "${flags}") - execute_commands_traits_adaptor( linear linear_traits_adaptor - COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE + execute_commands_traits_adaptor( linear linear_traits_adaptor + COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT) endfunction() @@ -614,8 +614,8 @@ function(test_spherical_arcs_traits_adaptor) compile_test_with_flags( test_traits_adaptor geodesic_arcs_on_sphere "${flags}") - execute_commands_traits_adaptor( spherical_arcs spherical_arcs_traits_adaptor - COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE + execute_commands_traits_adaptor( spherical_arcs spherical_arcs_traits_adaptor + COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT) endfunction() @@ -1365,3 +1365,5 @@ compile_and_run(test_unbounded_removal) compile_and_run(test_spherical_removal) compile_and_run(test_io) + +compile_and_run(test_sgm) From 65406224fa7ad93cc10a8acac2822f0c891d126b Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Mon, 22 May 2017 14:49:31 +0300 Subject: [PATCH 6/6] Removed dedundant type definition of Arr_vertex_handle --- .../CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h index 5b018c3da6b..df2135cbe41 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h @@ -335,7 +335,6 @@ private: virtual void handle_new_edge(typename Base::Halfedge_handle edge) { typedef typename Base::Face_handle Arr_face_handle; - typedef typename Base::Vertex_handle Arr_vertex_handle; Arr_face_handle src_face = edge->twin()->face(); Arr_face_handle trg_face = edge->face();