[MOAB-dev] commit/MOAB: iulian07: fix correctly the bug in KDTree

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jul 24 18:11:36 CDT 2013


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/829bc139f5f6/
Changeset:   829bc139f5f6
Branch:      master
User:        iulian07
Date:        2013-07-25 01:06:58
Summary:     fix correctly the bug in KDTree
the ray_end in "intersect triangles" method
 can be reset if we already have (max_ints) intx points found,
to the last value in the sorted distance array.
In that case, any boxes beyond ray_end will not be searched;
the method will return the closest max_ints intersection distances
from the origin of the ray, ordered

Affected #:  1 file

diff --git a/src/AdaptiveKDTree.cpp b/src/AdaptiveKDTree.cpp
index 16599fa..253440b 100644
--- a/src/AdaptiveKDTree.cpp
+++ b/src/AdaptiveKDTree.cpp
@@ -2033,7 +2033,10 @@ ErrorCode AdaptiveKDTree::ray_intersect_triangles( EntityHandle root,
               }
               tris_out[w] = *iter;
               dists_out[w] = tri_t;
-              //ray_end = dists_out.back();
+              if (tris_out.size() >= (unsigned)max_ints)
+                // when we have already reached the max intx points, we cans safely reset
+                // ray_end, because we will accept new points only "closer" than the last one
+                ray_end = dists_out.back();
             }
           }
         }

Repository URL: https://bitbucket.org/fathomteam/moab/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the moab-dev mailing list