From 965b41fa35dc07d00e9fae0b4ac5c5a85abed6fe Mon Sep 17 00:00:00 2001 From: gdamms Date: Wed, 25 Jan 2023 16:28:36 +0100 Subject: [PATCH] fix: float errors --- src/fvi.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fvi.py b/src/fvi.py index 1342c38..acbc2c6 100644 --- a/src/fvi.py +++ b/src/fvi.py @@ -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