handcrafted surface_mesh::degree() function

This commit is contained in:
Andreas Fabri 2017-05-30 19:29:16 +02:00
parent 0e8397ed8e
commit 19f3f23d25
1 changed files with 9 additions and 8 deletions

View File

@ -2376,16 +2376,17 @@ typename Surface_mesh<P>::size_type
Surface_mesh<P>::
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;
}