[MOAB-dev] create ray_intersect_all_sets function
Hongjun Kim
hongjun at mcs.anl.gov
Mon Apr 5 17:16:49 CDT 2010
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)
More information about the moab-dev
mailing list