staging commits

This commit is contained in:
FatalErr42O 2023-09-10 15:27:15 -07:00
parent 843a573334
commit 90dea05875
22 changed files with 8931 additions and 16 deletions

View File

@ -2,18 +2,12 @@ Cirno's Perfect Math Library
====
### Adapated for Minetest
For best memory performance: have luaJIT & it's FFI library (this should be built into luaJIT), and add MTUL-CPML to your trusted list (so it can `require()` call the FFI library)
also works if you disable mod security (DANGEROUS, NOT RECCOMENDED).
Various useful bits of game math. 3D line intersections, ray casting, 2d/3d vectors, 4x4 matrices, quaternions, etc.
(originally) ntended to be used with LuaJIT and LÖVE (this is the backbone of LÖVE3D).
(originally) intended to be used with LuaJIT and LÖVE (this is the backbone of LÖVE3D).
Online documentation can be found [here](http://excessive.github.io/cpml/) or you can generate them yourself using `ldoc -c doc/config.ld -o index .`
## Additionally adds to the API
`mat4:translate_local(out, a, t)`
does the same thing as `translate` only its far right column instead of bottom row (as that's what's needed for most local coordinate systems)
also: worth noting that "a" in both `translate` and `translate_local` can be an empty table, and it'll generate an identity matrix. Which is really
redundant code wise, not a fan of that. Probably will fix that at some point.
### TODO:
* Vec3s and Vec2s are not currently adapted for functionality with MT vectors (seperate classes)
* Vec3s and Vec2s are not currently adapted for functionality with MT vectors (seperate classes)

137
docs/index.html Normal file
View File

@ -0,0 +1,137 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>CPML documentation</title>
<link rel="stylesheet" href="ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>CPML</h1>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="modules/bound2.html">bound2</a></li>
<li><a href="modules/bound3.html">bound3</a></li>
<li><a href="modules/bvh.html">bvh</a></li>
<li><a href="modules/color.html">color</a></li>
<li><a href="modules/constants.html">constants</a></li>
<li><a href="modules/intersect.html">intersect</a></li>
<li><a href="modules/mat4.html">mat4</a></li>
<li><a href="modules/mesh.html">mesh</a></li>
<li><a href="modules/octree.html">octree</a></li>
<li><a href="modules/quat.html">quat</a></li>
<li><a href="modules/simplex.html">simplex</a></li>
<li><a href="modules/utils.html">utils</a></li>
<li><a href="modules/vec2.html">vec2</a></li>
<li><a href="modules/vec3.html">vec3</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h2>A math library with (hopefully) everything you need for 2D/3D games</h2>
<h2>Modules</h2>
<table class="module_list">
<tr>
<td class="name" nowrap><a href="modules/bound2.html">bound2</a></td>
<td class="summary">A 2 component bounding box.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/bound3.html">bound3</a></td>
<td class="summary">A 3-component axis-aligned bounding box.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/bvh.html">bvh</a></td>
<td class="summary">BVH Tree</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/color.html">color</a></td>
<td class="summary">Color utilities</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/constants.html">constants</a></td>
<td class="summary">Various useful constants</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/intersect.html">intersect</a></td>
<td class="summary">Various geometric intersections</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/mat4.html">mat4</a></td>
<td class="summary">double 4x4, 1-based, column major matrices</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/mesh.html">mesh</a></td>
<td class="summary">Mesh utilities</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/octree.html">octree</a></td>
<td class="summary">Octree</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/quat.html">quat</a></td>
<td class="summary">A quaternion and associated utilities.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/simplex.html">simplex</a></td>
<td class="summary">Simplex Noise</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/utils.html">utils</a></td>
<td class="summary">Various utility functions</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/vec2.html">vec2</a></td>
<td class="summary">A 2 component vector.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/vec3.html">vec3</a></td>
<td class="summary">A 3 component vector.</td>
</tr>
</table>
<h2>Topics</h2>
<table class="module_list">
<tr>
<td class="name" nowrap><a href="topics/readme.md.html">readme.md</a></td>
<td class="summary"></td>
</tr>
</table>
</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>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

290
docs/ldoc_new.css Normal file
View File

@ -0,0 +1,290 @@
body {
color: #47555c;
font-size: 16px;
font-family: "Open Sans", sans-serif;
margin: 0;
background: #eff4ff;
}
a:link { color: #008fee; }
a:visited { color: #008fee; }
a:hover { color: #22a7ff; }
h1 { font-size:26px; font-weight: normal; }
h2 { font-size:22px; font-weight: normal; }
h3 { font-size:18px; font-weight: normal; }
h4 { font-size:16px; font-weight: bold; }
hr {
height: 1px;
background: #c1cce4;
border: 0px;
margin: 15px 0;
}
code, tt {
font-family: monospace;
}
span.parameter {
font-family: monospace;
font-weight: bold;
color: rgb(99, 115, 131);
}
span.parameter:after {
content:":";
}
span.types:before {
content:"(";
}
span.types:after {
content:")";
}
.type {
font-weight: bold; font-style:italic
}
p.name {
font-family: "Andale Mono", monospace;
}
#navigation {
float: left;
background-color: white;
border-right: 1px solid #d3dbec;
border-bottom: 1px solid #d3dbec;
width: 14em;
vertical-align: top;
overflow: visible;
}
#navigation br {
display: none;
}
#navigation h1 {
background-color: white;
border-bottom: 1px solid #d3dbec;
padding: 15px;
margin-top: 0px;
margin-bottom: 0px;
}
#navigation h2 {
font-size: 18px;
background-color: white;
border-bottom: 1px solid #d3dbec;
padding-left: 15px;
padding-right: 15px;
padding-top: 10px;
padding-bottom: 10px;
margin-top: 30px;
margin-bottom: 0px;
}
#content h1 {
background-color: #2c3e67;
color: white;
padding: 15px;
margin: 0px;
}
#content h2 {
background-color: #6c7ea7;
color: white;
padding: 15px;
padding-top: 15px;
padding-bottom: 15px;
margin-top: 0px;
}
#content h2 a {
background-color: #6c7ea7;
color: white;
text-decoration: none;
}
#content h2 a:hover {
text-decoration: underline;
}
#content h3 {
font-style: italic;
padding-top: 15px;
padding-bottom: 4px;
margin-right: 15px;
margin-left: 15px;
margin-bottom: 5px;
border-bottom: solid 1px #bcd;
}
#content h4 {
margin-right: 15px;
margin-left: 15px;
border-bottom: solid 1px #bcd;
}
#content pre {
margin: 15px;
}
pre {
background-color: rgb(50, 55, 68);
color: white;
border-radius: 3px;
/* border: 1px solid #C0C0C0; /* silver */
padding: 15px;
overflow: auto;
font-family: "Andale Mono", monospace;
}
#content ul pre.example {
margin-left: 0px;
}
table.index {
/* border: 1px #00007f; */
}
table.index td { text-align: left; vertical-align: top; }
#navigation ul
{
font-size:1em;
list-style-type: none;
margin: 1px 1px 10px 1px;
}
#navigation li {
text-indent: -1em;
display: block;
margin: 3px 0px 0px 22px;
}
#navigation li li a {
margin: 0px 3px 0px -1em;
}
#content {
margin-left: 14em;
}
#content p {
padding-left: 15px;
padding-right: 15px;
}
#content table {
padding-left: 15px;
padding-right: 15px;
background-color: white;
}
#content p, #content table, #content ol, #content ul, #content dl {
max-width: 900px;
}
#about {
padding: 15px;
padding-left: 16em;
background-color: white;
border-top: 1px solid #d3dbec;
border-bottom: 1px solid #d3dbec;
}
table.module_list, table.function_list {
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
margin: 15px;
}
table.module_list td, table.function_list td {
border-width: 1px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
border: solid 1px rgb(193, 204, 228);
}
table.module_list td.name, table.function_list td.name {
background-color: white; min-width: 200px; border-right-width: 0px;
}
table.module_list td.summary, table.function_list td.summary {
background-color: white; width: 100%; border-left-width: 0px;
}
dl.function {
margin-right: 15px;
margin-left: 15px;
border-bottom: solid 1px rgb(193, 204, 228);
border-left: solid 1px rgb(193, 204, 228);
border-right: solid 1px rgb(193, 204, 228);
background-color: white;
}
dl.function dt {
color: rgb(99, 123, 188);
font-family: monospace;
border-top: solid 1px rgb(193, 204, 228);
padding: 15px;
}
dl.function dd {
margin-left: 15px;
margin-right: 15px;
margin-top: 5px;
margin-bottom: 15px;
}
#content dl.function dd h3 {
margin-top: 0px;
margin-left: 0px;
padding-left: 0px;
font-size: 16px;
color: rgb(128, 128, 128);
border-bottom: solid 1px #def;
}
#content dl.function dd ul, #content dl.function dd ol {
padding: 0px;
padding-left: 15px;
list-style-type: none;
}
ul.nowrap {
overflow:auto;
white-space:nowrap;
}
.section-description {
padding-left: 15px;
padding-right: 15px;
}
/* stop sublists from having initial vertical space */
ul ul { margin-top: 0px; }
ol ul { margin-top: 0px; }
ol ol { margin-top: 0px; }
ul ol { margin-top: 0px; }
/* make the target distinct; helps when we're navigating to a function */
a:target + * {
background-color: #FF9;
}
/* styles for prettification of source */
pre .comment { color: #bbccaa; }
pre .constant { color: #a8660d; }
pre .escape { color: #844631; }
pre .keyword { color: #ffc090; font-weight: bold; }
pre .library { color: #0e7c6b; }
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
pre .string { color: #8080ff; }
pre .number { color: #f8660d; }
pre .operator { color: #2239a8; font-weight: bold; }
pre .preprocessor, pre .prepro { color: #a33243; }
pre .global { color: #c040c0; }
pre .user-keyword { color: #800080; }
pre .prompt { color: #558817; }
pre .url { color: #272fc2; text-decoration: underline; }

669
docs/modules/bound2.html Normal file
View File

@ -0,0 +1,669 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>CPML documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>CPML</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><strong>bound2</strong></li>
<li><a href="../modules/bound3.html">bound3</a></li>
<li><a href="../modules/bvh.html">bvh</a></li>
<li><a href="../modules/color.html">color</a></li>
<li><a href="../modules/constants.html">constants</a></li>
<li><a href="../modules/intersect.html">intersect</a></li>
<li><a href="../modules/mat4.html">mat4</a></li>
<li><a href="../modules/mesh.html">mesh</a></li>
<li><a href="../modules/octree.html">octree</a></li>
<li><a href="../modules/quat.html">quat</a></li>
<li><a href="../modules/simplex.html">simplex</a></li>
<li><a href="../modules/utils.html">utils</a></li>
<li><a href="../modules/vec2.html">vec2</a></li>
<li><a href="../modules/vec3.html">vec3</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>bound2</code></h1>
<p>A 2 component bounding box.</p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#new">new (min, max)</a></td>
<td class="summary">The public constructor.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#clone">clone (a)</a></td>
<td class="summary">Clone a bound.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#at">at (a, b)</a></td>
<td class="summary">Construct a bound covering one or two points</td>
</tr>
<tr>
<td class="name" nowrap><a href="#extend">extend (a, point)</a></td>
<td class="summary">Extend bound to include point</td>
</tr>
<tr>
<td class="name" nowrap><a href="#extend_bound">extend_bound (a, bound)</a></td>
<td class="summary">Extend bound to entirety of other bound</td>
</tr>
<tr>
<td class="name" nowrap><a href="#size">size (a)</a></td>
<td class="summary">Get size of bounding box as a vector</td>
</tr>
<tr>
<td class="name" nowrap><a href="#with_size">with_size (a, new)</a></td>
<td class="summary">Resize bounding box from minimum corner</td>
</tr>
<tr>
<td class="name" nowrap><a href="#radius">radius (a)</a></td>
<td class="summary">Get half-size of bounding box as a vector.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#center">center (a)</a></td>
<td class="summary">Get center of bounding box</td>
</tr>
<tr>
<td class="name" nowrap><a href="#with_center">with_center (a, new)</a></td>
<td class="summary">Move bounding box to new center</td>
</tr>
<tr>
<td class="name" nowrap><a href="#with_size_centered">with_size_centered (a, new)</a></td>
<td class="summary">Resize bounding box from center</td>
</tr>
<tr>
<td class="name" nowrap><a href="#check">check (a)</a></td>
<td class="summary">Convert possibly-invalid bounding box to valid one</td>
</tr>
<tr>
<td class="name" nowrap><a href="#inset">inset (a, a)</a></td>
<td class="summary">Shrink bounding box with fixed margin</td>
</tr>
<tr>
<td class="name" nowrap><a href="#outset">outset (a, a)</a></td>
<td class="summary">Expand bounding box with fixed margin</td>
</tr>
<tr>
<td class="name" nowrap><a href="#offset">offset (a, offset)</a></td>
<td class="summary">Offset bounding box</td>
</tr>
<tr>
<td class="name" nowrap><a href="#contains">contains (a, point)</a></td>
<td class="summary">Test if point in bound</td>
</tr>
<tr>
<td class="name" nowrap><a href="#to_string">to_string (a)</a></td>
<td class="summary">Return a formatted string.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "new"></a>
<strong>new (min, max)</strong>
</dt>
<dd>
The public constructor.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">min</span>
Can be of two types: </br>
vec2 min, minimum value for each component
nil Create bound at single point 0,0
</li>
<li><span class="parameter">max</span>
<span class="types"><span class="type">vec2</span></span>
, maximum value for each component
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound2</span></span>
out
</ol>
</dd>
<dt>
<a name = "clone"></a>
<strong>clone (a)</strong>
</dt>
<dd>
Clone a bound.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound2</span></span>
bound to be cloned
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound2</span></span>
out
</ol>
</dd>
<dt>
<a name = "at"></a>
<strong>at (a, b)</strong>
</dt>
<dd>
Construct a bound covering one or two points
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">vec2</span></span>
Any vector
</li>
<li><span class="parameter">b</span>
<span class="types"><span class="type">vec2</span></span>
Any second vector (optional)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vec2</span></span>
Minimum bound containing the given points
</ol>
</dd>
<dt>
<a name = "extend"></a>
<strong>extend (a, point)</strong>
</dt>
<dd>
Extend bound to include point
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound2</span></span>
bound
</li>
<li><span class="parameter">point</span>
<span class="types"><span class="type">vec2</span></span>
to include
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound2</span></span>
Bound covering current min, current max and new point
</ol>
</dd>
<dt>
<a name = "extend_bound"></a>
<strong>extend_bound (a, bound)</strong>
</dt>
<dd>
Extend bound to entirety of other bound
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound2</span></span>
bound
</li>
<li><span class="parameter">bound</span>
<span class="types"><span class="type">bound2</span></span>
to cover
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound2</span></span>
Bound covering current min and max of each bound in the pair
</ol>
</dd>
<dt>
<a name = "size"></a>
<strong>size (a)</strong>
</dt>
<dd>
Get size of bounding box as a vector
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound2</span></span>
bound
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vec2</span></span>
Vector spanning min to max points
</ol>
</dd>
<dt>
<a name = "with_size"></a>
<strong>with_size (a, new)</strong>
</dt>
<dd>
Resize bounding box from minimum corner
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound2</span></span>
bound
</li>
<li><span class="parameter">new</span>
<span class="types"><span class="type">vec2</span></span>
size
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound2</span></span>
resized bound
</ol>
</dd>
<dt>
<a name = "radius"></a>
<strong>radius (a)</strong>
</dt>
<dd>
Get half-size of bounding box as a vector. A more correct term for this is probably "apothem"
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound2</span></span>
bound
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vec2</span></span>
Vector spanning center to max point
</ol>
</dd>
<dt>
<a name = "center"></a>
<strong>center (a)</strong>
</dt>
<dd>
Get center of bounding box
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound2</span></span>
bound
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound2</span></span>
Point in center of bound
</ol>
</dd>
<dt>
<a name = "with_center"></a>
<strong>with_center (a, new)</strong>
</dt>
<dd>
Move bounding box to new center
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound2</span></span>
bound
</li>
<li><span class="parameter">new</span>
<span class="types"><span class="type">vec2</span></span>
center
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound2</span></span>
Bound with same size as input but different center
</ol>
</dd>
<dt>
<a name = "with_size_centered"></a>
<strong>with_size_centered (a, new)</strong>
</dt>
<dd>
Resize bounding box from center
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound2</span></span>
bound
</li>
<li><span class="parameter">new</span>
<span class="types"><span class="type">vec2</span></span>
size
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound2</span></span>
resized bound
</ol>
</dd>
<dt>
<a name = "check"></a>
<strong>check (a)</strong>
</dt>
<dd>
Convert possibly-invalid bounding box to valid one
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound2</span></span>
bound
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound2</span></span>
bound with all components corrected for min-max property
</ol>
</dd>
<dt>
<a name = "inset"></a>
<strong>inset (a, a)</strong>
</dt>
<dd>
Shrink bounding box with fixed margin
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">vec2</span></span>
margin
</li>
<li><span class="parameter">a</span>
<span class="types"><span class="type">vec2</span></span>
margin
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound2</span></span>
bound with margin subtracted from all edges. May not be valid, consider calling check()
</ol>
</dd>
<dt>
<a name = "outset"></a>
<strong>outset (a, a)</strong>
</dt>
<dd>
Expand bounding box with fixed margin
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">vec2</span></span>
margin
</li>
<li><span class="parameter">a</span>
<span class="types"><span class="type">vec2</span></span>
margin
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound2</span></span>
bound with margin added to all edges. May not be valid, consider calling check()
</ol>
</dd>
<dt>
<a name = "offset"></a>
<strong>offset (a, offset)</strong>
</dt>
<dd>
Offset bounding box
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound2</span></span>
bound
</li>
<li><span class="parameter">offset</span>
<span class="types"><span class="type">vec2</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound2</span></span>
bound with same size, but position moved by offset
</ol>
</dd>
<dt>
<a name = "contains"></a>
<strong>contains (a, point)</strong>
</dt>
<dd>
Test if point in bound
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound2</span></span>
bound
</li>
<li><span class="parameter">point</span>
<span class="types"><span class="type">vec2</span></span>
to test
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">boolean</span></span>
true if point in bounding box
</ol>
</dd>
<dt>
<a name = "to_string"></a>
<strong>to_string (a)</strong>
</dt>
<dd>
Return a formatted string.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound2</span></span>
bound to be turned into a string
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
formatted
</ol>
</dd>
</dl>
</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>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

669
docs/modules/bound3.html Normal file
View File

@ -0,0 +1,669 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>CPML documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>CPML</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/bound2.html">bound2</a></li>
<li><strong>bound3</strong></li>
<li><a href="../modules/bvh.html">bvh</a></li>
<li><a href="../modules/color.html">color</a></li>
<li><a href="../modules/constants.html">constants</a></li>
<li><a href="../modules/intersect.html">intersect</a></li>
<li><a href="../modules/mat4.html">mat4</a></li>
<li><a href="../modules/mesh.html">mesh</a></li>
<li><a href="../modules/octree.html">octree</a></li>
<li><a href="../modules/quat.html">quat</a></li>
<li><a href="../modules/simplex.html">simplex</a></li>
<li><a href="../modules/utils.html">utils</a></li>
<li><a href="../modules/vec2.html">vec2</a></li>
<li><a href="../modules/vec3.html">vec3</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>bound3</code></h1>
<p>A 3-component axis-aligned bounding box.</p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#new">new (min, max)</a></td>
<td class="summary">The public constructor.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#clone">clone (a)</a></td>
<td class="summary">Clone a bound.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#at">at (a, b)</a></td>
<td class="summary">Construct a bound covering one or two points</td>
</tr>
<tr>
<td class="name" nowrap><a href="#extend">extend (a, point)</a></td>
<td class="summary">Extend bound to include point</td>
</tr>
<tr>
<td class="name" nowrap><a href="#extend_bound">extend_bound (a, bound)</a></td>
<td class="summary">Extend bound to entirety of other bound</td>
</tr>
<tr>
<td class="name" nowrap><a href="#size">size (a)</a></td>
<td class="summary">Get size of bounding box as a vector</td>
</tr>
<tr>
<td class="name" nowrap><a href="#with_size">with_size (a, new)</a></td>
<td class="summary">Resize bounding box from minimum corner</td>
</tr>
<tr>
<td class="name" nowrap><a href="#radius">radius (a)</a></td>
<td class="summary">Get half-size of bounding box as a vector.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#center">center (a)</a></td>
<td class="summary">Get center of bounding box</td>
</tr>
<tr>
<td class="name" nowrap><a href="#with_center">with_center (a, new)</a></td>
<td class="summary">Move bounding box to new center</td>
</tr>
<tr>
<td class="name" nowrap><a href="#with_size_centered">with_size_centered (a, new)</a></td>
<td class="summary">Resize bounding box from center</td>
</tr>
<tr>
<td class="name" nowrap><a href="#check">check (a)</a></td>
<td class="summary">Convert possibly-invalid bounding box to valid one</td>
</tr>
<tr>
<td class="name" nowrap><a href="#inset">inset (a, a)</a></td>
<td class="summary">Shrink bounding box with fixed margin</td>
</tr>
<tr>
<td class="name" nowrap><a href="#outset">outset (a, a)</a></td>
<td class="summary">Expand bounding box with fixed margin</td>
</tr>
<tr>
<td class="name" nowrap><a href="#offset">offset (a, offset)</a></td>
<td class="summary">Offset bounding box</td>
</tr>
<tr>
<td class="name" nowrap><a href="#contains">contains (a, point)</a></td>
<td class="summary">Test if point in bound</td>
</tr>
<tr>
<td class="name" nowrap><a href="#to_string">to_string (a)</a></td>
<td class="summary">Return a formatted string.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "new"></a>
<strong>new (min, max)</strong>
</dt>
<dd>
The public constructor.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">min</span>
Can be of two types: </br>
vec3 min, minimum value for each component
nil Create bound at single point 0,0,0
</li>
<li><span class="parameter">max</span>
<span class="types"><span class="type">vec3</span></span>
, maximum value for each component
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound3</span></span>
out
</ol>
</dd>
<dt>
<a name = "clone"></a>
<strong>clone (a)</strong>
</dt>
<dd>
Clone a bound.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound3</span></span>
bound to be cloned
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound3</span></span>
out
</ol>
</dd>
<dt>
<a name = "at"></a>
<strong>at (a, b)</strong>
</dt>
<dd>
Construct a bound covering one or two points
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">vec3</span></span>
Any vector
</li>
<li><span class="parameter">b</span>
<span class="types"><span class="type">vec3</span></span>
Any second vector (optional)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vec3</span></span>
Minimum bound containing the given points
</ol>
</dd>
<dt>
<a name = "extend"></a>
<strong>extend (a, point)</strong>
</dt>
<dd>
Extend bound to include point
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound3</span></span>
bound
</li>
<li><span class="parameter">point</span>
<span class="types"><span class="type">vec3</span></span>
to include
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound3</span></span>
Bound covering current min, current max and new point
</ol>
</dd>
<dt>
<a name = "extend_bound"></a>
<strong>extend_bound (a, bound)</strong>
</dt>
<dd>
Extend bound to entirety of other bound
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound3</span></span>
bound
</li>
<li><span class="parameter">bound</span>
<span class="types"><span class="type">bound3</span></span>
to cover
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound3</span></span>
Bound covering current min and max of each bound in the pair
</ol>
</dd>
<dt>
<a name = "size"></a>
<strong>size (a)</strong>
</dt>
<dd>
Get size of bounding box as a vector
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound3</span></span>
bound
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vec3</span></span>
Vector spanning min to max points
</ol>
</dd>
<dt>
<a name = "with_size"></a>
<strong>with_size (a, new)</strong>
</dt>
<dd>
Resize bounding box from minimum corner
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound3</span></span>
bound
</li>
<li><span class="parameter">new</span>
<span class="types"><span class="type">vec3</span></span>
size
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound3</span></span>
resized bound
</ol>
</dd>
<dt>
<a name = "radius"></a>
<strong>radius (a)</strong>
</dt>
<dd>
Get half-size of bounding box as a vector. A more correct term for this is probably "apothem"
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound3</span></span>
bound
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vec3</span></span>
Vector spanning center to max point
</ol>
</dd>
<dt>
<a name = "center"></a>
<strong>center (a)</strong>
</dt>
<dd>
Get center of bounding box
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound3</span></span>
bound
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound3</span></span>
Point in center of bound
</ol>
</dd>
<dt>
<a name = "with_center"></a>
<strong>with_center (a, new)</strong>
</dt>
<dd>
Move bounding box to new center
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound3</span></span>
bound
</li>
<li><span class="parameter">new</span>
<span class="types"><span class="type">vec3</span></span>
center
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound3</span></span>
Bound with same size as input but different center
</ol>
</dd>
<dt>
<a name = "with_size_centered"></a>
<strong>with_size_centered (a, new)</strong>
</dt>
<dd>
Resize bounding box from center
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound3</span></span>
bound
</li>
<li><span class="parameter">new</span>
<span class="types"><span class="type">vec3</span></span>
size
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound3</span></span>
resized bound
</ol>
</dd>
<dt>
<a name = "check"></a>
<strong>check (a)</strong>
</dt>
<dd>
Convert possibly-invalid bounding box to valid one
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound3</span></span>
bound
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound3</span></span>
bound with all components corrected for min-max property
</ol>
</dd>
<dt>
<a name = "inset"></a>
<strong>inset (a, a)</strong>
</dt>
<dd>
Shrink bounding box with fixed margin
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">vec3</span></span>
margin
</li>
<li><span class="parameter">a</span>
<span class="types"><span class="type">vec3</span></span>
margin
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound3</span></span>
bound with margin subtracted from all edges. May not be valid, consider calling check()
</ol>
</dd>
<dt>
<a name = "outset"></a>
<strong>outset (a, a)</strong>
</dt>
<dd>
Expand bounding box with fixed margin
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">vec3</span></span>
margin
</li>
<li><span class="parameter">a</span>
<span class="types"><span class="type">vec3</span></span>
margin
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound3</span></span>
bound with margin added to all edges. May not be valid, consider calling check()
</ol>
</dd>
<dt>
<a name = "offset"></a>
<strong>offset (a, offset)</strong>
</dt>
<dd>
Offset bounding box
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound3</span></span>
bound
</li>
<li><span class="parameter">offset</span>
<span class="types"><span class="type">vec3</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bound3</span></span>
bound with same size, but position moved by offset
</ol>
</dd>
<dt>
<a name = "contains"></a>
<strong>contains (a, point)</strong>
</dt>
<dd>
Test if point in bound
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound3</span></span>
bound
</li>
<li><span class="parameter">point</span>
<span class="types"><span class="type">vec3</span></span>
to test
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">boolean</span></span>
true if point in bounding box
</ol>
</dd>
<dt>
<a name = "to_string"></a>
<strong>to_string (a)</strong>
</dt>
<dd>
Return a formatted string.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">bound3</span></span>
bound to be turned into a string
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
formatted
</ol>
</dd>
</dl>
</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>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

84
docs/modules/bvh.html Normal file
View File

@ -0,0 +1,84 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>CPML documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>CPML</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/bound2.html">bound2</a></li>
<li><a href="../modules/bound3.html">bound3</a></li>
<li><strong>bvh</strong></li>
<li><a href="../modules/color.html">color</a></li>
<li><a href="../modules/constants.html">constants</a></li>
<li><a href="../modules/intersect.html">intersect</a></li>
<li><a href="../modules/mat4.html">mat4</a></li>
<li><a href="../modules/mesh.html">mesh</a></li>
<li><a href="../modules/octree.html">octree</a></li>
<li><a href="../modules/quat.html">quat</a></li>
<li><a href="../modules/simplex.html">simplex</a></li>
<li><a href="../modules/utils.html">utils</a></li>
<li><a href="../modules/vec2.html">vec2</a></li>
<li><a href="../modules/vec3.html">vec3</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>bvh</code></h1>
<p>BVH Tree</p>
<p>
</p>
<br/>
<br/>
</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>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

737
docs/modules/color.html Normal file
View File

@ -0,0 +1,737 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>CPML documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>CPML</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/bound2.html">bound2</a></li>
<li><a href="../modules/bound3.html">bound3</a></li>
<li><a href="../modules/bvh.html">bvh</a></li>
<li><strong>color</strong></li>
<li><a href="../modules/constants.html">constants</a></li>
<li><a href="../modules/intersect.html">intersect</a></li>
<li><a href="../modules/mat4.html">mat4</a></li>
<li><a href="../modules/mesh.html">mesh</a></li>
<li><a href="../modules/octree.html">octree</a></li>
<li><a href="../modules/quat.html">quat</a></li>
<li><a href="../modules/simplex.html">simplex</a></li>
<li><a href="../modules/utils.html">utils</a></li>
<li><a href="../modules/vec2.html">vec2</a></li>
<li><a href="../modules/vec3.html">vec3</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>color</code></h1>
<p>Color utilities</p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#new">new (x, g, b, a)</a></td>
<td class="summary">The public constructor.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#from_hsv">from_hsv (h, s, v)</a></td>
<td class="summary">Convert hue,saturation,value to color object.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#from_hsva">from_hsva (h, s, v, a)</a></td>
<td class="summary">Convert hue,saturation,value to color object.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#invert">invert (to)</a></td>
<td class="summary">Invert a color.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#lighten">lighten (to, amount)</a></td>
<td class="summary">Lighten a color by a component-wise fixed amount (alpha unchanged)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#lerp">lerp (at, at, s)</a></td>
<td class="summary">Interpolate between two colors.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#unpack">unpack (to)</a></td>
<td class="summary">Unpack a color into individual components in 0-1.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#as_255">as_255 (to)</a></td>
<td class="summary">Unpack a color into individual components in 0-255.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#darken">darken (to, amount)</a></td>
<td class="summary">Darken a color by a component-wise fixed amount (alpha unchanged)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#multiply">multiply (to, to)</a></td>
<td class="summary">Multiply a color's components by a value (alpha unchanged)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#opacity">opacity (to, to)</a></td>
<td class="summary">Multiply a color's alpha by a value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#hue">hue (to, to)</a></td>
<td class="summary">Set a color's hue (saturation, value, alpha unchanged)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#saturation">saturation (to, to)</a></td>
<td class="summary">Set a color's saturation (hue, value, alpha unchanged)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#value">value (to, to)</a></td>
<td class="summary">Set a color's value (saturation, hue, alpha unchanged)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_color">is_color (to)</a></td>
<td class="summary">Check if color is valid</td>
</tr>
<tr>
<td class="name" nowrap><a href="#to_string">to_string (a)</a></td>
<td class="summary">Return a formatted string.</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#hsv_to_color_table">hsv_to_color_table</a></td>
<td class="summary">Convert hue,saturation,value table to color object.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#color_to_hsv_table">color_to_hsv_table</a></td>
<td class="summary">Convert color to hue,saturation,value table</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "new"></a>
<strong>new (x, g, b, a)</strong>
</dt>
<dd>
The public constructor.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">x</span>
Can be of three types: </br>
number red component 0-1
table {r, g, b, a}
nil for {0,0,0,0}
</li>
<li><span class="parameter">g</span>
<span class="types"><span class="type">number</span></span>
Green component 0-1
</li>
<li><span class="parameter">b</span>
<span class="types"><span class="type">number</span></span>
Blue component 0-1
</li>
<li><span class="parameter">a</span>
<span class="types"><span class="type">number</span></span>
Alpha component 0-1
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">color</span></span>
out
</ol>
</dd>
<dt>
<a name = "from_hsv"></a>
<strong>from_hsv (h, s, v)</strong>
</dt>
<dd>
Convert hue,saturation,value to color object.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">h</span>
<span class="types"><span class="type">number</span></span>
hue 0-1
</li>
<li><span class="parameter">s</span>
<span class="types"><span class="type">number</span></span>
saturation 0-1
</li>
<li><span class="parameter">v</span>
<span class="types"><span class="type">number</span></span>
value 0-1
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">color</span></span>
out
</ol>
</dd>
<dt>
<a name = "from_hsva"></a>
<strong>from_hsva (h, s, v, a)</strong>
</dt>
<dd>
Convert hue,saturation,value to color object.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">h</span>
<span class="types"><span class="type">number</span></span>
hue 0-1
</li>
<li><span class="parameter">s</span>
<span class="types"><span class="type">number</span></span>
saturation 0-1
</li>
<li><span class="parameter">v</span>
<span class="types"><span class="type">number</span></span>
value 0-1
</li>
<li><span class="parameter">a</span>
<span class="types"><span class="type">number</span></span>
alpha 0-1
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">color</span></span>
out
</ol>
</dd>
<dt>
<a name = "invert"></a>
<strong>invert (to)</strong>
</dt>
<dd>
Invert a color.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">to</span>
<span class="types"><span class="type">color</span></span>
invert
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">color</span></span>
out
</ol>
</dd>
<dt>
<a name = "lighten"></a>
<strong>lighten (to, amount)</strong>
</dt>
<dd>
Lighten a color by a component-wise fixed amount (alpha unchanged)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">to</span>
<span class="types"><span class="type">color</span></span>
lighten
</li>
<li><span class="parameter">amount</span>
<span class="types"><span class="type">number</span></span>
to increase each component by, 0-1 scale
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">color</span></span>
out
</ol>
</dd>
<dt>
<a name = "lerp"></a>
<strong>lerp (at, at, s)</strong>
</dt>
<dd>
Interpolate between two colors.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">at</span>
<span class="types"><span class="type">color</span></span>
end
</li>
<li><span class="parameter">at</span>
<span class="types"><span class="type">color</span></span>
end
</li>
<li><span class="parameter">s</span>
<span class="types"><span class="type">number</span></span>
in 0-1 progress between the two colors
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">color</span></span>
out
</ol>
</dd>
<dt>
<a name = "unpack"></a>
<strong>unpack (to)</strong>
</dt>
<dd>
Unpack a color into individual components in 0-1.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">to</span>
<span class="types"><span class="type">color</span></span>
unpack
</li>
</ul>
<h3>Returns:</h3>
<ol>
<li>
<span class="types"><span class="type">number</span></span>
r in 0-1</li>
<li>
<span class="types"><span class="type">number</span></span>
g in 0-1</li>
<li>
<span class="types"><span class="type">number</span></span>
b in 0-1</li>
<li>
<span class="types"><span class="type">number</span></span>
a in 0-1</li>
</ol>
</dd>
<dt>
<a name = "as_255"></a>
<strong>as_255 (to)</strong>
</dt>
<dd>
Unpack a color into individual components in 0-255.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">to</span>
<span class="types"><span class="type">color</span></span>
unpack
</li>
</ul>
<h3>Returns:</h3>
<ol>
<li>
<span class="types"><span class="type">number</span></span>
r in 0-255</li>
<li>
<span class="types"><span class="type">number</span></span>
g in 0-255</li>
<li>
<span class="types"><span class="type">number</span></span>
b in 0-255</li>
<li>
<span class="types"><span class="type">number</span></span>
a in 0-255</li>
</ol>
</dd>
<dt>
<a name = "darken"></a>
<strong>darken (to, amount)</strong>
</dt>
<dd>
Darken a color by a component-wise fixed amount (alpha unchanged)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">to</span>
<span class="types"><span class="type">color</span></span>
darken
</li>
<li><span class="parameter">amount</span>
<span class="types"><span class="type">number</span></span>
to decrease each component by, 0-1 scale
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">color</span></span>
out
</ol>
</dd>
<dt>
<a name = "multiply"></a>
<strong>multiply (to, to)</strong>
</dt>
<dd>
Multiply a color's components by a value (alpha unchanged)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
multiply each component by
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
multiply each component by
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">color</span></span>
out
</ol>
</dd>
<dt>
<a name = "opacity"></a>
<strong>opacity (to, to)</strong>
</dt>
<dd>
Multiply a color's alpha by a value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
multiply alpha by
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
multiply alpha by
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">color</span></span>
out
</ol>
</dd>
<dt>
<a name = "hue"></a>
<strong>hue (to, to)</strong>
</dt>
<dd>
Set a color's hue (saturation, value, alpha unchanged)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">to</span>
<span class="types"><a class="type" href="../modules/color.html#hue">hue</a></span>
set 0-1
</li>
<li><span class="parameter">to</span>
<span class="types"><a class="type" href="../modules/color.html#hue">hue</a></span>
set 0-1
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">color</span></span>
out
</ol>
</dd>
<dt>
<a name = "saturation"></a>
<strong>saturation (to, to)</strong>
</dt>
<dd>
Set a color's saturation (hue, value, alpha unchanged)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">to</span>
<span class="types"><a class="type" href="../modules/color.html#saturation">saturation</a></span>
set 0-1
</li>
<li><span class="parameter">to</span>
<span class="types"><a class="type" href="../modules/color.html#saturation">saturation</a></span>
set 0-1
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">color</span></span>
out
</ol>
</dd>
<dt>
<a name = "value"></a>
<strong>value (to, to)</strong>
</dt>
<dd>
Set a color's value (saturation, hue, alpha unchanged)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">to</span>
<span class="types"><a class="type" href="../modules/color.html#value">value</a></span>
set 0-1
</li>
<li><span class="parameter">to</span>
<span class="types"><a class="type" href="../modules/color.html#value">value</a></span>
set 0-1
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">color</span></span>
out
</ol>
</dd>
<dt>
<a name = "is_color"></a>
<strong>is_color (to)</strong>
</dt>
<dd>
Check if color is valid
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">to</span>
<span class="types"><span class="type">color</span></span>
test
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">boolean</span></span>
is color
</ol>
</dd>
<dt>
<a name = "to_string"></a>
<strong>to_string (a)</strong>
</dt>
<dd>
Return a formatted string.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">a</span>
<span class="types"><span class="type">color</span></span>
color to be turned into a string
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
formatted
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "hsv_to_color_table"></a>
<strong>hsv_to_color_table</strong>
</dt>
<dd>
Convert hue,saturation,value table to color object.
<ul>
<li><span class="parameter">hsva</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
{hue 0-1, saturation 0-1, value 0-1, alpha 0-1}
</li>
</ul>
</dd>
<dt>
<a name = "color_to_hsv_table"></a>
<strong>color_to_hsv_table</strong>
</dt>
<dd>
Convert color to hue,saturation,value table
<ul>
<li><span class="parameter">in</span>
<span class="types"><span class="type">color</span></span>
</li>
</ul>
</dd>
</dl>
</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>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

125
docs/modules/constants.html Normal file
View File

@ -0,0 +1,125 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>CPML documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>CPML</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Tables">Tables</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/bound2.html">bound2</a></li>
<li><a href="../modules/bound3.html">bound3</a></li>
<li><a href="../modules/bvh.html">bvh</a></li>
<li><a href="../modules/color.html">color</a></li>
<li><strong>constants</strong></li>
<li><a href="../modules/intersect.html">intersect</a></li>
<li><a href="../modules/mat4.html">mat4</a></li>
<li><a href="../modules/mesh.html">mesh</a></li>
<li><a href="../modules/octree.html">octree</a></li>
<li><a href="../modules/quat.html">quat</a></li>
<li><a href="../modules/simplex.html">simplex</a></li>
<li><a href="../modules/utils.html">utils</a></li>
<li><a href="../modules/vec2.html">vec2</a></li>
<li><a href="../modules/vec3.html">vec3</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>constants</code></h1>
<p>Various useful constants</p>
<p>
</p>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#constants">constants</a></td>
<td class="summary">Constants</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "constants"></a>
<strong>constants</strong>
</dt>
<dd>
Constants
<h3>Fields:</h3>
<ul>
<li><span class="parameter">FLT_EPSILON</span>
Floating point precision breaks down
</li>
<li><span class="parameter">DBL_EPSILON</span>
Double-precise floating point precision breaks down
</li>
<li><span class="parameter">DOT_THRESHOLD</span>
Close enough to 1 for interpolations to occur
</li>
</ul>
</dd>
</dl>
</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>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -0,0 +1,84 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>CPML documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>CPML</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/bound2.html">bound2</a></li>
<li><a href="../modules/bound3.html">bound3</a></li>
<li><a href="../modules/bvh.html">bvh</a></li>
<li><a href="../modules/color.html">color</a></li>
<li><a href="../modules/constants.html">constants</a></li>
<li><strong>intersect</strong></li>
<li><a href="../modules/mat4.html">mat4</a></li>
<li><a href="../modules/mesh.html">mesh</a></li>
<li><a href="../modules/octree.html">octree</a></li>
<li><a href="../modules/quat.html">quat</a></li>
<li><a href="../modules/simplex.html">simplex</a></li>
<li><a href="../modules/utils.html">utils</a></li>
<li><a href="../modules/vec2.html">vec2</a></li>
<li><a href="../modules/vec3.html">vec3</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>intersect</code></h1>
<p>Various geometric intersections</p>
<p>
</p>
<br/>
<br/>
</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>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

1173
docs/modules/mat4.html Normal file

File diff suppressed because it is too large Load Diff

84
docs/modules/mesh.html Normal file
View File

@ -0,0 +1,84 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>CPML documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>CPML</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/bound2.html">bound2</a></li>
<li><a href="../modules/bound3.html">bound3</a></li>
<li><a href="../modules/bvh.html">bvh</a></li>
<li><a href="../modules/color.html">color</a></li>
<li><a href="../modules/constants.html">constants</a></li>
<li><a href="../modules/intersect.html">intersect</a></li>
<li><a href="../modules/mat4.html">mat4</a></li>
<li><strong>mesh</strong></li>
<li><a href="../modules/octree.html">octree</a></li>
<li><a href="../modules/quat.html">quat</a></li>
<li><a href="../modules/simplex.html">simplex</a></li>
<li><a href="../modules/utils.html">utils</a></li>
<li><a href="../modules/vec2.html">vec2</a></li>
<li><a href="../modules/vec3.html">vec3</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>mesh</code></h1>
<p>Mesh utilities</p>
<p>
</p>
<br/>
<br/>
</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>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

710
docs/modules/octree.html Normal file
View File

@ -0,0 +1,710 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>CPML documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>CPML</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/bound2.html">bound2</a></li>
<li><a href="../modules/bound3.html">bound3</a></li>
<li><a href="../modules/bvh.html">bvh</a></li>
<li><a href="../modules/color.html">color</a></li>
<li><a href="../modules/constants.html">constants</a></li>
<li><a href="../modules/intersect.html">intersect</a></li>
<li><a href="../modules/mat4.html">mat4</a></li>
<li><a href="../modules/mesh.html">mesh</a></li>
<li><strong>octree</strong></li>
<li><a href="../modules/quat.html">quat</a></li>
<li><a href="../modules/simplex.html">simplex</a></li>
<li><a href="../modules/utils.html">utils</a></li>
<li><a href="../modules/vec2.html">vec2</a></li>
<li><a href="../modules/vec3.html">vec3</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>octree</code></h1>
<p>Octree</p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#Octree:add">Octree:add (obj, objBounds)</a></td>
<td class="summary">Add an object.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Octree:remove">Octree:remove (obj)</a></td>
<td class="summary">Remove an object.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Octree:is_colliding">Octree:is_colliding (checkBounds)</a></td>
<td class="summary">Check if the specified bounds intersect with anything in the tree.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Octree:get_colliding">Octree:get_colliding (checkBounds)</a></td>
<td class="summary">Returns an array of objects that intersect with the specified bounds, if any.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Octree:cast_ray">Octree:cast_ray (ray, func, out)</a></td>
<td class="summary">Cast a ray through the node and its children</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Octree:draw_bounds">Octree:draw_bounds (cube)</a></td>
<td class="summary">Draws node boundaries visually for debugging.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Octree:draw_objects">Octree:draw_objects (cube, filter)</a></td>
<td class="summary">Draws the bounds of all objects in the tree visually for debugging.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Octree:grow">Octree:grow (direction)</a></td>
<td class="summary">Grow the octree to fit in all objects.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Octree:shrink">Octree:shrink ()</a></td>
<td class="summary">Shrink the octree if possible, else leave it the same.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#OctreeNode:add">OctreeNode:add (obj, objBounds)</a></td>
<td class="summary">Add an object.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#OctreeNode:remove">OctreeNode:remove (obj)</a></td>
<td class="summary">Remove an object.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#OctreeNode:is_colliding">OctreeNode:is_colliding (checkBounds)</a></td>
<td class="summary">Check if the specified bounds intersect with anything in the tree.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#OctreeNode:get_colliding">OctreeNode:get_colliding (checkBounds, results)</a></td>
<td class="summary">Returns an array of objects that intersect with the specified bounds, if any.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#OctreeNode:cast_ray">OctreeNode:cast_ray (ray, func, out, depth)</a></td>
<td class="summary">Cast a ray through the node and its children</td>
</tr>
<tr>
<td class="name" nowrap><a href="#OctreeNode:set_children">OctreeNode:set_children (childOctrees)</a></td>
<td class="summary">Set the 8 children of this octree.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#OctreeNode:shrink_if_possible">OctreeNode:shrink_if_possible (minLength)</a></td>
<td class="summary">We can shrink the octree if:
- This node is >= double minLength in length
- All objects in the root node are within one octant
- This node doesn't have children, or does but 7/8 children are empty
We can also shrink it if there are no objects left at all!</td>
</tr>
<tr>
<td class="name" nowrap><a href="#OctreeNode:set_values">OctreeNode:set_values (baseLength, minSize, looseness, center)</a></td>
<td class="summary">Set values for this node.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#OctreeNode:split">OctreeNode:split ()</a></td>
<td class="summary">Splits the octree into eight children.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#OctreeNode:merge">OctreeNode:merge ()</a></td>
<td class="summary">Merge all children into this node - the opposite of Split.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#OctreeNode:best_fit_child">OctreeNode:best_fit_child (objBounds)</a></td>
<td class="summary">Find which child node this object would be most likely to fit in.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#OctreeNode:should_merge">OctreeNode:should_merge ()</a></td>
<td class="summary">Checks if there are few enough objects in this node and its children that the children should all be merged into this.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#OctreeNode:has_any_objects">OctreeNode:has_any_objects ()</a></td>
<td class="summary">Checks if this node or anything below it has something in it.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "Octree:add"></a>
<strong>Octree:add (obj, objBounds)</strong>
</dt>
<dd>
Add an object.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">obj</span>
Object to add
</li>
<li><span class="parameter">objBounds</span>
3D bounding box around the object
</li>
</ul>
</dd>
<dt>
<a name = "Octree:remove"></a>
<strong>Octree:remove (obj)</strong>
</dt>
<dd>
Remove an object. Makes the assumption that the object only exists once in the tree.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">obj</span>
Object to remove
</li>
</ul>
<h3>Returns:</h3>
<ol>
bool True if the object was removed successfully
</ol>
</dd>
<dt>
<a name = "Octree:is_colliding"></a>
<strong>Octree:is_colliding (checkBounds)</strong>
</dt>
<dd>
Check if the specified bounds intersect with anything in the tree. See also: get_colliding.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">checkBounds</span>
bounds to check
</li>
</ul>
<h3>Returns:</h3>
<ol>
bool True if there was a collision
</ol>
</dd>
<dt>
<a name = "Octree:get_colliding"></a>
<strong>Octree:get_colliding (checkBounds)</strong>
</dt>
<dd>
Returns an array of objects that intersect with the specified bounds, if any. Otherwise returns an empty array. See also: is_colliding.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">checkBounds</span>
bounds to check
</li>
</ul>
<h3>Returns:</h3>
<ol>
table Objects that intersect with the specified bounds
</ol>
</dd>
<dt>
<a name = "Octree:cast_ray"></a>
<strong>Octree:cast_ray (ray, func, out)</strong>
</dt>
<dd>
Cast a ray through the node and its children
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">ray</span>
Ray with a position and a direction
</li>
<li><span class="parameter">func</span>
Function to execute on any objects within child nodes
</li>
<li><span class="parameter">out</span>
Table to store results of func in
</li>
</ul>
<h3>Returns:</h3>
<ol>
boolean True if an intersect detected
</ol>
</dd>
<dt>
<a name = "Octree:draw_bounds"></a>
<strong>Octree:draw_bounds (cube)</strong>
</dt>
<dd>
Draws node boundaries visually for debugging.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">cube</span>
</li>
</ul>
</dd>
<dt>
<a name = "Octree:draw_objects"></a>
<strong>Octree:draw_objects (cube, filter)</strong>
</dt>
<dd>
Draws the bounds of all objects in the tree visually for debugging.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">cube</span>
</li>
<li><span class="parameter">filter</span>
</li>
</ul>
</dd>
<dt>
<a name = "Octree:grow"></a>
<strong>Octree:grow (direction)</strong>
</dt>
<dd>
Grow the octree to fit in all objects.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">direction</span>
Direction to grow
</li>
</ul>
</dd>
<dt>
<a name = "Octree:shrink"></a>
<strong>Octree:shrink ()</strong>
</dt>
<dd>
Shrink the octree if possible, else leave it the same.
</dd>
<dt>
<a name = "OctreeNode:add"></a>
<strong>OctreeNode:add (obj, objBounds)</strong>
</dt>
<dd>
Add an object.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">obj</span>
Object to add
</li>
<li><span class="parameter">objBounds</span>
3D bounding box around the object
</li>
</ul>
<h3>Returns:</h3>
<ol>
boolean True if the object fits entirely within this node
</ol>
</dd>
<dt>
<a name = "OctreeNode:remove"></a>
<strong>OctreeNode:remove (obj)</strong>
</dt>
<dd>
Remove an object. Makes the assumption that the object only exists once in the tree.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">obj</span>
Object to remove
</li>
</ul>
<h3>Returns:</h3>
<ol>
boolean True if the object was removed successfully
</ol>
</dd>
<dt>
<a name = "OctreeNode:is_colliding"></a>
<strong>OctreeNode:is_colliding (checkBounds)</strong>
</dt>
<dd>
Check if the specified bounds intersect with anything in the tree. See also: get_colliding.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">checkBounds</span>
Bounds to check
</li>
</ul>
<h3>Returns:</h3>
<ol>
boolean True if there was a collision
</ol>
</dd>
<dt>
<a name = "OctreeNode:get_colliding"></a>
<strong>OctreeNode:get_colliding (checkBounds, results)</strong>
</dt>
<dd>
Returns an array of objects that intersect with the specified bounds, if any. Otherwise returns an empty array. See also: is_colliding.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">checkBounds</span>
Bounds to check. Passing by ref as it improve performance with structs
</li>
<li><span class="parameter">results</span>
List results
</li>
</ul>
<h3>Returns:</h3>
<ol>
table Objects that intersect with the specified bounds
</ol>
</dd>
<dt>
<a name = "OctreeNode:cast_ray"></a>
<strong>OctreeNode:cast_ray (ray, func, out, depth)</strong>
</dt>
<dd>
Cast a ray through the node and its children
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">ray</span>
Ray with a position and a direction
</li>
<li><span class="parameter">func</span>
Function to execute on any objects within child nodes
</li>
<li><span class="parameter">out</span>
Table to store results of func in
</li>
<li><span class="parameter">depth</span>
(used internally)
</li>
</ul>
<h3>Returns:</h3>
<ol>
boolean True if an intersect is detected
</ol>
</dd>
<dt>
<a name = "OctreeNode:set_children"></a>
<strong>OctreeNode:set_children (childOctrees)</strong>
</dt>
<dd>
Set the 8 children of this octree.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">childOctrees</span>
The 8 new child nodes
</li>
</ul>
</dd>
<dt>
<a name = "OctreeNode:shrink_if_possible"></a>
<strong>OctreeNode:shrink_if_possible (minLength)</strong>
</dt>
<dd>
We can shrink the octree if:
- This node is >= double minLength in length
- All objects in the root node are within one octant
- This node doesn't have children, or does but 7/8 children are empty
We can also shrink it if there are no objects left at all!
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">minLength</span>
Minimum dimensions of a node in this octree
</li>
</ul>
<h3>Returns:</h3>
<ol>
table The new root, or the existing one if we didn't shrink
</ol>
</dd>
<dt>
<a name = "OctreeNode:set_values"></a>
<strong>OctreeNode:set_values (baseLength, minSize, looseness, center)</strong>
</dt>
<dd>
Set values for this node.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">baseLength</span>
Length of this node, not taking looseness into account
</li>
<li><span class="parameter">minSize</span>
Minimum size of nodes in this octree
</li>
<li><span class="parameter">looseness</span>
Multiplier for baseLengthVal to get the actual size
</li>
<li><span class="parameter">center</span>
Centre position of this node
</li>
</ul>
</dd>
<dt>
<a name = "OctreeNode:split"></a>
<strong>OctreeNode:split ()</strong>
</dt>
<dd>
Splits the octree into eight children.
</dd>
<dt>
<a name = "OctreeNode:merge"></a>
<strong>OctreeNode:merge ()</strong>
</dt>
<dd>
Merge all children into this node - the opposite of Split.
Note: We only have to check one level down since a merge will never happen if the children already have children,
since THAT won't happen unless there are already too many objects to merge.
</dd>
<dt>
<a name = "OctreeNode:best_fit_child"></a>
<strong>OctreeNode:best_fit_child (objBounds)</strong>
</dt>
<dd>
Find which child node this object would be most likely to fit in.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">objBounds</span>
The object's bounds
</li>
</ul>
<h3>Returns:</h3>
<ol>
number One of the eight child octants
</ol>
</dd>
<dt>
<a name = "OctreeNode:should_merge"></a>
<strong>OctreeNode:should_merge ()</strong>
</dt>
<dd>
Checks if there are few enough objects in this node and its children that the children should all be merged into this.
<h3>Returns:</h3>
<ol>
boolean True there are less or the same abount of objects in this and its children than numObjectsAllowed
</ol>
</dd>
<dt>
<a name = "OctreeNode:has_any_objects"></a>
<strong>OctreeNode:has_any_objects ()</strong>
</dt>
<dd>
Checks if this node or anything below it has something in it.
<h3>Returns:</h3>
<ol>
boolean True if this node or any of its children, grandchildren etc have something in the
</ol>
</dd>
</dl>
</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>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

1273
docs/modules/quat.html Normal file

File diff suppressed because it is too large Load Diff

84
docs/modules/simplex.html Normal file
View File

@ -0,0 +1,84 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>CPML documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>CPML</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/bound2.html">bound2</a></li>
<li><a href="../modules/bound3.html">bound3</a></li>
<li><a href="../modules/bvh.html">bvh</a></li>
<li><a href="../modules/color.html">color</a></li>
<li><a href="../modules/constants.html">constants</a></li>
<li><a href="../modules/intersect.html">intersect</a></li>
<li><a href="../modules/mat4.html">mat4</a></li>
<li><a href="../modules/mesh.html">mesh</a></li>
<li><a href="../modules/octree.html">octree</a></li>
<li><a href="../modules/quat.html">quat</a></li>
<li><strong>simplex</strong></li>
<li><a href="../modules/utils.html">utils</a></li>
<li><a href="../modules/vec2.html">vec2</a></li>
<li><a href="../modules/vec3.html">vec3</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>simplex</code></h1>
<p>Simplex Noise</p>
<p>
</p>
<br/>
<br/>
</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>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

557
docs/modules/utils.html Normal file
View File

@ -0,0 +1,557 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>CPML documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>CPML</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/bound2.html">bound2</a></li>
<li><a href="../modules/bound3.html">bound3</a></li>
<li><a href="../modules/bvh.html">bvh</a></li>
<li><a href="../modules/color.html">color</a></li>
<li><a href="../modules/constants.html">constants</a></li>
<li><a href="../modules/intersect.html">intersect</a></li>
<li><a href="../modules/mat4.html">mat4</a></li>
<li><a href="../modules/mesh.html">mesh</a></li>
<li><a href="../modules/octree.html">octree</a></li>
<li><a href="../modules/quat.html">quat</a></li>
<li><a href="../modules/simplex.html">simplex</a></li>
<li><strong>utils</strong></li>
<li><a href="../modules/vec2.html">vec2</a></li>
<li><a href="../modules/vec3.html">vec3</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>utils</code></h1>
<p>Various utility functions</p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#clamp">clamp (value, min, max)</a></td>
<td class="summary">Clamps a value within the specified range.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#deadzone">deadzone (value, size)</a></td>
<td class="summary">Returns <code>value</code> if it is equal or greater than |<code>size</code>|, or 0.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#threshold">threshold (value, threshold)</a></td>
<td class="summary">Check if value is equal or greater than threshold.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#tolerance">tolerance (value, threshold)</a></td>
<td class="summary">Check if value is equal or less than threshold.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#map">map (value, min_in, max_in, min_out, max_out)</a></td>
<td class="summary">Scales a value from one range to another.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#lerp">lerp (low, high, progress)</a></td>
<td class="summary">Linear interpolation.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#decay">decay (low, high, rate, dt)</a></td>
<td class="summary">Exponential decay</td>
</tr>
<tr>
<td class="name" nowrap><a href="#smoothstep">smoothstep (progress, low, high)</a></td>
<td class="summary">Hermite interpolation.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#wrap">wrap (value, limit)</a></td>
<td class="summary">Wrap <code>value</code> around if it exceeds <code>limit</code>.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_pot">is_pot (value)</a></td>
<td class="summary">Check if a value is a power-of-two.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#sign">sign (value)</a></td>
<td class="summary">Get the sign of a number
returns 1 for positive values, -1 for negative and 0 for zero.</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#round">round</a></td>
<td class="summary">Round number at a given precision.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_nan">is_nan</a></td>
<td class="summary">Check if a value is NaN
Returns true if a number is not a valid number</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "clamp"></a>
<strong>clamp (value, min, max)</strong>
</dt>
<dd>
Clamps a value within the specified range.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">value</span>
Input value
</li>
<li><span class="parameter">min</span>
Minimum output value
</li>
<li><span class="parameter">max</span>
Maximum output value
</li>
</ul>
<h3>Returns:</h3>
<ol>
number
</ol>
</dd>
<dt>
<a name = "deadzone"></a>
<strong>deadzone (value, size)</strong>
</dt>
<dd>
Returns <code>value</code> if it is equal or greater than |<code>size</code>|, or 0.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">value</span>
</li>
<li><span class="parameter">size</span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
number
</ol>
</dd>
<dt>
<a name = "threshold"></a>
<strong>threshold (value, threshold)</strong>
</dt>
<dd>
Check if value is equal or greater than threshold.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">value</span>
</li>
<li><span class="parameter">threshold</span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
boolean
</ol>
</dd>
<dt>
<a name = "tolerance"></a>
<strong>tolerance (value, threshold)</strong>
</dt>
<dd>
Check if value is equal or less than threshold.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">value</span>
</li>
<li><span class="parameter">threshold</span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
boolean
</ol>
</dd>
<dt>
<a name = "map"></a>
<strong>map (value, min_in, max_in, min_out, max_out)</strong>
</dt>
<dd>
Scales a value from one range to another.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">value</span>
Input value
</li>
<li><span class="parameter">min_in</span>
Minimum input value
</li>
<li><span class="parameter">max_in</span>
Maximum input value
</li>
<li><span class="parameter">min_out</span>
Minimum output value
</li>
<li><span class="parameter">max_out</span>
Maximum output value
</li>
</ul>
<h3>Returns:</h3>
<ol>
number
</ol>
</dd>
<dt>
<a name = "lerp"></a>
<strong>lerp (low, high, progress)</strong>
</dt>
<dd>
Linear interpolation.
Performs linear interpolation between 0 and 1 when <code>low</code> &lt; <code>progress</code> &lt; <code>high</code>.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">low</span>
value to return when <code>progress</code> is 0
</li>
<li><span class="parameter">high</span>
value to return when <code>progress</code> is 1
</li>
<li><span class="parameter">progress</span>
(0-1)
</li>
</ul>
<h3>Returns:</h3>
<ol>
number
</ol>
</dd>
<dt>
<a name = "decay"></a>
<strong>decay (low, high, rate, dt)</strong>
</dt>
<dd>
Exponential decay
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">low</span>
initial value
</li>
<li><span class="parameter">high</span>
target value
</li>
<li><span class="parameter">rate</span>
portion of the original value remaining per second
</li>
<li><span class="parameter">dt</span>
time delta
</li>
</ul>
<h3>Returns:</h3>
<ol>
number
</ol>
</dd>
<dt>
<a name = "smoothstep"></a>
<strong>smoothstep (progress, low, high)</strong>
</dt>
<dd>
Hermite interpolation.
Performs smooth Hermite interpolation between 0 and 1 when <code>low</code> &lt; <code>progress</code> &lt; <code>high</code>.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">progress</span>
(0-1)
</li>
<li><span class="parameter">low</span>
value to return when <code>progress</code> is 0
</li>
<li><span class="parameter">high</span>
value to return when <code>progress</code> is 1
</li>
</ul>
<h3>Returns:</h3>
<ol>
number
</ol>
</dd>
<dt>
<a name = "wrap"></a>
<strong>wrap (value, limit)</strong>
</dt>
<dd>
Wrap <code>value</code> around if it exceeds <code>limit</code>.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">value</span>
</li>
<li><span class="parameter">limit</span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
number
</ol>
</dd>
<dt>
<a name = "is_pot"></a>
<strong>is_pot (value)</strong>
</dt>
<dd>
Check if a value is a power-of-two.
Returns true if a number is a valid power-of-two, otherwise false.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">value</span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
boolean
</ol>
</dd>
<dt>
<a name = "sign"></a>
<strong>sign (value)</strong>
</dt>
<dd>
Get the sign of a number
returns 1 for positive values, -1 for negative and 0 for zero.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">value</span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
number
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "round"></a>
<strong>round</strong>
</dt>
<dd>
Round number at a given precision.
Truncates <code>value</code> at <code>precision</code> points after the decimal (whole number if
left unspecified).
<ul>
<li><span class="parameter">value</span>
</li>
<li><span class="parameter">precision</span>
</li>
</ul>
</dd>
<dt>
<a name = "is_nan"></a>
<strong>is_nan</strong>
</dt>
<dd>
Check if a value is NaN
Returns true if a number is not a valid number
<ul>
<li><span class="parameter">value</span>
</li>
</ul>
</dd>
</dl>
</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>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

1124
docs/modules/vec2.html Normal file

File diff suppressed because it is too large Load Diff

1032
docs/modules/vec3.html Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,85 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>CPML documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>CPML</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><strong>readme</strong></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/bound2.html">bound2</a></li>
<li><a href="../modules/bound3.html">bound3</a></li>
<li><a href="../modules/bvh.html">bvh</a></li>
<li><a href="../modules/color.html">color</a></li>
<li><a href="../modules/constants.html">constants</a></li>
<li><a href="../modules/intersect.html">intersect</a></li>
<li><a href="../modules/mat4.html">mat4</a></li>
<li><a href="../modules/mesh.html">mesh</a></li>
<li><a href="../modules/octree.html">octree</a></li>
<li><a href="../modules/quat.html">quat</a></li>
<li><a href="../modules/simplex.html">simplex</a></li>
<li><a href="../modules/utils.html">utils</a></li>
<li><a href="../modules/vec2.html">vec2</a></li>
<li><a href="../modules/vec3.html">vec3</a></li>
</ul>
</div>
<div id="content">
<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>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>
<h3>TODO:</h3>
<p>* Vec3s and Vec2s are not currently adapted for functionality with MT vectors (seperate classes)</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>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -7,6 +7,6 @@ file = {
"../init.lua",
"../modules"
}
dir='./out'
dir='../docs'
readme='../README.md'
style='!new'

View File

@ -0,0 +1,3 @@
# literally just so I dont have to open powershell every time.
@echo off
ldoc .

View File

@ -428,27 +428,28 @@ end
-- @treturn roll
-- @treturn pitch
-- @treturn yaw
--no idea if this shit really works, very well could not...
function quat.to_euler_angles_unpack(q)
-- roll (x-axis rotation)
local sinr_cosp = 2 * (q.w * q.x + q.y * q.z)
local cosr_cosp = 1 - 2 * (q.x * q.x + q.y * q.y)
local roll = math.atan2(sinr_cosp, cosr_cosp)
local pitch = math.atan2(sinr_cosp, cosr_cosp)
-- pitch (y-axis rotation)
local sinp = 2 * (q.w * q.y - q.z * q.x)
local pitch
local yaw
if math.abs(sinp) >= 1 then
pitch = math.pi / 2 * ((sinp > 0) and 1 or -1) -- Use 90 degrees if out of range
yaw = math.pi / 2 * ((sinp > 0) and 1 or -1) -- Use 90 degrees if out of range
else
pitch = math.asin(sinp)
yaw = math.asin(sinp)
end
-- yaw (z-axis rotation)
local siny_cosp = 2 * (q.w * q.z + q.x * q.y)
local cosy_cosp = 1 - 2 * (q.y * q.y + q.z * q.z)
local yaw = math.atan2(siny_cosp, cosy_cosp)
local roll = math.atan2(siny_cosp, cosy_cosp)
return roll, pitch, yaw
return pitch, yaw, roll
end
--- Convert a quaternion into euler angles