summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------3rd/lovr-api0
m---------3rd/luamake0
-rw-r--r--meta/3rd/lovr/library/lovr.math.lua42
3 files changed, 42 insertions, 0 deletions
diff --git a/3rd/lovr-api b/3rd/lovr-api
-Subproject e1e358a9a5f60fb2d1ec7bd8361b36629577e45
+Subproject 8098fac257418887c5acc892377e5979ce0699e
diff --git a/3rd/luamake b/3rd/luamake
-Subproject 909a3bf9770c61efc8a3050402ecbfa4daf24dd
+Subproject 81158f58bcbd54c398d2b0aba4d5be67921af0b
diff --git a/meta/3rd/lovr/library/lovr.math.lua b/meta/3rd/lovr/library/lovr.math.lua
index 7cf348c6..3ce62dd9 100644
--- a/meta/3rd/lovr/library/lovr.math.lua
+++ b/meta/3rd/lovr/library/lovr.math.lua
@@ -644,6 +644,20 @@ local Vec2 = {}
function Vec2:add(u) end
---
+---Returns the angle between vectors.
+---
+---
+---### NOTE:
+---If any of the two vectors have a length of zero, the angle between them is not well defined.
+---
+---In this case the function returns `math.pi / 2`.
+---
+---@overload fun(self: lovr.Vec2, x: number, y: number):number
+---@param u lovr.Vec2 # The other vector.
+---@return number angle # The angle to the other vector, in radians.
+function Vec2:angle(u) end
+
+---
---Returns the distance to another vector.
---
---@overload fun(self: lovr.Vec2, x: number, y: number):number
@@ -749,6 +763,20 @@ local Vec3 = {}
function Vec3:add(u) end
---
+---Returns the angle between vectors.
+---
+---
+---### NOTE:
+---If any of the two vectors have a length of zero, the angle between them is not well defined.
+---
+---In this case the function returns `math.pi / 2`.
+---
+---@overload fun(self: lovr.Vec3, x: number, y: number, z: number):number
+---@param u lovr.Vec3 # The other vector.
+---@return number angle # The angle to the other vector, in radians.
+function Vec3:angle(u) end
+
+---
---Sets this vector to be equal to the cross product between this vector and another one.
---
---The new `v` will be perpendicular to both the old `v` and `u`.
@@ -873,6 +901,20 @@ local Vec4 = {}
function Vec4:add(u) end
---
+---Returns the angle between vectors.
+---
+---
+---### NOTE:
+---If any of the two vectors have a length of zero, the angle between them is not well defined.
+---
+---In this case the function returns `math.pi / 2`.
+---
+---@overload fun(self: lovr.Vec4, x: number, y: number, z: number, w: number):number
+---@param u lovr.Vec4 # The other vector.
+---@return number angle # The angle to other vector, in radians.
+function Vec4:angle(u) end
+
+---
---Returns the distance to another vector.
---
---@overload fun(self: lovr.Vec4, x: number, y: number, z: number, w: number):number