From 6899d73e710d6791d5cae2570af849e7b15f416c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 20 Nov 2014 21:10:38 +0100 Subject: [PATCH] Use vertex_around_target (and add halfedge(vertex_descriptor) --- BGL/examples/BGL_triangulation_2/face_graph.cpp | 11 ++++++++++- .../boost/graph/graph_traits_Triangulation_2.h | 16 +++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/BGL/examples/BGL_triangulation_2/face_graph.cpp b/BGL/examples/BGL_triangulation_2/face_graph.cpp index 960ea07d8a4..9f129fdf101 100644 --- a/BGL/examples/BGL_triangulation_2/face_graph.cpp +++ b/BGL/examples/BGL_triangulation_2/face_graph.cpp @@ -1,9 +1,11 @@ #include #include #include +#include #include #include +#include typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef K::Point_2 Point; @@ -116,7 +118,14 @@ main(int,char*[]) typedef boost::property_map::type Ppmap; Ppmap ppmap = get(boost::vertex_point, t); + + + BOOST_FOREACH(vertex_descriptor vd, vertices_around_target(*vertices(t).first, t)){ + std::cout << ppmap[vd] << std::endl; + } + ppmap[*(++vertices(t).first)] = Point(78,12); - std::cout << ppmap[*(++vertices(t).first)] << std::endl; + std::cout << " changed point of vertex " << ppmap[*(++vertices(t).first)] << std::endl; + return 0; } diff --git a/BGL/include/CGAL/boost/graph/graph_traits_Triangulation_2.h b/BGL/include/CGAL/boost/graph/graph_traits_Triangulation_2.h index 94cad32ec4b..ef360b4b407 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_Triangulation_2.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_Triangulation_2.h @@ -397,12 +397,26 @@ namespace CGAL { template typename boost::graph_traits< Triangulation_2 >::halfedge_descriptor halfedge(typename boost::graph_traits< Triangulation_2 >::face_descriptor f, - const Triangulation_2& g) + const Triangulation_2& g) { typedef typename boost::graph_traits< Triangulation_2 >::halfedge_descriptor halfedge_descriptor; return halfedge_descriptor(f,0); } + + template + typename boost::graph_traits< Triangulation_2 >::halfedge_descriptor + halfedge(typename boost::graph_traits< Triangulation_2 >::vertex_descriptor v, + const Triangulation_2& g) + { + typedef typename boost::graph_traits< Triangulation_2 >::halfedge_descriptor halfedge_descriptor; + typedef typename boost::graph_traits< Triangulation_2 >::face_descriptor face_descriptor; + face_descriptor fd = v->face(); + int i = fd->index(v); + return halfedge_descriptor(fd,g.ccw(i)); + } + + template inline std::pair< typename boost::graph_traits< Triangulation_2 >::vertex_iterator,