modified PerVertexDijsktraCompute to return parent and source for each node
This commit is contained in:
parent
3627a7ccfd
commit
e612b0b2f8
|
@ -582,18 +582,21 @@ It is just a simple wrapper of the basic Compute()
|
|||
static void PerVertexDijsktraCompute(MeshType &m, const std::vector<VertexPointer> &seedVec,
|
||||
DistanceFunctor &distFunc,
|
||||
ScalarType maxDistanceThr = std::numeric_limits<ScalarType>::max(),
|
||||
std::vector<VertexPointer> *InInterval=NULL,bool avoid_selected=false,
|
||||
std::vector<VertexPointer> *InInterval=NULL,
|
||||
typename MeshType::template PerVertexAttributeHandle<VertexPointer> * sourceHandle= NULL,
|
||||
typename MeshType::template PerVertexAttributeHandle<VertexPointer> * parentHandle=NULL,
|
||||
bool avoid_selected=false,
|
||||
VertexPointer target=NULL)
|
||||
{
|
||||
tri::RequireVFAdjacency(m);
|
||||
tri::RequirePerVertexMark(m);
|
||||
tri::RequirePerVertexQuality(m);
|
||||
|
||||
typename MeshType::template PerVertexAttributeHandle<VertexPointer> sourceHandle
|
||||
= tri::Allocator<MeshType>::template GetPerVertexAttribute<VertexPointer>(m, sourcesAttributeName());
|
||||
// typename MeshType::template PerVertexAttributeHandle<VertexPointer> sourceHandle
|
||||
// = tri::Allocator<MeshType>::template GetPerVertexAttribute<VertexPointer>(m, sourcesAttributeName());
|
||||
|
||||
typename MeshType::template PerVertexAttributeHandle<VertexPointer> parentHandle
|
||||
= tri::Allocator<MeshType>::template GetPerVertexAttribute<VertexPointer> (m, parentsAttributeName());
|
||||
// typename MeshType::template PerVertexAttributeHandle<VertexPointer> parentHandle
|
||||
// = tri::Allocator<MeshType>::template GetPerVertexAttribute<VertexPointer> (m, parentsAttributeName());
|
||||
|
||||
std::vector<DIJKDist> Heap;
|
||||
tri::UnMarkAll(m);
|
||||
|
@ -603,8 +606,10 @@ It is just a simple wrapper of the basic Compute()
|
|||
assert(!tri::IsMarked(m,seedVec[i]));
|
||||
tri::Mark(m,seedVec[i]);
|
||||
seedVec[i]->Q()=0;
|
||||
sourceHandle[seedVec[i]]=seedVec[i];
|
||||
parentHandle[seedVec[i]]=seedVec[i];
|
||||
if (sourceHandle!=NULL)
|
||||
(*sourceHandle)[seedVec[i]]=seedVec[i];
|
||||
if (parentHandle!=NULL)
|
||||
(*parentHandle)[seedVec[i]]=seedVec[i];
|
||||
Heap.push_back(DIJKDist(seedVec[i]));
|
||||
if (InInterval!=NULL) InInterval->push_back(seedVec[i]);
|
||||
}
|
||||
|
@ -631,8 +636,10 @@ It is just a simple wrapper of the basic Compute()
|
|||
Heap.push_back(DIJKDist(nextV));
|
||||
push_heap(Heap.begin(),Heap.end());
|
||||
if (InInterval!=NULL) InInterval->push_back(nextV);
|
||||
sourceHandle[nextV] = sourceHandle[curr];
|
||||
parentHandle[nextV] = curr;
|
||||
if (sourceHandle!=NULL)
|
||||
(*sourceHandle)[nextV] = (*sourceHandle)[curr];
|
||||
if (parentHandle!=NULL)
|
||||
(*parentHandle)[nextV] = curr;
|
||||
// printf("Heapsize %i nextDist = %f curr vert %i next vert %i \n",Heap.size(), nextDist, tri::Index(m,curr), tri::Index(m,nextV));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue