From 56dc32cce361c1488b504f3dd43aeda5d68ad83e Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Tue, 7 Jan 2025 20:52:06 -0500 Subject: [PATCH] Ensure direction is normalized. --- src/visibility.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/visibility.rs b/src/visibility.rs index b3dde56..2e26ca1 100644 --- a/src/visibility.rs +++ b/src/visibility.rs @@ -86,7 +86,7 @@ impl Viewshed { } else { let should_push = std::cell::RefCell::new(true); let coord = Vec2::new(coord.x as f32 + 0.5, coord.y as f32 + 0.5); - let dir = Dir2::new_unchecked((coord - *start).normalize()); + let dir = Dir2::new_unchecked((coord - *start).normalize_or_zero()); // println!("Casting from {coord} to {dir:?}"); spatial_query.cast_ray_predicate( *start,