mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-10 02:31:48 +00:00
[added] mathx.bilerp which does a bilinear interpolation from 4 samples
This commit is contained in:
parent
84197b5216
commit
b4e2cff498
@ -67,6 +67,15 @@ function mathx.lerp_eps(a, b, t, eps)
|
||||
return v
|
||||
end
|
||||
|
||||
--bilinear interpolation between 4 samples
|
||||
function mathx.bilerp(a, b, c, d, u, v)
|
||||
return math.lerp(
|
||||
math.lerp(a, b, u),
|
||||
math.lerp(c, d, u),
|
||||
v
|
||||
)
|
||||
end
|
||||
|
||||
--classic smoothstep
|
||||
--(only "safe" for 0-1 range)
|
||||
function mathx.smoothstep(v)
|
||||
|
Loading…
Reference in New Issue
Block a user