Skip to main content

bilinear

Function bilinear 

Source
pub fn bilinear<T: Real>(x: T, y: T, v00: T, v01: T, v10: T, v11: T) -> T
Expand description

Bilinear interpolation between four corner values.

v00 at (0,0), v01 at (0,1), v10 at (1,0), v11 at (1,1). x and y are assumed within [0, 1].

ยงExamples

use mathverse_core::ops::bilinear;

assert_eq!(bilinear(0.0, 0.0, 0.0, 0.0, 0.0, 10.0), 0.0);
assert_eq!(bilinear(1.0, 1.0, 0.0, 0.0, 0.0, 10.0), 10.0);
assert_eq!(bilinear(0.5, 0.5, 0.0, 10.0, 10.0, 0.0), 5.0);