From d6cccf44669a759aa98c50f2938fd1df54dfcac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Thu, 17 Feb 2022 00:53:51 +0100 Subject: [PATCH] Ensure pathfinding on gridless is possible by always generating a pathfinding point when a virtual wall is being inserted --- rust/src/pathfinder.rs | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/rust/src/pathfinder.rs b/rust/src/pathfinder.rs index 3a15733..1855b0a 100644 --- a/rust/src/pathfinder.rs +++ b/rust/src/pathfinder.rs @@ -188,18 +188,13 @@ impl Pathfinder { if angle_diff <= PI { continue; } - { - let angle_between = angle_diff / 2.0 + angle1; - 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); - } - } + let angle_between = angle_diff / 2.0 + angle1; + nodes.push(calc_pathfinding_node( + point, + angle_between, + distance_from_walls, + &mut line_segments, + )); nodes.push(calc_pathfinding_node( point, angle1 + 0.5 * PI, @@ -219,15 +214,13 @@ 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( - point, - angle_between, - distance_from_walls, - &mut line_segments, - )); - } + let angle_between = angle_diff / 2.0 + angle1; + nodes.push(calc_pathfinding_node( + point, + angle_between, + distance_from_walls, + &mut line_segments, + )); nodes.push(calc_pathfinding_node( point, angle1 + 0.5 * PI,