From 6ca76c16b171b52a0a567050cccda48c77b19649 Mon Sep 17 00:00:00 2001 From: cnr-isti-vclab Date: Wed, 15 Dec 2010 22:38:36 +0000 Subject: [PATCH] added useful he functions --- .../trimesh/update/halfedge_topology.h | 25 +++++++++++++++++++ vcg/connectors/halfedge_pos.h | 11 ++++++++ 2 files changed, 36 insertions(+) diff --git a/vcg/complex/trimesh/update/halfedge_topology.h b/vcg/complex/trimesh/update/halfedge_topology.h index 8af18121..f43f53dc 100644 --- a/vcg/complex/trimesh/update/halfedge_topology.h +++ b/vcg/complex/trimesh/update/halfedge_topology.h @@ -1669,6 +1669,31 @@ namespace vcg } + static vector get_adjacent_faces(FacePointer fp) + { + assert(fp); + assert(!fp->IsD()); + + vector ret; + + Pos p( fp->FHp() ); + assert(p.F() == fp); + + do + { + p.FlipF(); + ret.push_back( p.F() ); + p.FlipF(); + + p.FlipV(); + p.FlipE(); + + } while(p.HE() != fp->FHp()); + + return ret; + + } + /*! * Gets all hedges incident to a vertex * diff --git a/vcg/connectors/halfedge_pos.h b/vcg/connectors/halfedge_pos.h index 7d05fa7b..c2ba15c5 100644 --- a/vcg/connectors/halfedge_pos.h +++ b/vcg/connectors/halfedge_pos.h @@ -100,6 +100,17 @@ namespace vcg return he->HOp()->HVp(); } + /*! + * Gets opposite vertex + */ + VertexPointer Vo() + { + if(!direction) + return he->HVp(); + else + return he->HOp()->HVp(); + } + /*! * Gets pointed hedge */