[Yt-svn] yt-commit r1367 - trunk/yt/lagos

britton at wrangler.dreamhost.com britton at wrangler.dreamhost.com
Wed Jul 8 16:45:52 PDT 2009


Author: britton
Date: Wed Jul  8 16:45:52 2009
New Revision: 1367
URL: http://yt.spacepope.org/changeset/1367

Log:
The ray-tracer should now be able to handle beginning and end points that are 
not on a grid edge.  It still does not handle beginning and end points that 
are not on cell edges.


Modified:
   trunk/yt/lagos/RTIntegrator.pyx

Modified: trunk/yt/lagos/RTIntegrator.pyx
==============================================================================
--- trunk/yt/lagos/RTIntegrator.pyx	(original)
+++ trunk/yt/lagos/RTIntegrator.pyx	Wed Jul  8 16:45:52 2009
@@ -88,7 +88,7 @@
     cdef np.ndarray tdelta = np.zeros(3, dtype=np.float64) 
     cdef np.ndarray tmax = np.zeros(3, dtype=np.float64) 
     cdef np.ndarray intersect = np.zeros(3, dtype=np.float64) 
-    intersect_t = 1e30
+    intersect_t = 1
     # recall p = v * t + u
     #  where p is position, v is our vector, u is the start point
     for i in range(3):
@@ -111,7 +111,7 @@
        (left_edge[1] <= u[1] <= right_edge[1]) and \
        (left_edge[2] <= u[2] <= right_edge[2]):
         intersect_t = 0
-    if intersect_t > 1e29: return
+    if intersect_t > 1: return
     # Now get the indices of the intersection
     intersect = u + intersect_t * v
     for i in range(3):
@@ -131,6 +131,9 @@
             grid_mask[cur_ind[0], cur_ind[1], cur_ind[2]] = 1
         # Note that we are calculating t on the fly, but we get *negative* t
         # values from what they should be.
+        # If we've reached t = 1, we are done.
+        if tmax[0] > 1 and tmax[1] > 1 and tmax[2] > 1:
+            break
         if tmax[0] < tmax[1]:
             if tmax[0] < tmax[2]:
                 grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = tmax[0] - enter_t



More information about the yt-svn mailing list