From 1026f17a3e9c24bfcab0ddd0b63b9dd72ca3641d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 4 Feb 2024 07:56:20 +0100 Subject: w --- editor/tests/raycast-test.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'editor/tests') diff --git a/editor/tests/raycast-test.cpp b/editor/tests/raycast-test.cpp index 199c70ba..1dcf1262 100644 --- a/editor/tests/raycast-test.cpp +++ b/editor/tests/raycast-test.cpp @@ -479,10 +479,16 @@ struct raycast_test : base_test } else if (k == nsteps) { - auto sign_long = sign_(V[long_axis]); - pos[long_axis] -= (int)(size[long_axis]/4) * sign_long; - size[long_axis] -= size[long_axis]/2; - size[long_axis] += tile_size.x() / 2; + constexpr auto add = (tile_size.x()+1)/2, + min_size = tile_size.x() + add; + if (size[long_axis] > min_size) + { + auto sign = sign_(V[long_axis]); + auto off = (int)(size[long_axis]/2) - (int)add; + fm_debug_assert(off >= 0); + pos[long_axis] -= off/2 * sign; + size[long_axis] -= (unsigned)off; + } } pos -= Vector2i(fuzz); -- cgit v1.2.3