1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add vector helpers

This commit is contained in:
ShadowNinja 2013-07-07 01:44:33 -04:00 committed by kwolekr
parent d22baa88ed
commit ae8ff4b8e2
4 changed files with 192 additions and 15 deletions

View file

@ -106,3 +106,13 @@ function minetest.formspec_escape(str)
return str
end
function math.hypot(x, y)
local t
x = math.abs(x)
y = math.abs(y)
t = math.min(x, y)
x = math.max(x, y)
t = t / x
return x * math.sqrt(1 + t * t)
end