diff --git a/docs/index.html b/docs/index.html index 1be4d49..86dd81d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -130,7 +130,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/bound2.html b/docs/modules/bound2.html index 405c1eb..80be4b7 100644 --- a/docs/modules/bound2.html +++ b/docs/modules/bound2.html @@ -662,7 +662,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/bound3.html b/docs/modules/bound3.html index 53e5dcf..222d1f2 100644 --- a/docs/modules/bound3.html +++ b/docs/modules/bound3.html @@ -662,7 +662,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/bvh.html b/docs/modules/bvh.html index 3e5552a..ff3d68d 100644 --- a/docs/modules/bvh.html +++ b/docs/modules/bvh.html @@ -77,7 +77,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/color.html b/docs/modules/color.html index 31be64d..0783d8f 100644 --- a/docs/modules/color.html +++ b/docs/modules/color.html @@ -730,7 +730,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/constants.html b/docs/modules/constants.html index 92e3844..3c38757 100644 --- a/docs/modules/constants.html +++ b/docs/modules/constants.html @@ -118,7 +118,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/intersect.html b/docs/modules/intersect.html index f88a0af..996d410 100644 --- a/docs/modules/intersect.html +++ b/docs/modules/intersect.html @@ -77,7 +77,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/mat4.html b/docs/modules/mat4.html index 844403d..60d3421 100644 --- a/docs/modules/mat4.html +++ b/docs/modules/mat4.html @@ -1505,7 +1505,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/mesh.html b/docs/modules/mesh.html index 2b616d6..32b89ef 100644 --- a/docs/modules/mesh.html +++ b/docs/modules/mesh.html @@ -77,7 +77,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/octree.html b/docs/modules/octree.html index a675ed1..2b7e5c7 100644 --- a/docs/modules/octree.html +++ b/docs/modules/octree.html @@ -703,7 +703,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/quat.html b/docs/modules/quat.html index 2cd80b3..ab1bca8 100644 --- a/docs/modules/quat.html +++ b/docs/modules/quat.html @@ -1403,7 +1403,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/simplex.html b/docs/modules/simplex.html index 904b63d..7551bcc 100644 --- a/docs/modules/simplex.html +++ b/docs/modules/simplex.html @@ -77,7 +77,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/utils.html b/docs/modules/utils.html index 0b208e4..c6786d3 100644 --- a/docs/modules/utils.html +++ b/docs/modules/utils.html @@ -550,7 +550,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/vec2.html b/docs/modules/vec2.html index 1ed5dcf..e55c07b 100644 --- a/docs/modules/vec2.html +++ b/docs/modules/vec2.html @@ -1117,7 +1117,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/modules/vec3.html b/docs/modules/vec3.html index 5758e10..6260a4f 100644 --- a/docs/modules/vec3.html +++ b/docs/modules/vec3.html @@ -1025,7 +1025,7 @@
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/docs/topics/readme.md.html b/docs/topics/readme.md.html index 9fcd2ee..f6e396b 100644 --- a/docs/topics/readme.md.html +++ b/docs/topics/readme.md.html @@ -80,7 +80,7 @@

Various useful bits of game math. 3D line intersections, ray casting, 2d/3d vectors, 4x4 matrices, quaternions, etc.

This is a fork of CPML (for LÖVE/love3d), it's been ported over the minetest so it can be used in whatever you need it for. -Documentation can be found here: https://minetest-unified-library.github.io/LEEF-Math/.

+Documentation can be found here: .

For possible future contributors: documentation must be generated manually when a commit is made, because I haven't set up workflows (and have no idea how to).

@@ -92,7 +92,7 @@ Documentation can be found here:
generated by LDoc 1.5.0 -Last updated 2024-12-01 12:04:18 +Last updated 2024-12-09 17:59:28
diff --git a/modules/mat4.lua b/modules/mat4.lua index 10b9ef7..ed04987 100644 --- a/modules/mat4.lua +++ b/modules/mat4.lua @@ -524,8 +524,8 @@ end --- Multiply N matrices. -- @tparam mat4 out Matrix to store the result --- @tparam mat4 or {mat4, ...} left hand operand(s) --- @tparam mat4 right hand operand if a is not table +-- @tparam table a a mat4 or a list of mat4s +-- @tparam mat4 b right operand used if param a is a mat4 -- @treturn mat4 out multiplied matrix result function mat4.mul(out, a, b) if mat4.is_mat4(a) then @@ -533,18 +533,14 @@ function mat4.mul(out, a, b) return out end if #a == 0 then - identity(out) - elseif #a == 1 then - -- only one matrix, just copy - for i = 1, 16 do - out[i] = a[1][i] - end + error("incorrect operand, expected two mat4s or list of mat4s but recieved empty table.") else - local ma = a[1] - local mb = a[2] - for i = 2, #a do - mul_internal(out, ma, mb) - ma = out + local new_mat = a[#a] + for i = #a-1, 1, -1 do + new_mat = a[i]*new_mat + end + for i=1,16 do + out[i] = new_mat[i] end end return out