From 19f3f23d25fdd57c99e1e5f363ea8da6f0b1b6bb Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 30 May 2017 19:29:16 +0200 Subject: [PATCH] handcrafted surface_mesh::degree() function --- .../include/CGAL/Surface_mesh/Surface_mesh.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index fa1fcd68d72..7adc71945ca 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -2376,16 +2376,17 @@ typename Surface_mesh

::size_type Surface_mesh

:: degree(Vertex_index v) const { - size_type count(0); - if(halfedge(v) == null_halfedge()){ + Halfedge_index h = halfedge(v); + + if(h == null_halfedge()){ return 0; } - Vertex_around_target_circulator vvit(halfedge(v), *this); - Vertex_around_target_circulator vvend = vvit; - if(vvit) do - { - ++count; - } while (++vvit != vvend); + size_type count(0); + Halfedge_index done = h; + do { + ++count; + h = opposite(next(h)); + }while(h != done); return count; }