updated to current for 4dguns

This commit is contained in:
FatalErr42O 2024-02-29 21:16:56 -08:00
parent 43c3387293
commit f3fe056993
18 changed files with 56 additions and 52 deletions

View File

@ -130,7 +130,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -662,7 +662,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -662,7 +662,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -77,7 +77,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -730,7 +730,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -118,7 +118,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -77,7 +77,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -1166,7 +1166,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -77,7 +77,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -703,7 +703,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -201,10 +201,6 @@
<td class="name" nowrap><a href="#to_string">to_string (a)</a></td>
<td class="summary">Return a formatted string.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#to_euler">to_euler (a)</a></td>
<td class="summary">Convert a quaternion to an Euler angle</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
@ -1204,33 +1200,6 @@
</dd>
<dt>
<a name = "to_euler"></a>
<strong>to_euler (a)</strong>
</dt>
<dd>
Convert a quaternion to an Euler angle
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><a class="type" href="../modules/quat.html#quat">quat</a></span>
Quaternion to convert
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vec3</span></span>
euler angle in radians
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
@ -1266,7 +1235,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -77,7 +77,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -550,7 +550,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -1117,7 +1117,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -1025,7 +1025,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -62,23 +62,25 @@
<h1>Cirno's Perfect Math Library</h1>
<h3>Adapated for Minetest</h3>
<p>For best memory performance: have luaJIT &amp; it's FFI library (this should be built into luaJIT), and add MTUL-CPML to your trusted list (so it can <code>require()</code> call the FFI library)
also works if you disable mod security (DANGEROUS, NOT RECCOMENDED).</p>
<p>For best memory performance: have luaJIT &amp; it's FFI library (this should be built into luaJIT), and add MTUL-CPML to your trusted list (so it can <code>require()</code> call the FFI library).</p>
<p>Various useful bits of game math. 3D line intersections, ray casting, 2d/3d vectors, 4x4 matrices, quaternions, etc.</p>
<p>(originally) intended to be used with LuaJIT and LÖVE (this is the backbone of LÖVE3D).</p>
<p>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: <a href="https://minetest-unification-library.github.io/MTUL-CPML/">https://minetest-unification-library.github.io/MTUL-CPML/</a>.</p>
<p>Documentation must be generated manually when a commit is made, because I haven't set up workflows (and have no idea how to).</p>
<h3>TODO:</h3>
<p>* Vec3s and Vec2s are not currently adapted for functionality with MT vectors (seperate classes)</p>
<p>* Vec3s and Vec2s are not currently adapted for functionality with MT vectors (seperate classes)
* Figure out how CPML (originally) automatically updated docs, and do it here.</p>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-09-10 15:25:31 </i>
<i style="float:right;">Last updated 2024-01-06 19:06:14 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -651,6 +651,17 @@ function mat4.transpose(out, a)
return out
end
--this probably doesnt work so I'm removing it for now, work is being done.
--- Decompose into euler angles, assumes xyz are all unit vectors.
--[[function mat4.decompose_rotation(a)
local x, y, z
x = math.atan2(a[7], a[11])
y = math.atan2(-a[3], sqrt(a[7]^2 + a[11]^2))
z = math.atan2(a[2], a[1])
return x, y, z
end]]
--- Project a point into screen space
-- @tparam vec3 obj Object position in world space
-- @tparam mat4 mvp Projection matrix

View File

@ -96,7 +96,29 @@ function quat.from_angle_axis(angle, axis, a3, a4)
end
end
--- Create a quaternion from a normal/up vector pair.
--works in theory... probably.
--- Create a quaternion from an euler angle
-- @tparam Vec3 (or xyz table)
-- @treturn quat out
function quat.from_euler_rotation(rot)
local cr = cos(rot.z*.5)
local sr = sin(rot.z*.5)
local cp = cos(rot.x*.5)
local sp = sin(rot.x*.5)
local cy = cos(rot.y*.5)
local sy = sin(rot.y*.5)
return quat.new({
w = cr * cp * cy + sr * sp * sy,
x = sr * cp * cy - cr * sp * sy,
y = cr * sp * cy + sr * cp * sy,
z = cr * cp * sy - sr * sp * cy
})
end
--- Create a quaternion from a normal/up vector pair. (accepts minetest vectors)
-- @tparam vec3 normal
-- @tparam vec3 up (optional)
-- @treturn quat out