Revision: 55806
          http://sourceforge.net/p/brlcad/code/55806
Author:   phoenixyjll
Date:     2013-06-20 12:57:54 +0000 (Thu, 20 Jun 2013)
Log Message:
-----------
Use a smaller depth for PSI to improve performance.

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

Modified: brlcad/trunk/src/libbrep/intersect.cpp
===================================================================
--- brlcad/trunk/src/libbrep/intersect.cpp      2013-06-20 12:37:29 UTC (rev 
55805)
+++ brlcad/trunk/src/libbrep/intersect.cpp      2013-06-20 12:57:54 UTC (rev 
55806)
@@ -345,6 +345,12 @@
 // intersections defined by openNURBS (see other/openNURBS/opennurbs_curve.h)
 #define PSI_DEFAULT_TOLERANCE 0.001
 
+// The default maximal depth for creating a surfacee tree (8) is way too
+// much - killing performance. Since it's only used for getting an
+// estimation, and we use Newton iterations afterwards, it's reasonable
+// to use a smaller depth in this step.
+#define MAX_PSI_DEPTH 4
+
 bool
 ON_Intersect(const ON_3dPoint& pointA,
             const ON_Surface& surfaceB,
@@ -372,16 +378,17 @@
     brep->AddSurface(surfaceB.Duplicate());
     brep->NewFace(0);
     ON_2dPoint closest_point_uv;
-    if (brlcad::get_closest_point(closest_point_uv, brep->Face(0), pointA) == 
false) {
+    brlcad::SurfaceTree *tree = new brlcad::SurfaceTree(brep->Face(0), true, 
MAX_PSI_DEPTH);
+    if (brlcad::get_closest_point(closest_point_uv, brep->Face(0), pointA, 
tree) == false) {
        delete brep;
+       delete tree;
        return false;
     }
 
     delete brep;
+    delete tree;
 
     ON_3dPoint closest_point_3d = surfaceB.PointAt(closest_point_uv.x, 
closest_point_uv.y);
-    bu_log("%lf %lf %lf\n", pointA.x, pointA.y, pointA.z);
-    bu_log("%lf %lf %lf\n", closest_point_3d.x, closest_point_3d.y, 
closest_point_3d.z);
     if (pointA.DistanceTo(closest_point_3d) <= tolerance
        && u_domain.Includes(closest_point_uv.x)
        && v_domain.Includes(closest_point_uv.y)) {

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