Revision: 55847
http://sourceforge.net/p/brlcad/code/55847
Author: phoenixyjll
Date: 2013-06-26 02:59:09 +0000 (Wed, 26 Jun 2013)
Log Message:
-----------
Add tolerance in the bounding box intersections.
Modified Paths:
--------------
brlcad/trunk/src/libbrep/intersect.cpp
Modified: brlcad/trunk/src/libbrep/intersect.cpp
===================================================================
--- brlcad/trunk/src/libbrep/intersect.cpp 2013-06-25 21:52:09 UTC (rev
55846)
+++ brlcad/trunk/src/libbrep/intersect.cpp 2013-06-26 02:59:09 UTC (rev
55847)
@@ -102,10 +102,12 @@
ON_BoundingBox new_bbox(m_node.m_min-vtol, m_node.m_max+vtol);
return new_bbox.IsPointIn(pt);
}
- bool Intersect(const Subcurve& other) const
+ bool Intersect(const Subcurve& other, double tolerance = 0.0) const
{
+ ON_3dVector vtol(tolerance,tolerance,tolerance);
+ ON_BoundingBox new_bbox(m_node.m_min-vtol, m_node.m_max+vtol);
ON_BoundingBox intersection;
- return intersection.Intersection(m_node, other.m_node);
+ return intersection.Intersection(new_bbox, other.m_node);
}
};
@@ -559,7 +561,7 @@
typedef std::vector<std::pair<Subcurve*, Subcurve*> > NodePairs;
NodePairs candidates, next_candidates;
- if (rootA.Intersect(rootB))
+ if (rootA.Intersect(rootB, intersection_tolerance))
candidates.push_back(std::make_pair(&rootA, &rootB));
// Use sub-division and bounding box intersections first.
@@ -583,7 +585,7 @@
}
for (unsigned int j = 0; j < splittedA.size(); j++)
for (unsigned int k = 0; k < splittedB.size(); k++)
- if (splittedA[j]->Intersect(*splittedB[k]))
+ if (splittedA[j]->Intersect(*splittedB[k],
intersection_tolerance))
next_candidates.push_back(std::make_pair(splittedA[j],
splittedB[k]));
}
candidates = next_candidates;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits