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:
parent
d22baa88ed
commit
ae8ff4b8e2
4 changed files with 192 additions and 15 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue