[MOAB-dev] create ray_intersect_all_sets function

hongjun at mcs.anl.gov hongjun at mcs.anl.gov
Tue Apr 6 09:01:55 CDT 2010


There might be performance differences because multiple calling of "ray_intersect_sets" does tree searches and some triangle intersection checks multiple times.

Moreover, for complex geometry, I think we don't know which surfaces will have multiple hits and where we have to call "ray_intersect_sets" again.

Hong-Jun

----- Original Message -----
From: "Paul Wilson" <wilsonp at engr.wisc.edu>
To: "Hongjun Kim" <hongjun at mcs.anl.gov>
Cc: "Jason Kraftcheck" <kraftche at cae.wisc.edu>, moab-dev at mcs.anl.gov
Sent: Monday, April 5, 2010 10:32:14 PM GMT -06:00 US/Canada Central
Subject: Re: [MOAB-dev] create ray_intersect_all_sets function

Hi all, 

I am not sure how this is different from calling ray_intersect_sets multiple times, one after the other? This would march along the ray and find all the intersections. Is it just a performance issue? 

Paul 

Hongjun Kim wrote: 

Your patch is working for me.
Are you going to commit it or do you want me to do it?
Thanks.

Hong-Jun

----- Original Message -----
From: "Jason Kraftcheck" <kraftche at cae.wisc.edu> To: hongjun at mcs.anl.gov Cc: "Brandon Smith" <bsmith82 at yahoo.com> , moab-dev at mcs.anl.gov Sent: Monday, April 5, 2010 3:00:14 PM GMT -06:00 US/Canada Central
Subject: Re: [MOAB-dev] create ray_intersect_all_sets function hongjun at mcs.anl.gov wrote: 

To find all surface sets intersected (including multiple hits for one
surface set), I have to give large tolerance. If it is not, it just find
the first intersections for each surface set. Specifying a large tolerance to obtain all intersections is a suboptimal
solution.  You might as well just test all of the triangles against the ray.

However, rather than adding 200 lines of duplicated functionality, why not
just fix the existing code such that it can return multiple intersections.
For example, see the attached patch.

- jason


Index: src/OrientedBoxTreeTool.cpp
===================================================================
--- src/OrientedBoxTreeTool.cpp	(revision 3740)
+++ src/OrientedBoxTreeTool.cpp	(working copy)
@@ -950,6 +950,14 @@
 
 void RayIntersectSets::add_intersection( double t, EntityHandle facet )
 {
+    // If minTolInt is less than zero, return all intersections
+  if (minTolInt < 0 && t > -tol) {
+    intersections.push_back(t);
+    sets.push_back(lastSet);
+    facets.push_back(facet);
+    return;
+  }
+
     // Check if the 'len' pointer is pointing into the intersection
     // list.  If this is the case, then the list contains, at that
     // location, an intersection greater than the tolerance away from
Index: src/moab/OrientedBoxTreeTool.hpp
===================================================================
--- src/moab/OrientedBoxTreeTool.hpp	(revision 3740)
+++ src/moab/OrientedBoxTreeTool.hpp	(working copy)
@@ -233,6 +233,9 @@
      *                     ray start point is less than this number, the next closest
      *                     intersection.  If the desired result is only the closest
      *                     intersection, pass zero for this argument.
+     *                     This function will return all intersections, regardless
+     *                     of distance from the start of the ray, if this value
+     *                     is negative.
      *\param tolerance     The tolerance to use in intersection checks.
      *\param ray_point     The base point of the ray.
      *\param unit_ray_dir  The ray direction vector (must be unit length) 
-- 
Paul Wilson

-- ------------------------------------------------------------------ --
Paul P.H. Wilson              419 Engineering Research Building wilsonp at engr.wisc.edu 1500 Engineering Dr
ph/fax: 608/263-0807                          Madison, WI 53706

           My calendar: http://bit.ly/pphw-calendar Computational Nuclear Engineering Research Group http://cnerg.engr.wisc.edu Associate Professor, Nuclear Engineering
              Engineering Physics Department http://www.engr.wisc.edu/ep Chair, Energy Analysis & Policy Certificate
         Nelson Institute for Environmental Studies http://nelson.wisc.edu/eap/ Contributing to the joy and improvement
                  of all those around me 


More information about the moab-dev mailing list