From a8f7307623b5516d736db4bdff7cb53816c2ce12 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 3 Nov 2010 16:58:14 +0000 Subject: [PATCH] reset MElement::tolerance to the correct value --- Geo/MElementOctree.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Geo/MElementOctree.cpp b/Geo/MElementOctree.cpp index 9e2d94aa50..895e866e30 100644 --- a/Geo/MElementOctree.cpp +++ b/Geo/MElementOctree.cpp @@ -80,11 +80,10 @@ MElementOctree::MElementOctree(GModel *m) : _gm(m) MElementOctree::MElementOctree(std::vector<MElement*> &v) { - _gm = 0; SBoundingBox3d bb; for (unsigned int i = 0; i < v.size(); i++){ for(int j = 0; j < v[i]->getNumVertices(); j++){ - if (!_gm)_gm = v[i]->getVertex(j)->onWhat()->model(); + if (!_gm) _gm = v[i]->getVertex(j)->onWhat()->model(); bb += SPoint3(v[i]->getVertex(j)->x(), v[i]->getVertex(j)->y(), v[i]->getVertex(j)->z()); @@ -118,9 +117,9 @@ MElement *MElementOctree::find(double x, double y, double z, int dim) MElement *e = (MElement*)Octree_Search(P, _octree); if (!e){ - double initialTol = 1.e-6; + double initialTol = MElement::getTolerance(); double tol = initialTol; - while ( tol < .1){ + while (tol < .1){ tol *= 10; MElement::setTolerance(tol); std::vector<GEntity*> entities; @@ -143,7 +142,7 @@ MElement *MElementOctree::find(double x, double y, double z, int dim) if (dim == -1 || !e || e->getDim() == dim) return e; std::list<void*> l; - Octree_SearchAll (P, _octree, &l); + Octree_SearchAll(P, _octree, &l); for (std::list<void*>::iterator it = l.begin(); it != l.end(); it++) { MElement *el = (MElement*) *it; if (el->getDim() == dim) @@ -151,4 +150,3 @@ MElement *MElementOctree::find(double x, double y, double z, int dim) } return NULL; } - -- GitLab