Skip to content

Commit

Permalink
Merge branch 'emilk:master' into patch8
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Dec 20, 2024
2 parents 25a8ee9 + 7f71166 commit 82ef49d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions crates/emath/src/rect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,11 @@ impl Rect {
///
/// A ray that starts inside the rect will return `true`.
pub fn intersects_ray(&self, o: Pos2, d: Vec2) -> bool {
debug_assert!(d.is_normalized(), "expected normalized direction");
debug_assert!(
d.is_normalized(),
"expected normalized direction, but `d` has length {}",
d.length()
);

let mut tmin = -f32::INFINITY;
let mut tmax = f32::INFINITY;
Expand Down Expand Up @@ -677,7 +681,11 @@ impl Rect {
///
/// `d` is the direction of the ray and assumed to be normalized.
pub fn intersects_ray_from_center(&self, d: Vec2) -> Pos2 {
debug_assert!(d.is_normalized(), "expected normalized direction");
debug_assert!(
d.is_normalized(),
"expected normalized direction, but `d` has length {}",
d.length()
);

let mut tmin = f32::NEG_INFINITY;
let mut tmax = f32::INFINITY;
Expand Down

0 comments on commit 82ef49d

Please sign in to comment.