added cutoff distance to geodesic computations
This commit is contained in:
parent
2b9a2a7249
commit
e66769545e
|
@ -173,9 +173,10 @@ class Geo{
|
||||||
*/
|
*/
|
||||||
static VertexPointer Visit(
|
static VertexPointer Visit(
|
||||||
MeshType & m,
|
MeshType & m,
|
||||||
std::vector<VertDist> & _inputfrontier,
|
std::vector<VertDist> & seedVec,
|
||||||
ScalarType & max_distance,
|
ScalarType & max_distance,
|
||||||
bool farthestOnBorder = false,
|
bool farthestOnBorder = false,
|
||||||
|
ScalarType distance_threshold = std::numeric_limits<ScalarType>::max(),
|
||||||
typename MeshType::template PerVertexAttributeHandle<VertexPointer> * sources = NULL
|
typename MeshType::template PerVertexAttributeHandle<VertexPointer> * sources = NULL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -196,12 +197,12 @@ class Geo{
|
||||||
|
|
||||||
//Requirements
|
//Requirements
|
||||||
assert(m.HasVFTopology());
|
assert(m.HasVFTopology());
|
||||||
assert(!_inputfrontier.empty());
|
assert(!seedVec.empty());
|
||||||
|
|
||||||
TempDataType * TD;
|
TempDataType * TD;
|
||||||
TD = new TempDataType(m.vert,unreached);
|
TD = new TempDataType(m.vert,unreached);
|
||||||
|
|
||||||
for(ifr = _inputfrontier.begin(); ifr != _inputfrontier.end(); ++ifr){
|
for(ifr = seedVec.begin(); ifr != seedVec.end(); ++ifr){
|
||||||
(*TD)[(*ifr).v].d = 0.0;
|
(*TD)[(*ifr).v].d = 0.0;
|
||||||
(*ifr).d = 0.0;
|
(*ifr).d = 0.0;
|
||||||
(*TD)[(*ifr).v].source = (*ifr).v;
|
(*TD)[(*ifr).v].source = (*ifr).v;
|
||||||
|
@ -215,7 +216,7 @@ class Geo{
|
||||||
max_distance=0.0;
|
max_distance=0.0;
|
||||||
typename std::vector<VertDist >:: iterator iv;
|
typename std::vector<VertDist >:: iterator iv;
|
||||||
|
|
||||||
while(!frontier.empty())
|
while(!frontier.empty() && max_distance < distance_threshold)
|
||||||
{
|
{
|
||||||
pop_heap(frontier.begin(),frontier.end(),pred());
|
pop_heap(frontier.begin(),frontier.end(),pred());
|
||||||
curr = (frontier.back()).v;
|
curr = (frontier.back()).v;
|
||||||
|
@ -303,6 +304,7 @@ public:
|
||||||
std::vector<VertexPointer> & fro,
|
std::vector<VertexPointer> & fro,
|
||||||
VertexPointer & farthest,
|
VertexPointer & farthest,
|
||||||
ScalarType & distance,
|
ScalarType & distance,
|
||||||
|
ScalarType distance_thr = std::numeric_limits<ScalarType>::max(),
|
||||||
typename MeshType::template PerVertexAttributeHandle<VertexPointer> * sources = NULL){
|
typename MeshType::template PerVertexAttributeHandle<VertexPointer> * sources = NULL){
|
||||||
|
|
||||||
typename std::vector<VertexPointer>::iterator fi;
|
typename std::vector<VertexPointer>::iterator fi;
|
||||||
|
@ -311,7 +313,7 @@ public:
|
||||||
|
|
||||||
for( fi = fro.begin(); fi != fro.end() ; ++fi)
|
for( fi = fro.begin(); fi != fro.end() ; ++fi)
|
||||||
fr.push_back(VertDist(*fi,0.0));
|
fr.push_back(VertDist(*fi,0.0));
|
||||||
farthest = Visit(m,fr,distance,false,sources);
|
farthest = Visit(m,fr,distance,false,distance_thr,sources);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -322,11 +324,12 @@ public:
|
||||||
static void FarthestVertex( MeshType & m,
|
static void FarthestVertex( MeshType & m,
|
||||||
VertexPointer seed,
|
VertexPointer seed,
|
||||||
VertexPointer & farthest,
|
VertexPointer & farthest,
|
||||||
ScalarType & distance){
|
ScalarType & distance,
|
||||||
std::vector<VertexPointer> fro;
|
ScalarType distance_thr = std::numeric_limits<ScalarType>::max()){
|
||||||
fro.push_back( seed );
|
std::vector<VertexPointer> seedVec;
|
||||||
|
seedVec.push_back( seed );
|
||||||
VertexPointer v0;
|
VertexPointer v0;
|
||||||
FarthestVertex(m,fro,v0,distance);
|
FarthestVertex(m,seedVec,v0,distance,distance_thr);
|
||||||
farthest = v0;
|
farthest = v0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +338,7 @@ public:
|
||||||
Note: update the field Q() of the vertices
|
Note: update the field Q() of the vertices
|
||||||
*/
|
*/
|
||||||
static void FarthestBVertex(MeshType & m,
|
static void FarthestBVertex(MeshType & m,
|
||||||
std::vector<VertexPointer> & fro,
|
std::vector<VertexPointer> & seedVec,
|
||||||
VertexPointer & farthest,
|
VertexPointer & farthest,
|
||||||
ScalarType & distance,
|
ScalarType & distance,
|
||||||
typename MeshType::template PerVertexAttributeHandle<VertexPointer> * sources = NULL
|
typename MeshType::template PerVertexAttributeHandle<VertexPointer> * sources = NULL
|
||||||
|
@ -344,7 +347,7 @@ public:
|
||||||
typename std::vector<VertexPointer>::iterator fi;
|
typename std::vector<VertexPointer>::iterator fi;
|
||||||
std::vector<VertDist>fr;
|
std::vector<VertDist>fr;
|
||||||
|
|
||||||
for( fi = fro.begin(); fi != fro.end() ; ++fi)
|
for( fi = seedVec.begin(); fi != seedVec.end() ; ++fi)
|
||||||
fr.push_back(VertDist(*fi,-1));
|
fr.push_back(VertDist(*fi,-1));
|
||||||
farthest = Visit(m,fr,distance,true,sources);
|
farthest = Visit(m,fr,distance,true,sources);
|
||||||
}
|
}
|
||||||
|
@ -382,7 +385,7 @@ public:
|
||||||
|
|
||||||
tri::UpdateQuality<CMeshO>::VertexConstant(m,0);
|
tri::UpdateQuality<CMeshO>::VertexConstant(m,0);
|
||||||
|
|
||||||
return FarthestVertex(m,fro,farthest,distance,sources);
|
return FarthestVertex(m,fro,farthest,distance,std::numeric_limits<ScalarType>::max(),sources);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue