-- Don't use a cube on the boundary if we can help it. This
-- returns cube #1 if we would have returned cube #0 and cube #1
-- exists.
- | coord == offset && (xsize > 0 && ysize > 0 && zsize > 0) = 1
| coord < offset = 0
+ | coord == offset && (xsize > 1 && ysize > 1 && zsize > 1) = 1
| otherwise = (ceiling ( (coord + offset) / cube_width )) - 1
where
(xsize, ysize, zsize) = dims (function_values g)
zoom_result g (sfx, sfy, sfz) (R.Z R.:. i R.:. j R.:. k) =
f p
where
- i' = (fromIntegral i) / (fromIntegral sfx)
- j' = (fromIntegral j) / (fromIntegral sfy)
- k' = (fromIntegral k) / (fromIntegral sfz)
+ offset = (h g)/2
+ i' = (fromIntegral i) / (fromIntegral sfx) - offset
+ j' = (fromIntegral j) / (fromIntegral sfy) - offset
+ k' = (fromIntegral k) / (fromIntegral sfz) - offset
p = (i', j', k') :: Point
c = find_containing_cube g p
t = find_containing_tetrahedron c p