Underestimate instead of overestimating segment length

This commit is contained in:
Mikolaj Wielgus 2026-03-11 21:11:21 +01:00
parent ab30432f6b
commit e36b631029
1 changed files with 2 additions and 1 deletions

View File

@ -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;