added stop on target vertex for VertexDijkstra propagation

This commit is contained in:
Nico Pietroni 2012-12-31 16:19:36 +00:00
parent 22fe0de0e7
commit a3a542edf2
1 changed files with 6 additions and 4 deletions

View File

@ -388,8 +388,8 @@ It is just a simple wrapper of the basic Compute()
static void PerFaceDijsktraCompute(MeshType &m, const std::vector<FacePointer> &seedVec, static void PerFaceDijsktraCompute(MeshType &m, const std::vector<FacePointer> &seedVec,
ScalarType maxDistanceThr = std::numeric_limits<ScalarType>::max(), ScalarType maxDistanceThr = std::numeric_limits<ScalarType>::max(),
std::vector<FacePointer> *InInterval=NULL, std::vector<FacePointer> *InInterval=NULL,
FacePointer FaceTarget=NULL FacePointer FaceTarget=NULL,
) bool avoid_selected=false)
{ {
tri::RequireFFAdjacency(m); tri::RequireFFAdjacency(m);
tri::RequirePerFaceMark(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()) ) (!tri::IsMarked(m,nextF) || nextDist < nextF->Q()) )
{ {
nextF->Q() = nextDist; nextF->Q() = nextDist;
if ((avoid_selected)&&(nextF->IsS()))continue;
tri::Mark(m,nextF); tri::Mark(m,nextF);
Heap.push_back(FaceDist(nextF)); Heap.push_back(FaceDist(nextF));
push_heap(Heap.begin(),Heap.end()); 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<VertexPointer> &seedVec, static void PerVertexDijsktraCompute(MeshType &m, const std::vector<VertexPointer> &seedVec,
ScalarType maxDistanceThr = std::numeric_limits<ScalarType>::max(), ScalarType maxDistanceThr = std::numeric_limits<ScalarType>::max(),
std::vector<VertexPointer> *InInterval=NULL,bool avoid_selected=false std::vector<VertexPointer> *InInterval=NULL,bool avoid_selected=false,
) VertexPointer target=NULL)
{ {
tri::RequireVFAdjacency(m); tri::RequireVFAdjacency(m);
tri::RequirePerVertexMark(m); tri::RequirePerVertexMark(m);
@ -489,6 +490,7 @@ It is just a simple wrapper of the basic Compute()
{ {
pop_heap(Heap.begin(),Heap.end()); pop_heap(Heap.begin(),Heap.end());
VertexPointer curr = (Heap.back()).v; VertexPointer curr = (Heap.back()).v;
if ((target!=NULL)&&(target==curr))return;
Heap.pop_back(); Heap.pop_back();
std::vector<VertexPointer> vertVec; std::vector<VertexPointer> vertVec;
face::VVStarVF<FaceType>(curr,vertVec); face::VVStarVF<FaceType>(curr,vertVec);