From 0cc58623e2a14b56d03c902b11d2a282134d4447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 18 Apr 2017 12:26:31 +0200 Subject: [PATCH] Fixed surface_neighbors_3 Short version: the regular triangulation must be build using weighted points, but the return type is (bare) points --- .../include/CGAL/surface_neighbors_3.h | 44 +++++++++++++------ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/Interpolation/include/CGAL/surface_neighbors_3.h b/Interpolation/include/CGAL/surface_neighbors_3.h index 18162e0d432..cf748ee25c5 100644 --- a/Interpolation/include/CGAL/surface_neighbors_3.h +++ b/Interpolation/include/CGAL/surface_neighbors_3.h @@ -62,24 +62,34 @@ surface_neighbors_3(InputIterator first, InputIterator beyond, //build Voronoi intersection triangulation: I_triangulation it(traits); - it.insert(first,beyond); + + typename ITraits::Construct_weighted_point_2 p2wp = + it.geom_traits().construct_weighted_point_2_object(); + typename ITraits::Construct_point_2 wp2p = + it.geom_traits().construct_point_2_object(); + + while(first != beyond){ + it.insert(p2wp(*first++)); + } + + const typename ITraits::Weighted_point_2 wp = p2wp(p); Locate_type lt; int li; - Face_handle fh = it.locate(p, lt, li); + Face_handle fh = it.locate(wp, lt, li); if(lt == I_triangulation::VERTEX){ *out++ =p; return out; } - Vertex_handle vh = it.insert(p, fh); + Vertex_handle vh = it.insert(wp, fh); typename I_triangulation::Vertex_circulator vc(it.incident_vertices(vh)), done(vc); do{ - *out++= vc->point(); + *out++= wp2p(vc->point()); CGAL_assertion(! it.is_infinite(vc)); } while(vc++!=done); @@ -161,17 +171,27 @@ surface_neighbors_certified_3(InputIterator first, //build Voronoi intersection triangulation: I_triangulation it(traits); - it.insert(first,beyond); + + typename ITraits::Construct_weighted_point_2 p2wp = + it.geom_traits().construct_weighted_point_2_object(); + typename ITraits::Construct_point_2 wp2p = + it.geom_traits().construct_point_2_object(); + + while(first != beyond){ + it.insert(p2wp(*first++)); + } + + const typename ITraits::Weighted_point_2 wp = p2wp(p); Locate_type lt; int li; - Face_handle fh = it.locate(p, lt, li); + Face_handle fh = it.locate(wp, lt, li); if(lt == I_triangulation::VERTEX){ *out++ =p; return std::make_pair(out,true); } - Vertex_handle vh = it.insert(p, fh); + Vertex_handle vh = it.insert(wp, fh); CGAL_assertion(vh->is_valid()); //determine the furthest distance from p to a vertex of its cell @@ -184,12 +204,10 @@ surface_neighbors_certified_3(InputIterator first, while(!valid && ++fc!=fdone); //get the neighbor points: - Vertex_circulator - vc(it.incident_vertices(vh)), - vdone(vc); - do - *out++= vc->point(); - while(++vc!=vdone); + Vertex_circulator vc(it.incident_vertices(vh)), vdone(vc); + do{ + *out++ = wp2p(vc->point()); + }while(++vc!=vdone); return std::make_pair(out, valid); }