fix: float errors

This commit is contained in:
gdamms 2023-01-25 16:28:36 +01:00
parent a7e7432239
commit 965b41fa35

View file

@ -50,6 +50,8 @@ def fast_voxel_intersect(start, end, origin, step, shape) -> tuple[list, list, l
while True:
# Compute the distance to the next boundaries
next_boundaries = np.divide(position + step * direction_signs, step)
errored = np.abs(np.round(next_boundaries) - next_boundaries) < 1e-12
next_boundaries[errored] = np.round(next_boundaries[errored])
distances = ((1 - is_negative) * np.floor(next_boundaries) +
is_negative * np.ceil(next_boundaries)) * step - position