Skip to content

Commit

Permalink
Fix interpolation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Speykious committed Jul 16, 2024
1 parent ba65e19 commit e1c931f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions inox2d/src/math/interp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ fn interpolate_nearest(t: f32, range_in: InterpRange<f32>, range_out: InterpRang
fn interpolate_linear(t: f32, range_in: InterpRange<f32>, range_out: InterpRange<f32>) -> f32 {
debug_assert!(
range_in.beg <= t && t <= range_in.end,
"{} <= {} <= {}",
range_in.beg,
"{} is out of input range [{}, {}]",
t,
range_in.end
range_in.beg,
range_in.end,
);

(t - range_in.beg) * (range_out.end - range_out.beg) / (range_in.end - range_in.beg) + range_out.beg
Expand Down Expand Up @@ -203,7 +203,7 @@ mod tests {
0.0
);
assert_eq!(
interpolate_linear(0.0, InterpRange::new(0.5, 0.0), InterpRange::new(-5.0, 5.0)),
interpolate_linear(0.0, InterpRange::new(-0.5, 0.0), InterpRange::new(-5.0, 5.0)),
5.0
);
}
Expand Down

0 comments on commit e1c931f

Please sign in to comment.