[MOAB-dev] r1563 - MOAB/trunk
kraftche at mcs.anl.gov
kraftche at mcs.anl.gov
Fri Jan 25 13:55:30 CST 2008
Author: kraftche
Date: 2008-01-25 13:55:30 -0600 (Fri, 25 Jan 2008)
New Revision: 1563
Modified:
MOAB/trunk/MBAdaptiveKDTree.cpp
MOAB/trunk/MBAdaptiveKDTree.hpp
Log:
Add tolerance value to kD-tree neighbor-search
o tolerance on test if projection of two leaves onto an axis overlap
o a negative value can be used to eliminate edge-adjacent or corner-adjacnet
neighbors
Modified: MOAB/trunk/MBAdaptiveKDTree.cpp
===================================================================
--- MOAB/trunk/MBAdaptiveKDTree.cpp 2008-01-25 16:59:41 UTC (rev 1562)
+++ MOAB/trunk/MBAdaptiveKDTree.cpp 2008-01-25 19:55:30 UTC (rev 1563)
@@ -534,7 +534,8 @@
MBErrorCode MBAdaptiveKDTreeIter::get_neighbors(
MBAdaptiveKDTree::Axis norm, bool neg,
- std::vector<MBAdaptiveKDTreeIter>& results ) const
+ std::vector<MBAdaptiveKDTreeIter>& results,
+ double epsilon ) const
{
StackObj node, parent;
MBErrorCode rval;
@@ -616,9 +617,9 @@
iter.mBox[1-neg][plane.norm] = plane.coord;
}
// if left child is adjacent
- else if (this->mBox[BMIN][plane.norm] < plane.coord) {
+ else if (this->mBox[BMIN][plane.norm] - plane.coord <= epsilon) {
// if right child is also adjacent, add to list
- if (this->mBox[BMAX][plane.norm] > plane.coord) {
+ if (plane.coord - this->mBox[BMAX][plane.norm] <= epsilon) {
list.push_back( iter );
list.back().mStack.push_back( StackObj( iter.childVect[1], iter.mBox[BMIN][plane.norm] ) );
list.back().mBox[BMIN][plane.norm] = plane.coord;
@@ -633,7 +634,7 @@
else {
// if left child is not adjacent, right must be or something
// is really messed up.
- assert(this->mBox[BMAX][plane.norm] > plane.coord);
+ assert(plane.coord - this->mBox[BMAX][plane.norm] <= epsilon);
// continue with left child
node.entity = iter.childVect[1];
node.coord = iter.mBox[BMIN][plane.norm];
Modified: MOAB/trunk/MBAdaptiveKDTree.hpp
===================================================================
--- MOAB/trunk/MBAdaptiveKDTree.hpp 2008-01-25 16:59:41 UTC (rev 1562)
+++ MOAB/trunk/MBAdaptiveKDTree.hpp 2008-01-25 19:55:30 UTC (rev 1563)
@@ -304,10 +304,22 @@
//! E.g. if norm == Y and neg == false, then get neighbor(s)
//! adjacent to the side of the box with y = maximum y of bounding box.
//!
- //! Results are appended to list. This function does not clear any
- //! existing values in the 'results' vector.
+ //!\param norm Normal vector for box side (X, Y, or Z)
+ //!\param neg Which of two planes with norm (true->smaller coord,
+ //! false->larget coord)
+ //!\param results List to which to append results. This function does
+ //! *not* clear existing values in list.
+ //!\param epsilon Tolerance on overlap. A positive value E will
+ //! result in nodes that are separated by as much as E
+ //! to be considered touching. A negative value -E will
+ //! cause leaves that do not overlap by at least E to be
+ //! considered non-overlapping. Amongst other things,
+ //! this value can be used to control whether or not
+ //! leaves adjacent at only their edges or corners are
+ //! returned.
MBErrorCode get_neighbors( MBAdaptiveKDTree::Axis norm, bool neg,
- std::vector<MBAdaptiveKDTreeIter>& results ) const;
+ std::vector<MBAdaptiveKDTreeIter>& results,
+ double epsilon = 0.0 ) const;
//! Get split plane that separates this node from its immediate sibling.
MBErrorCode get_parent_split_plane( MBAdaptiveKDTree::Plane& plane ) const;
More information about the moab-dev
mailing list