Ensure direction is normalized.
This commit is contained in:
parent
7470e8fa8d
commit
56dc32cce3
|
@ -86,7 +86,7 @@ impl Viewshed {
|
||||||
} else {
|
} else {
|
||||||
let should_push = std::cell::RefCell::new(true);
|
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 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:?}");
|
// println!("Casting from {coord} to {dir:?}");
|
||||||
spatial_query.cast_ray_predicate(
|
spatial_query.cast_ray_predicate(
|
||||||
*start,
|
*start,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user