From 61c48dff5e573fe8be448bf2e57e8d811a274a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Tue, 15 Feb 2022 17:54:19 +0100 Subject: [PATCH] Force tokens to keep some distance from the outer walls as well --- rust/src/pathfinder.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rust/src/pathfinder.rs b/rust/src/pathfinder.rs index 0c7392e..3a15733 100644 --- a/rust/src/pathfinder.rs +++ b/rust/src/pathfinder.rs @@ -188,14 +188,17 @@ impl Pathfinder { if angle_diff <= PI { continue; } - if angle_diff > 1.5 * PI { + { let angle_between = angle_diff / 2.0 + angle1; - nodes.push(calc_pathfinding_node( + let pathfinding_node = calc_pathfinding_node( point, angle_between, distance_from_walls, &mut line_segments, - )); + ); + if angle_diff > 1.5 * PI { + nodes.push(pathfinding_node); + } } nodes.push(calc_pathfinding_node( point,