}
std::map<double, const gp_XYZ*> dist2nodes;
- aQuadtree->NodesAround(thePoint, dist2nodes, 1.0);
+ aQuadtree->NodesAround(thePoint, dist2nodes, aQuadtree->getPrecision());
+ while (dist2nodes.size() == 0)
+ {
+ aQuadtree->setPrecision(aQuadtree->getPrecision() *2);
+ DEBTRACE("adjust precision to: " << aQuadtree->getPrecision());
+ aQuadtree->NodesAround(thePoint, dist2nodes, aQuadtree->getPrecision());
+ }
+ aQuadtree->NodesAround(thePoint, dist2nodes, 5.0);
if (dist2nodes.size())
{
std::map<double, const gp_XYZ*>::const_iterator it = dist2nodes.begin();
aResAltitude = it->second->Z();
- //DEBTRACE(" number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude);
+ DEBTRACE(" number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude);
+ }
+ else
+ {
+ DEBTRACE(" number of points found: 0");
}
return aResAltitude;
const int maxLevel,
const int maxNbNodes,
const double minBoxSize) :
- HYDROData_Quadtree(new Limit(maxLevel, minBoxSize, maxNbNodes)), myNodes(theNodes)
+ HYDROData_Quadtree(new Limit(maxLevel, minBoxSize, maxNbNodes)), myNodes(theNodes), myPrecision(0.25)
{
DEBTRACE("---------------------------- HYDROData_QuadtreeNode root constructor");
if (myNodes)
* \brief Constructor used to allocate a child
*/
HYDROData_QuadtreeNode::HYDROData_QuadtreeNode() :
- HYDROData_Quadtree()
+ HYDROData_Quadtree(), myNodes(0), myPrecision(0.25)
{
- if (myNodes == 0)
- myNodes = new Nodes_3D();
+ myNodes = new Nodes_3D();
}
/*!
//! tells us if the tree as already bin computed
bool isEmpty() const { return myChildren == 0; }
+ inline double getPrecision() {return myPrecision; }
+ inline double setPrecision(double precision) {myPrecision = precision; }
+
protected:
struct Limit: public HYDROData_TreeLimit
//! The set of nodes inside the box of the Quadtree (Empty if Quadtree is not a leaf)
Nodes_3D* myNodes;
+
+ //! distance to look for nearest nodes
+ double myPrecision;
};
#endif