mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-26 09:13:53 +01:00
Add vector.interpolate
This commit is contained in:
parent
6f0e6f459b
commit
e56e9c1207
@ -115,6 +115,12 @@ metatable.__sub = subtract
|
||||
metatable.__mul = multiply
|
||||
metatable.__div = divide
|
||||
|
||||
--+ linear interpolation
|
||||
--: ratio number from 0 (all the first vector) to 1 (all the second vector)
|
||||
function interpolate(v, other_v, ratio)
|
||||
return add(multiply(v, 1 - ratio), multiply(other_v, ratio))
|
||||
end
|
||||
|
||||
function norm(v)
|
||||
local sum = 0
|
||||
for _, c in pairs(v) do
|
||||
|
Loading…
Reference in New Issue
Block a user