From e36b63102914e61d6ff2f2a9f200140d92d8d0fe Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Wed, 11 Mar 2026 21:11:21 +0100 Subject: [PATCH] Underestimate instead of overestimating segment length --- topola/src/navmesher.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/topola/src/navmesher.rs b/topola/src/navmesher.rs index 4377d7b..bb73ec6 100644 --- a/topola/src/navmesher.rs +++ b/topola/src/navmesher.rs @@ -169,7 +169,8 @@ impl NavmesherBoard { let dx = x2 - x1; let dy = y2 - y1; - let approx_len = std::cmp::max(dx.abs(), dy.abs()) + std::cmp::min(dx.abs(), dy.abs()) / 2; + let approx_len = + std::cmp::max(dx.abs(), dy.abs()) + 3 * std::cmp::min(dx.abs(), dy.abs()) / 8; // Perpendicular vector scaled to half-width. let px = -dy * (half_width as i64) / approx_len;