From a3a542edf2aca211039a1ae65680e12b2c21338b Mon Sep 17 00:00:00 2001 From: nicopietroni Date: Mon, 31 Dec 2012 16:19:36 +0000 Subject: [PATCH] added stop on target vertex for VertexDijkstra propagation --- vcg/complex/algorithms/geodesic.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vcg/complex/algorithms/geodesic.h b/vcg/complex/algorithms/geodesic.h index eaa73ae8..39b47af0 100644 --- a/vcg/complex/algorithms/geodesic.h +++ b/vcg/complex/algorithms/geodesic.h @@ -388,8 +388,8 @@ It is just a simple wrapper of the basic Compute() static void PerFaceDijsktraCompute(MeshType &m, const std::vector &seedVec, ScalarType maxDistanceThr = std::numeric_limits::max(), std::vector *InInterval=NULL, - FacePointer FaceTarget=NULL - ) + FacePointer FaceTarget=NULL, + bool avoid_selected=false) { tri::RequireFFAdjacency(m); tri::RequirePerFaceMark(m); @@ -435,6 +435,7 @@ It is just a simple wrapper of the basic Compute() (!tri::IsMarked(m,nextF) || nextDist < nextF->Q()) ) { nextF->Q() = nextDist; + if ((avoid_selected)&&(nextF->IsS()))continue; tri::Mark(m,nextF); Heap.push_back(FaceDist(nextF)); push_heap(Heap.begin(),Heap.end()); @@ -453,8 +454,8 @@ It is just a simple wrapper of the basic Compute() static void PerVertexDijsktraCompute(MeshType &m, const std::vector &seedVec, ScalarType maxDistanceThr = std::numeric_limits::max(), - std::vector *InInterval=NULL,bool avoid_selected=false - ) + std::vector *InInterval=NULL,bool avoid_selected=false, + VertexPointer target=NULL) { tri::RequireVFAdjacency(m); tri::RequirePerVertexMark(m); @@ -489,6 +490,7 @@ It is just a simple wrapper of the basic Compute() { pop_heap(Heap.begin(),Heap.end()); VertexPointer curr = (Heap.back()).v; + if ((target!=NULL)&&(target==curr))return; Heap.pop_back(); std::vector vertVec; face::VVStarVF(curr,vertVec);