From fb5280b2aa0e6c59cd474e6b64a2d97b4e73e15f Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 17 Feb 2015 11:43:23 +0100 Subject: [PATCH] Remove assertion in halfedge(Polyehdron_3, vertex_descriptor) as it is wrong for an isolated vertex. Document that add_vertex/edge/face(G&) do not initialize the connectivity --- BGL/doc/BGL/Concepts/MutableFaceGraph.h | 2 +- BGL/doc/BGL/Concepts/MutableHalfedgeGraph.h | 4 ++-- .../CGAL/boost/graph/graph_traits_Polyhedron_3.h | 1 - BGL/test/BGL/test_graph_traits.cpp | 16 ++++++++++++++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/BGL/doc/BGL/Concepts/MutableFaceGraph.h b/BGL/doc/BGL/Concepts/MutableFaceGraph.h index 7d44e809458..b9ca68eb375 100644 --- a/BGL/doc/BGL/Concepts/MutableFaceGraph.h +++ b/BGL/doc/BGL/Concepts/MutableFaceGraph.h @@ -23,7 +23,7 @@ the requirement for operations to add faces and to modify face-halfedge relation Expression | returns | Description ----------------------- | ------------ | ----------- -`add_face(g)` | `face_descriptor` | Adds a new face to the graph with no corresponding halfedge set. +`add_face(g)` | `face_descriptor` | Adds a new face to the graph without inializing the connectivity. `remove_face(f, g)` | `void` | Removes `f` from the graph. `set_face(h, f, g)` | `void` | Sets the corresponding face of `h` to `f`. `set_halfedge(f, h, g)` | `void` | Sets the corresponding halfedge of `f` to `h`. diff --git a/BGL/doc/BGL/Concepts/MutableHalfedgeGraph.h b/BGL/doc/BGL/Concepts/MutableHalfedgeGraph.h index e64e9674fdc..b9085f3b52d 100644 --- a/BGL/doc/BGL/Concepts/MutableHalfedgeGraph.h +++ b/BGL/doc/BGL/Concepts/MutableHalfedgeGraph.h @@ -25,9 +25,9 @@ update the incidence information between vertices and halfedges. Expression | returns | Description ------------------------- | ------------ | ----------- -`add_vertex(g)` | `vertex_descriptor` | Adds a new vertex to the graph. +`add_vertex(g)` | `vertex_descriptor` | Adds a new vertex to the graph without inializing the connectivity. `remove_vertex(v, g)` | `void` | Removes `v` from the graph. -`add_edge(g)` | `edge_descriptor` | Adds two opposite halfedges to the graph. +`add_edge(g)` | `edge_descriptor` | Adds two opposite halfedges to the graph without inializing the connectivity. `remove_edge(e, g)` | `void` | Removes the two halfedges corresponding to `e` from the graph. `set_target(h, v, g)` | `void` | Sets the target vertex of `h` and the source of `opposite(h)` to `v`. `set_halfedge(v, h, g)` | `void` | Sets the halfedge of `v` to `h`. The target vertex of `h` must be `v`. diff --git a/BGL/include/CGAL/boost/graph/graph_traits_Polyhedron_3.h b/BGL/include/CGAL/boost/graph/graph_traits_Polyhedron_3.h index 2395ca3ec0f..b0a6d16d2a6 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_Polyhedron_3.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_Polyhedron_3.h @@ -338,7 +338,6 @@ typename boost::graph_traits< CGAL::Polyhedron_3 >::halfedge_descrip halfedge(typename boost::graph_traits< CGAL::Polyhedron_3 >::vertex_descriptor v , const CGAL::Polyhedron_3&) { - CGAL_assertion(v->halfedge()->vertex() == v); return v->halfedge(); } diff --git a/BGL/test/BGL/test_graph_traits.cpp b/BGL/test/BGL/test_graph_traits.cpp index cfe3fc55580..bdf1a681209 100644 --- a/BGL/test/BGL/test_graph_traits.cpp +++ b/BGL/test/BGL/test_graph_traits.cpp @@ -7,6 +7,21 @@ typedef boost::unordered_set id_map; +template +void test_isolated_vertex(const Graph& g) +{ + std::cerr << typeid(g).name() << std::endl; + Graph G; + typedef boost::graph_traits< Graph > Traits; + typedef typename Traits::vertex_descriptor vertex_descriptor; + typedef typename Traits::halfedge_descriptor halfedge_descriptor; + vertex_descriptor v = add_vertex(G); + // the connectivity of v may be anything + set_halfedge(v, Traits::null_halfedge(), G); + halfedge_descriptor h = halfedge(v,G); +} + + template void test_halfedge_around_vertex_iterator(const Graph& g) { @@ -255,6 +270,7 @@ test(const std::vector& graphs) test_faces(p); test_halfedge_around_vertex_iterator(p); test_halfedge_around_face_iterator(p); + test_isolated_vertex(p); } }