[MOAB-dev] r3732 - MOAB/trunk/src
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Wed Mar 31 10:31:43 CDT 2010
Author: kraftche
Date: 2010-03-31 10:31:42 -0500 (Wed, 31 Mar 2010)
New Revision: 3732
Modified:
MOAB/trunk/src/AdaptiveKDTree.cpp
Log:
uncomment commented-out tolerant ray-plane intersection in KDTree
Modified: MOAB/trunk/src/AdaptiveKDTree.cpp
===================================================================
--- MOAB/trunk/src/AdaptiveKDTree.cpp 2010-03-31 14:40:58 UTC (rev 3731)
+++ MOAB/trunk/src/AdaptiveKDTree.cpp 2010-03-31 15:31:42 UTC (rev 3732)
@@ -2047,38 +2047,41 @@
return rval;
const double t = (plane.coord - ray_pt[plane.norm]) / ray_dir[plane.norm];
- if (!finite(t)) { // ray parallel to plane
+ // If ray is parallel to plane...
+ if (!finite(t)) {
if (ray_pt[plane.norm] - tol <= plane.coord)
list.push_back( NodeSeg( children[0], seg.beg, seg.end ) );
if (ray_pt[plane.norm] + tol >= plane.coord)
list.push_back( NodeSeg( children[1], seg.beg, seg.end ) );
}
+ // If ray direction points towards left (below) plane
else if (ray_dir[plane.norm] < 0.0) {
if (seg.beg > t) { // segment left of plane
list.push_back( NodeSeg( children[0], seg.beg, seg.end ) );
-// if (plane.coord - ray_pt[plane.norm] + ray_dir[plane.norm] * seg.beg < tol)
-// list.push_back( NodeSeg( children[1], seg.beg, seg.end ) );
+ if (plane.coord - ray_pt[plane.norm] + ray_dir[plane.norm] * seg.beg < tol)
+ list.push_back( NodeSeg( children[1], seg.beg, seg.end ) );
}
else if (seg.end < t) { // segment right of plane
list.push_back( NodeSeg( children[1], seg.beg, seg.end ) );
-// if (ray_pt[plane.norm] + ray_dir[plane.norm] * seg.end - plane.coord < tol)
-// list.push_back( NodeSeg( children[0], seg.beg, seg.end ) );
+ if (ray_pt[plane.norm] + ray_dir[plane.norm] * seg.end - plane.coord < tol)
+ list.push_back( NodeSeg( children[0], seg.beg, seg.end ) );
}
else { // segment crosses plane
list.push_back( NodeSeg( children[1], seg.beg, t ) );
list.push_back( NodeSeg( children[0], t, seg.end ) );
}
}
+ // If ray direction points towards right (above) plane
else {
if (seg.beg > t) { // segment right of plane
list.push_back( NodeSeg( children[1], seg.beg, seg.end ) );
-// if (ray_pt[plane.norm] + ray_dir[plane.norm] * seg.beg - plane.coord < tol)
-// list.push_back( NodeSeg( children[0], seg.beg, seg.end ) );
+ if (ray_pt[plane.norm] + ray_dir[plane.norm] * seg.beg - plane.coord < tol)
+ list.push_back( NodeSeg( children[0], seg.beg, seg.end ) );
}
else if (seg.end < t) { // segment left of plane
list.push_back( NodeSeg( children[0], seg.beg, seg.end ) );
-// if (plane.coord - ray_pt[plane.norm] + ray_dir[plane.norm] * seg.end < tol)
-// list.push_back( NodeSeg( children[1], seg.beg, seg.end ) );
+ if (plane.coord - ray_pt[plane.norm] + ray_dir[plane.norm] * seg.end < tol)
+ list.push_back( NodeSeg( children[1], seg.beg, seg.end ) );
}
else { // segment crosses plane
list.push_back( NodeSeg( children[0], seg.beg, t ) );
More information about the moab-dev
mailing list