From 6c2e91b4232d1b75c0be95c7c63b26ffbe4c99b3 Mon Sep 17 00:00:00 2001 From: Paolo Cignoni Date: Thu, 21 Dec 2017 01:16:03 +0100 Subject: [PATCH] improved MarkFauxEdgeWithPolyLine --- vcg/complex/algorithms/curve_on_manifold.h | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/vcg/complex/algorithms/curve_on_manifold.h b/vcg/complex/algorithms/curve_on_manifold.h index 4415ad83..e3dd412d 100644 --- a/vcg/complex/algorithms/curve_on_manifold.h +++ b/vcg/complex/algorithms/curve_on_manifold.h @@ -177,13 +177,12 @@ public: * */ - bool MarkFauxEdgeWithPolyLine(MeshType &poly) + bool MarkFauxEdgeWithPolyLine(MeshType &poly,bool markFlag=true) { - tri::UpdateFlags::FaceSetF(base); + if(markFlag) tri::UpdateFlags::FaceSetF(base); tri::UpdateTopology::VertexFace(base); tri::UpdateTopology::FaceFace(base); - - bool ret = true; + for(EdgeIterator ei=poly.edge.begin(); ei!=poly.edge.end();++ei) { CoordType ip0,ip1; @@ -194,23 +193,28 @@ public: { VertexPointer v0 = FindVertexSnap(f0,ip0); VertexPointer v1 = FindVertexSnap(f1,ip1); - assert(v1>0 && v0>0 && v0!=v1); + if(v0==0 || v1==0) return false; + if(v0==v1) return false; FacePointer ff0,ff1; int e0,e1; - ret &= face::FindSharedFaces(v0,v1,ff0,ff1,e0,e1); - if(ret) { + bool ret=face::FindSharedFaces(v0,v1,ff0,ff1,e0,e1); + if(ret){ + assert(ret); assert(ff0->V(e0)==v0 || ff0->V(e0)==v1); ff0->ClearF(e0); - ff1->ClearF(e1); + ff1->ClearF(e1); + } + else { + return false; } } - else - { - assert(0); - } + else { + return false; + } } - return ret; + return true; } + ScalarType MinDistOnEdge(CoordType samplePnt, EdgeGrid &edgeGrid, MeshType &poly, CoordType &closestPoint) {