Commit 9ed294c9 authored by Jan Möbius's avatar Jan Möbius
Browse files

Make Hausdorff module thread safe. Removed static point vector. (Thanks to...

Make Hausdorff module thread safe. Removed static point vector. (Thanks to Falko Löffler for the fix)

git-svn-id: fdac6126-5c0c-442c-9429-916003d36597
parent feaf69d4
......@@ -203,7 +203,6 @@ float
collapse_priority(const CollapseInfo& _ci)
static Points points; points.clear();
std::vector<FaceHandle> faces; faces.reserve(20);
typename Mesh::VertexFaceIter vf_it;
typename Mesh::FaceHandle fh;
......@@ -211,6 +210,9 @@ collapse_priority(const CollapseInfo& _ci)
typename Mesh::CFVIter fv_it;
bool ok;
// Clear the temporary point storage
// collect all points to be tested
// collect all faces to be tested against
for (vf_it=mesh_.vf_iter(_ci.v0); vf_it; ++vf_it) {
......@@ -220,16 +222,15 @@ collapse_priority(const CollapseInfo& _ci)
Points& pts =, fh);
std::copy(pts.begin(), pts.end(), std::back_inserter(points));
std::copy(pts.begin(), pts.end(), std::back_inserter(tmp_points_));
// add point to be removed
// setup iterators
typename std::vector<FaceHandle>::iterator fh_it, fh_end(faces.end());
typename Points::const_iterator p_it, p_end(points.end());
typename Points::const_iterator p_it, p_end(tmp_points_.end());
// simulate collapse
mesh_.set_point(_ci.v0, _ci.p1);
......@@ -237,7 +238,7 @@ collapse_priority(const CollapseInfo& _ci)
// for each point: try to find a face such that error is < tolerance
ok = true;
for (p_it=points.begin(); ok && p_it!=p_end; ++p_it) {
for (p_it=tmp_points_.begin(); ok && p_it!=p_end; ++p_it) {
ok = false;
for (fh_it=faces.begin(); !ok && fh_it!=fh_end; ++fh_it) {
......@@ -137,7 +137,10 @@ class ModHausdorffT: public ModBaseT<MeshT> {
Mesh& mesh_;
/// Temporary point storage
Points tmp_points_;
Mesh& mesh_;
Scalar tolerance_;
OpenMesh::FPropHandleT<Points> points_;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment