Revision: 55793
          http://sourceforge.net/p/brlcad/code/55793
Author:   phoenixyjll
Date:     2013-06-17 14:38:53 +0000 (Mon, 17 Jun 2013)
Log Message:
-----------
The tolerance should be considered in the IsPointIn() test.

Modified Paths:
--------------
    brlcad/trunk/src/libbrep/intersect.cpp

Modified: brlcad/trunk/src/libbrep/intersect.cpp
===================================================================
--- brlcad/trunk/src/libbrep/intersect.cpp      2013-06-15 17:28:43 UTC (rev 
55792)
+++ brlcad/trunk/src/libbrep/intersect.cpp      2013-06-17 14:38:53 UTC (rev 
55793)
@@ -96,9 +96,11 @@
     {
        m_node = bbox;
     }
-    bool IsPointIn(const ON_3dPoint &pt)
+    bool IsPointIn(const ON_3dPoint &pt, double tolerance = 0.0)
     {
-       return m_node.IsPointIn(pt);
+       ON_3dVector vtol(tolerance,tolerance,tolerance);
+       ON_BoundingBox new_bbox(m_node.m_min-vtol, m_node.m_max+vtol);
+       return new_bbox.IsPointIn(pt);
     }
 };
 
@@ -243,7 +245,9 @@
             double tolerance,
             const ON_Interval* curveB_domain)
 {
-    bu_log("PCI called.\n");
+    if (tolerance <= 0.0)
+       tolerance = 0.01;
+
     Subcurve root;
     if (curveB_domain == NULL) {
        root.m_curve = curveB.Duplicate();
@@ -267,7 +271,7 @@
     root.SetBBox(root.m_curve->BoundingBox());
     root.m_islinear = root.m_curve->IsLinear();
 
-    if (!root.IsPointIn(pointA))
+    if (!root.IsPointIn(pointA, tolerance))
        return false;
 
     std::vector<Subcurve*> candidates, next_candidates;
@@ -281,9 +285,9 @@
                next_candidates.push_back(candidates[j]);
            } else {
                if (candidates[j]->Split() == 0) {
-                   if (candidates[j]->m_children[0]->IsPointIn(pointA))
+                   if (candidates[j]->m_children[0]->IsPointIn(pointA, 
tolerance))
                        next_candidates.push_back(candidates[j]->m_children[0]);
-                   if (candidates[j]->m_children[1]->IsPointIn(pointA))
+                   if (candidates[j]->m_children[1]->IsPointIn(pointA, 
tolerance))
                        next_candidates.push_back(candidates[j]->m_children[1]);
                } else
                    next_candidates.push_back(candidates[j]);

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

Reply via email to