From 2a552f897626391fa39fba7872ce6bd9235f9487 Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 7 Oct 2013 08:07:16 +0000 Subject: [PATCH] Corrected a wrong call to GetAreaAndFrontier that I forgot to update after the api change... --- vcg/complex/algorithms/voronoi_clustering.h | 28 ++++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/vcg/complex/algorithms/voronoi_clustering.h b/vcg/complex/algorithms/voronoi_clustering.h index d25a7737..c60b2ff2 100644 --- a/vcg/complex/algorithms/voronoi_clustering.h +++ b/vcg/complex/algorithms/voronoi_clustering.h @@ -142,9 +142,7 @@ static void VoronoiColoring(MeshType &m, std::vector &seedVec, boo std::pair zz(0.0f,static_cast(NULL)); std::vector< std::pair > regionArea(m.vert.size(),zz); std::vector borderVec; - std::vector cornerVec; - std::vector borderCornerVec; - GetAreaAndFrontier(m, sources, regionArea, borderVec, cornerVec, borderCornerVec); + GetAreaAndFrontier(m, sources, regionArea, borderVec); tri::Geodesic::Compute(m,borderVec); } @@ -499,7 +497,24 @@ static void ConvertVoronoiDiagramToMesh(MeshType &m, tri::UpdateTopology::FaceFace(outMesh); tri::UpdateFlags::FaceBorderFromFF(outMesh); - // 2) set up faux bits + // 2) Remove Flips + tri::UpdateNormal::PerFaceNormalized(outMesh); + tri::UpdateFlags::FaceClearV(outMesh); + for(FaceIterator fi=outMesh.face.begin();fi!=outMesh.face.end();++fi) + { + int badDiedralCnt=0; + for(int i=0;i<3;++i) + if(fi->N() * fi->FFp(i)->N() <0 ) badDiedralCnt++; + + if(badDiedralCnt == 2) fi->SetV(); + } + for(FaceIterator fi=outMesh.face.begin();fi!=outMesh.face.end();++fi) + if(fi->IsV()) Allocator::DeleteFace(outMesh,*fi); + tri::Allocator::CompactEveryVector(outMesh); + tri::UpdateTopology::FaceFace(outMesh); + tri::UpdateFlags::FaceBorderFromFF(outMesh); + + // 3) set up faux bits for(FaceIterator fi=outMesh.face.begin();fi!=outMesh.face.end();++fi) for(int i=0;i<3;++i) { @@ -511,6 +526,11 @@ static void ConvertVoronoiDiagramToMesh(MeshType &m, //******************** END OF CLEANING **************** + + // ******************* star to tri conversion ********* + + + // Now a plain conversion of the non faux edges into a polygonal mesh std::vector< typename tri::UpdateTopology::PEdge> EdgeVec; tri::UpdateTopology::FillUniqueEdgeVector(outMesh,EdgeVec,false);