[MOAB-dev] r4302 - in MOAB/trunk: src src/moab test

bmsmith6 at wisc.edu bmsmith6 at wisc.edu
Thu Nov 25 13:03:36 CST 2010


Author: bmsmith
Date: 2010-11-25 13:03:36 -0600 (Thu, 25 Nov 2010)
New Revision: 4302

Modified:
   MOAB/trunk/src/GeomUtil.cpp
   MOAB/trunk/src/moab/GeomUtil.hpp
   MOAB/trunk/test/GeomUtilTests.cpp
Log:
Add pl?\195?\188cker ray-triangle intersection
  -tests for distance limits, orientation, and intersection type
  -I did not change the existing M?\195?\182ller test
  -Pl?\195?\188cker test is slower than M?\195?\182ller test, but consistent for 
   rays close to the edge of a triangle



Modified: MOAB/trunk/src/GeomUtil.cpp
===================================================================
--- MOAB/trunk/src/GeomUtil.cpp	2010-11-24 01:00:22 UTC (rev 4301)
+++ MOAB/trunk/src/GeomUtil.cpp	2010-11-25 19:03:36 UTC (rev 4302)
@@ -104,7 +104,198 @@
   return seg_start <= seg_end;
 }
 
+/* Function to return the vertex with the lowest coordinates. To force the same
+   ray-edge computation, the Plücker test needs to use consistent edge 
+   representation. This would be more simple with MOAB handles instead of 
+   coordinates... */
+inline bool first( const CartVect& a, const CartVect& b) {
+  if(a[0] < b[0]) {
+    return true;
+  } else if(a[0] == b[0]) {
+    if(a[1] < b[1]) {
+      return true;
+    } else if(a[1] == b[1]) {
+      if(a[2] < b[2]) {
+	return true;
+      } else {
+        return false;
+      }
+    } else {
+      return false;
+    }
+  } else {
+    return false;
+  }
+}
 
+/* This test uses the same edge-ray computation for adjacent triangles so that
+   rays passing close to edges/nodes are handled consistently.
+
+   Reports intersection type for post processing of special cases. Optionally 
+   screen by orientation and negative/nonnegative distance limits.
+
+   If screening by orientation, substantial pruning can occur. Indicate
+   desired orientation by passing 1 (forward), -1 (reverse), or 0 (no preference).
+   Note that triangle orientation is not always the same as surface
+   orientation due to non-manifold surfaces.
+
+   N. Platis and T. Theoharis, "Fast Ray-Tetrahedron Intersection using Plücker
+   Coordinates", Journal of Graphics Tools, Vol. 8, Part 4, Pages 37-48 (2003). */
+bool plucker_ray_tri_intersect( const CartVect vertices[3],
+                                const CartVect& origin,
+                                const CartVect& direction,
+                                double /* tolerance */,
+                                double& dist_out,
+                                const double* nonneg_ray_len,


More information about the moab-dev mailing list