# HG changeset patch # User Matthew Turk # Date 1247597349 14400 # Branch raytrace # Node ID 547d886e82642901ebf83274f14bb69c06184fc6 # Parent b2a83377938656c37e9f0fd6fee1be44e94d47ee This works for random points, but fails for cell-edges. diff -r b2a83377938656c37e9f0fd6fee1be44e94d47ee -r 547d886e82642901ebf83274f14bb69c06184fc6 yt/lagos/RTIntegrator.pyx --- a/yt/lagos/RTIntegrator.pyx Mon Jul 13 09:33:11 2009 -0700 +++ b/yt/lagos/RTIntegrator.pyx Tue Jul 14 14:49:09 2009 -0400 @@ -115,9 +115,11 @@ # Now get the indices of the intersection intersect = u + intersect_t * v for i in range(3): - cur_ind[i] = np.floor((intersect[i] - left_edge[i])/dx[i]) + cur_ind[i] = min(np.floor((intersect[i] - left_edge[i])/dx[i]), + grid_mask.shape[i] - 1) tmax[i] = (((cur_ind[i]+step[i])*dx[i])+left_edge[i]-u[i])/v[i] - if step[i] < 0: cur_ind[i] -= 1 + if step[i] > 0: tmax[i] = (((cur_ind[i]+1)*dx[i])+left_edge[i]-u[i])/v[i] + if step[i] < 0: tmax[i] = (((cur_ind[i]+0)*dx[i])+left_edge[i]-u[i])/v[i] tdelta[i] = abs(dx[i]/v[i]) # The variable intersect contains the point we first pierce the grid enter_t = intersect_t @@ -132,7 +134,7 @@ # 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: + if (tmax[0] >= 1.0) and (tmax[1] >= 1.0) and (tmax[2] >= 1.0): grid_t[cur_ind[0], cur_ind[1], cur_ind[2]] = 1.0 - enter_t break if tmax[0] < tmax[1]: