From 190e1612c72cdcc73048f0d378cf875bb7499180 Mon Sep 17 00:00:00 2001 From: cignoni Date: Sun, 21 Dec 2008 01:41:07 +0000 Subject: [PATCH] added VVStarVF that computes the star of a given vertex exploiting VF adjacency --- vcg/simplex/face/topology.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/vcg/simplex/face/topology.h b/vcg/simplex/face/topology.h index 44f830f2..caceccc9 100644 --- a/vcg/simplex/face/topology.h +++ b/vcg/simplex/face/topology.h @@ -559,6 +559,32 @@ void VFAppend(FaceType* & f, int z) v->VFi()=z; } +/*! +* Compute the set of vertices adjacent to a given vertex using VF adjacency. +* \param vp pointer to the vertex whose star has to be computed. +* \param starVec a std::vector of Vertex pointer that is filled with the adjacent vertices. +* +*/ + +template +void VVStarVF( typename FaceType::VertexType* vp, std::vector &starVec) +{ + typedef typename FaceType::VertexType* VertexPointer; + starVec.clear(); + face::VFIterator vfi(vp); + while(!vfi.End()) + { + starVec.push_back(vfi.F()->V1(vfi.I())); + starVec.push_back(vfi.F()->V2(vfi.I())); + ++vfi; + } + + std::sort(starVec.begin(),starVec.end()); + typename std::vector::iterator new_end = std::unique(starVec.begin(),starVec.end()); + starVec.resize(new_end-starVec.begin()); + +} + /*@}*/ } // end namespace } // end namespace