# HG changeset patch # User Britton Smith # Date 1247096752 25200 # Branch trunk # Node ID 3b037108ef0ea89914009142b1e8ecaf70e1121c # Parent 13bc25d9c7e68124d74e7d3ff85dc0475a12cc37 [svn r1367] 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. diff -r 13bc25d9c7e68124d74e7d3ff85dc0475a12cc37 -r 3b037108ef0ea89914009142b1e8ecaf70e1121c yt/lagos/RTIntegrator.pyx --- a/yt/lagos/RTIntegrator.pyx Wed Jul 08 11:00:16 2009 -0700 +++ b/yt/lagos/RTIntegrator.pyx Wed Jul 08 16:45:52 2009 -0700 @@ -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