Skip to content

Commit

Permalink
Bugfix ball intersect aabb.
Browse files Browse the repository at this point in the history
  • Loading branch information
finnbear committed Jan 7, 2025
1 parent 950ca20 commit 334e727
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ball.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl<T: BHValue, const D: usize> AabbIntersection<T, D> for Ball<T, D> {
let mut distance_squared = T::zero();
for i in 0..D {
let closest_on_aabb = self.center[i].clamp(aabb.min[i], aabb.max[i]);
distance_squared += closest_on_aabb.powi(2);
distance_squared += (closest_on_aabb - self.center[i]).powi(2);
}

// Then test if that point is in/on the ball.
Expand Down

0 comments on commit 334e727

Please sign in to comment.