1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-12 16:15:20 +02:00

Add Lua helper functions vector.apply(v) math.sign(x, tolerance)

This commit is contained in:
SmallJoker
2014-12-05 23:18:52 +01:00
committed by Kahrl
parent 0e78aa296e
commit 2fd14e1bd5
3 changed files with 23 additions and 0 deletions

View File

@@ -39,6 +39,14 @@ function vector.round(v)
}
end
function vector.apply(v, func)
return {
x = func(v.x),
y = func(v.y),
z = func(v.z)
}
end
function vector.distance(a, b)
local x = a.x - b.x
local y = a.y - b.y