mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-26 07:34:35 +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
|
return v
|
||||||
end
|
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
|
--classic smoothstep
|
||||||
--(only "safe" for 0-1 range)
|
--(only "safe" for 0-1 range)
|
||||||
function mathx.smoothstep(v)
|
function mathx.smoothstep(v)
|
||||||
|
Loading…
Reference in New Issue
Block a user