Revision: 55550
          http://sourceforge.net/p/brlcad/code/55550
Author:   phoenixyjll
Date:     2013-05-23 11:29:36 +0000 (Thu, 23 May 2013)
Log Message:
-----------
Fix return value of ON_Intersect (SSI) - returns the number of intersection 
events (consistent with openNURBS), and add comment to brep.h. Remove the 
uncessary check of OPENNURBS_PLUS_INC_, and reduce debugging messages.

Modified Paths:
--------------
    brlcad/trunk/include/brep.h
    brlcad/trunk/src/libbrep/intersect.cpp
    brlcad/trunk/src/librt/primitives/brep/brep.cpp
    brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp
    brlcad/trunk/src/librt/tests/test_ssi.cpp

Modified: brlcad/trunk/include/brep.h
===================================================================
--- brlcad/trunk/include/brep.h 2013-05-23 04:16:14 UTC (rev 55549)
+++ brlcad/trunk/include/brep.h 2013-05-23 11:29:36 UTC (rev 55550)
@@ -1720,7 +1720,48 @@
 
 /**
  * An overload of ON_Intersect for surface-surface intersection.
+ *
+ * Description:
+ *   Intersect surfaceA with surfaceB.
+ *
+ * Parameters:
+ *   surfaceA - [in]
+ *
+ *   surfaceB - [in]
+ *
+ *   x - [out]
+ *     Intersection events are appended to this array.
+ *
+ *   intersection_tolerance - [in]
+ *     If the input intersection_tolerance <= 0.0, then 0.001 is used.
+ *
+ *   overlap_tolerance - [in]
+ *     If positive, then overlap_tolerance must be
+ *     >= intersection_tolerance and is used to test for
+ *     overlapping regions. If the input
+ *     overlap_tolerance <= 0.0, then 2*intersection_tolerance
+ *     is used.
+ *
+ *   fitting_tolerance - [in]
+ *     If fitting_tolerance is > 0 and >= intersection_tolerance,
+ *     then the intersection curves are fit to this tolerance.
+ *     If input fitting_tolerance <= 0.0 or < intersection_tolerance,
+ *     then intersection_tolerance is used.
+ *
+ *   surfaceA_udomain - [in]
+ *     optional restriction on surfaceA u domain
+ *   surfaceA_vdomain - [in]
+ *     optional restriction on surfaceA v domain
+ *
+ *   surfaceB_udomain - [in]
+ *     optional restriction on surfaceB u domain
+ *   surfaceB_vdomain - [in]
+ *     optional restriction on surfaceB v domain
+ *
+ * Returns:
+ *    Number of intersection events appended to x. -1 for error.
  */
+
 extern BREP_EXPORT int
 ON_Intersect(const ON_Surface* surfA,
             const ON_Surface* surfB,

Modified: brlcad/trunk/src/libbrep/intersect.cpp
===================================================================
--- brlcad/trunk/src/libbrep/intersect.cpp      2013-05-23 04:16:14 UTC (rev 
55549)
+++ brlcad/trunk/src/libbrep/intersect.cpp      2013-05-23 11:29:36 UTC (rev 
55550)
@@ -35,8 +35,6 @@
 
 #include "brep.h"
 
-#if !defined(OPENNURBS_PLUS_INC_)
-
 /**
  * Surface-surface intersections (SSI)
  *
@@ -302,8 +300,6 @@
             const ON_Interval*,
             const ON_Interval*)
 {
-    bu_log("ON_Surface::IntersectSurface() in libbrep is called.\n");
-
     if (surfA == NULL || surfB == NULL) {
        return -1;
     }
@@ -475,10 +471,6 @@
                }
            }
        }
-       /* for (int i = 0; i < curvept.Count(); i++) {
-           bu_log("(%lf %lf %lf)\n", curvept[i].x, curvept[i].y, curvept[i].z);
-       }
-       bu_log("%d %d\n", h, tmp_pairs.size());*/
     }
     bu_log("We get %d intersection bounding boxes.\n", bbox_count);
     bu_log("%d points on the intersection curves.\n", curvept.Count());
@@ -679,11 +671,9 @@
        }
     }
 
-    return 0;
+    return x.Count();
 }
 
-#endif
-
 // Local Variables:
 // tab-width: 8
 // mode: C++

Modified: brlcad/trunk/src/librt/primitives/brep/brep.cpp
===================================================================
--- brlcad/trunk/src/librt/primitives/brep/brep.cpp     2013-05-23 04:16:14 UTC 
(rev 55549)
+++ brlcad/trunk/src/librt/primitives/brep/brep.cpp     2013-05-23 11:29:36 UTC 
(rev 55550)
@@ -4385,7 +4385,7 @@
            ON_ClassArray<ON_SSX_EVENT> events;
            if (ON_Intersect(brep1->m_S[brep1->m_F[i].m_si],
                             brep2->m_S[brep2->m_F[j].m_si],
-                            events))
+                            events) <= 0)
                continue;
            ON_SimpleArray<ON_NurbsCurve *> curve_uv, curve_st;
            for (int k = 0; k < events.Count(); k++) {

Modified: brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp
===================================================================
--- brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp       2013-05-23 
04:16:14 UTC (rev 55549)
+++ brlcad/trunk/src/librt/primitives/brep/brep_debug.cpp       2013-05-23 
11:29:36 UTC (rev 55550)
@@ -2796,7 +2796,7 @@
     brep2->m_S[j]->GetNurbForm(surf2);
 
     ON_ClassArray<ON_SSX_EVENT> events;
-    if (ON_Intersect(&surf1, &surf2, events)) {
+    if (ON_Intersect(&surf1, &surf2, events) < 0) {
        bu_log("Intersection failed\n");
        return -1;
     }

Modified: brlcad/trunk/src/librt/tests/test_ssi.cpp
===================================================================
--- brlcad/trunk/src/librt/tests/test_ssi.cpp   2013-05-23 04:16:14 UTC (rev 
55549)
+++ brlcad/trunk/src/librt/tests/test_ssi.cpp   2013-05-23 11:29:36 UTC (rev 
55550)
@@ -114,7 +114,7 @@
 
     // Run the intersection
     ON_ClassArray<ON_SSX_EVENT> events;
-    if (ON_Intersect(&surf1, &surf2, events)) {
+    if (ON_Intersect(&surf1, &surf2, events) < 0) {
        bu_log("Intersection failed\n");
        return -1;
     }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to