From 1f992d7929c1135e689482cf3e2fa8cb7917b3d0 Mon Sep 17 00:00:00 2001 From: cignoni Date: Wed, 14 Jan 2009 15:54:50 +0000 Subject: [PATCH] Added helper function to returning a list of all the unique edges of a mesh --- vcg/complex/trimesh/update/topology.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/vcg/complex/trimesh/update/topology.h b/vcg/complex/trimesh/update/topology.h index 54f27553..d82d8c51 100644 --- a/vcg/complex/trimesh/update/topology.h +++ b/vcg/complex/trimesh/update/topology.h @@ -160,9 +160,12 @@ inline bool operator == ( const PEdge & pe ) const }; +// Fill a vector with all the edges of the mesh. +// each edge is stored in the vector the number of times that it appears in the mesh, with the referring face. + static void FillEdgeVector(MeshType &m, std::vector &e) { - FaceIterator pf; + FaceIterator pf; typename std::vector::iterator p; // Alloco il vettore ausiliario @@ -183,6 +186,17 @@ static void FillEdgeVector(MeshType &m, std::vector &e) assert(p==e.end()); } +static void FillUniqueEdgeVector(MeshType &m, std::vector &Edges) +{ + FillEdgeVector(m,Edges); + sort(Edges.begin(), Edges.end()); // Lo ordino per vertici + + typename std::vector< PEdge>::iterator newEnd = std::unique(Edges.begin(), Edges.end()); + typename std::vector::iterator ei; + + Edges.resize(newEnd-Edges.begin()); +} + /// \brief Update the Face-Face topological relation by allowing to retrieve for each face what other faces shares their edges. static void FaceFace(MeshType &m) {