From 6c883d3cf32e035b6a72d532c01a45be89446f2d Mon Sep 17 00:00:00 2001 From: cignoni Date: Thu, 5 Dec 2013 22:35:25 +0000 Subject: [PATCH] Added a few assert to prevent the spread to trash data during voronoi relaxation --- vcg/complex/algorithms/voronoi_clustering.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vcg/complex/algorithms/voronoi_clustering.h b/vcg/complex/algorithms/voronoi_clustering.h index 698d1fbd..17f8c165 100644 --- a/vcg/complex/algorithms/voronoi_clustering.h +++ b/vcg/complex/algorithms/voronoi_clustering.h @@ -292,6 +292,7 @@ static void GetAreaAndFrontier(MeshType &m, PerVertexPointerHandle &sources, VertexPointer s0 = sources[(*fi).V(0)]; VertexPointer s1 = sources[(*fi).V(1)]; VertexPointer s2 = sources[(*fi).V(2)]; + assert(s0 && s1 && s2); if((s0 != s1) || (s0 != s2) ) { for(int i=0;i<3;++i) @@ -830,6 +831,7 @@ static void QuadricRelax(MeshType &m, std::vector &seedVec, std::v sources = tri::Allocator:: template GetPerVertexAttribute (m,"sources"); QuadricSumDistance dz; std::vector dVec(m.vert.size(),dz); + assert(m.vert.size()==m.vn); for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi) { assert(sources[vi]!=0);