[MOAB-dev] r4186 - in MOAB/trunk: examples src src/moab test/obb

sjackson at cae.wisc.edu sjackson at cae.wisc.edu
Thu Sep 30 14:50:55 CDT 2010


Author: sjackson
Date: 2010-09-30 14:50:54 -0500 (Thu, 30 Sep 2010)
New Revision: 4186

Modified:
   MOAB/trunk/examples/ObbTree.cpp
   MOAB/trunk/src/OrientedBoxTreeTool.cpp
   MOAB/trunk/src/moab/OrientedBoxTreeTool.hpp
   MOAB/trunk/test/obb/obb_test.cpp
   MOAB/trunk/test/obb/obb_time.cpp
Log:
Make OBB Tree's ray_intersect_triangles() return handles of intersected tris

Modified: MOAB/trunk/examples/ObbTree.cpp
===================================================================
--- MOAB/trunk/examples/ObbTree.cpp	2010-09-30 02:35:31 UTC (rev 4185)
+++ MOAB/trunk/examples/ObbTree.cpp	2010-09-30 19:50:54 UTC (rev 4186)
@@ -52,9 +52,10 @@
   
   // do ray-tracing from box center to x direction
   std::vector<double> intersections;
+  std::vector<moab::EntityHandle> intersection_facets;
   double dir[3] = {1., 0., 0.};
-  rval = tool.ray_intersect_triangles(intersections, tree_root,
-				      10e-12, box_center, dir,
+  rval = tool.ray_intersect_triangles(intersections, intersection_facets, 
+				      tree_root, 10e-12, box_center, dir,
 				      &ray_length);
   if (rval != moab::MB_SUCCESS) {
     std::cerr << "Couldn't ray tracing.";

Modified: MOAB/trunk/src/OrientedBoxTreeTool.cpp
===================================================================
--- MOAB/trunk/src/OrientedBoxTreeTool.cpp	2010-09-30 02:35:31 UTC (rev 4185)
+++ MOAB/trunk/src/OrientedBoxTreeTool.cpp	2010-09-30 19:50:54 UTC (rev 4186)
@@ -710,6 +710,7 @@
 
 ErrorCode OrientedBoxTreeTool::ray_intersect_triangles( 
                           std::vector<double>& intersection_distances_out,
+                          std::vector<EntityHandle>& intersection_facets_out,
                           const Range& boxes,
                           double tolerance,
                           const double ray_point[3],
@@ -766,8 +767,10 @@
       if( raytri_test_count ) *raytri_test_count += 1; 
 
       double td;
-      if (GeomUtil::ray_tri_intersect( coords, point, dir, tolerance, td, ray_length ))
+      if (GeomUtil::ray_tri_intersect( coords, point, dir, tolerance, td, ray_length )){
         intersection_distances_out.push_back(td);
+        intersection_facets_out.push_back( *t );
+      }
     }
   }
   
@@ -776,6 +779,7 @@
 
 ErrorCode OrientedBoxTreeTool::ray_intersect_triangles( 
                           std::vector<double>& intersection_distances_out,
+                          std::vector<EntityHandle>& intersection_facets_out,
                           EntityHandle root_set,
                           double tolerance,
                           const double ray_point[3],
@@ -790,7 +794,7 @@


More information about the moab-dev mailing list