From 55068f366b91121d5f1f4be53ea689e45f37adbe Mon Sep 17 00:00:00 2001 From: cignoni Date: Tue, 31 May 2011 08:28:40 +0000 Subject: [PATCH] Added CompactEdgeVector functions for removing unused edges --- vcg/complex/allocate.h | 117 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 111 insertions(+), 6 deletions(-) diff --git a/vcg/complex/allocate.h b/vcg/complex/allocate.h index c4b4156a..dab24639 100644 --- a/vcg/complex/allocate.h +++ b/vcg/complex/allocate.h @@ -114,7 +114,7 @@ namespace vcg { { public: PointerUpdater(void) : newBase(0), oldBase(0), newEnd(0), oldEnd(0), preventUpdateFlag(false) { ; } - void Clear(){newBase=oldBase=newEnd=oldEnd=0;}; + void Clear(){newBase=oldBase=newEnd=oldEnd=0;} void Update(SimplexPointerType &vp) { //if(vp>=newBase && vp &pu ) + { + // If already compacted fast return please! + if(m.en==(int)m.edge.size()) return; + + // remap [ ] gives you the new position of the edge in the vector; + pu.remap.resize( m.edge.size(),std::numeric_limits::max() ); + + size_t pos=0; + size_t i=0; + + for(i=0;i pu; + CompactEdgeVector(m,pu); + } /* Function to compact all the vertices that have been deleted and put them to the end of the vector.