diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 86dd81d..0000000 --- a/docs/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- - -

The CPML library ported to Luanti and extended.

- -

Modules

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bound2A 2 component bounding box.
bound3A 3-component axis-aligned bounding box.
bvhBVH Tree
colorColor utilities
constantsVarious useful constants
intersectVarious geometric intersections
mat4double 4x4, 1-based, column major matrices
meshMesh utilities
octreeOctree
quatA quaternion and associated utilities.
simplexSimplex Noise
utilsVarious utility functions
vec2A 2 component vector.
vec3A 3 component vector.
-

Topics

- - - - - -
readme.md
- -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/ldoc_new.css b/docs/ldoc_new.css deleted file mode 100644 index 13fef16..0000000 --- a/docs/ldoc_new.css +++ /dev/null @@ -1,290 +0,0 @@ -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; } diff --git a/docs/modules/bound2.html b/docs/modules/bound2.html deleted file mode 100644 index 80be4b7..0000000 --- a/docs/modules/bound2.html +++ /dev/null @@ -1,669 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module bound2

-

A 2 component bounding box.

-

- -

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new (min, max)The public constructor.
clone (a)Clone a bound.
at (a, b)Construct a bound covering one or two points
extend (a, point)Extend bound to include point
extend_bound (a, bound)Extend bound to entirety of other bound
size (a)Get size of bounding box as a vector
with_size (a, new)Resize bounding box from minimum corner
radius (a)Get half-size of bounding box as a vector.
center (a)Get center of bounding box
with_center (a, new)Move bounding box to new center
with_size_centered (a, new)Resize bounding box from center
check (a)Convert possibly-invalid bounding box to valid one
inset (a, a)Shrink bounding box with fixed margin
outset (a, a)Expand bounding box with fixed margin
offset (a, offset)Offset bounding box
contains (a, point)Test if point in bound
to_string (a)Return a formatted string.
- -
-
- - -

Functions

- -
-
- - new (min, max) -
-
- The public constructor. - - -

Parameters:

-
    -
  • min - Can be of two types:
    - vec2 min, minimum value for each component - nil Create bound at single point 0,0 -
  • -
  • max - vec2 - , maximum value for each component -
  • -
- -

Returns:

-
    - - bound2 - out -
- - - - -
-
- - clone (a) -
-
- Clone a bound. - - -

Parameters:

-
    -
  • a - bound2 - bound to be cloned -
  • -
- -

Returns:

-
    - - bound2 - out -
- - - - -
-
- - at (a, b) -
-
- Construct a bound covering one or two points - - -

Parameters:

-
    -
  • a - vec2 - Any vector -
  • -
  • b - vec2 - Any second vector (optional) -
  • -
- -

Returns:

-
    - - vec2 - Minimum bound containing the given points -
- - - - -
-
- - extend (a, point) -
-
- Extend bound to include point - - -

Parameters:

-
    -
  • a - bound2 - bound -
  • -
  • point - vec2 - to include -
  • -
- -

Returns:

-
    - - bound2 - Bound covering current min, current max and new point -
- - - - -
-
- - extend_bound (a, bound) -
-
- Extend bound to entirety of other bound - - -

Parameters:

-
    -
  • a - bound2 - bound -
  • -
  • bound - bound2 - to cover -
  • -
- -

Returns:

-
    - - bound2 - Bound covering current min and max of each bound in the pair -
- - - - -
-
- - size (a) -
-
- Get size of bounding box as a vector - - -

Parameters:

-
    -
  • a - bound2 - bound -
  • -
- -

Returns:

-
    - - vec2 - Vector spanning min to max points -
- - - - -
-
- - with_size (a, new) -
-
- Resize bounding box from minimum corner - - -

Parameters:

-
    -
  • a - bound2 - bound -
  • -
  • new - vec2 - size -
  • -
- -

Returns:

-
    - - bound2 - resized bound -
- - - - -
-
- - radius (a) -
-
- Get half-size of bounding box as a vector. A more correct term for this is probably "apothem" - - -

Parameters:

-
    -
  • a - bound2 - bound -
  • -
- -

Returns:

-
    - - vec2 - Vector spanning center to max point -
- - - - -
-
- - center (a) -
-
- Get center of bounding box - - -

Parameters:

-
    -
  • a - bound2 - bound -
  • -
- -

Returns:

-
    - - bound2 - Point in center of bound -
- - - - -
-
- - with_center (a, new) -
-
- Move bounding box to new center - - -

Parameters:

-
    -
  • a - bound2 - bound -
  • -
  • new - vec2 - center -
  • -
- -

Returns:

-
    - - bound2 - Bound with same size as input but different center -
- - - - -
-
- - with_size_centered (a, new) -
-
- Resize bounding box from center - - -

Parameters:

-
    -
  • a - bound2 - bound -
  • -
  • new - vec2 - size -
  • -
- -

Returns:

-
    - - bound2 - resized bound -
- - - - -
-
- - check (a) -
-
- Convert possibly-invalid bounding box to valid one - - -

Parameters:

-
    -
  • a - bound2 - bound -
  • -
- -

Returns:

-
    - - bound2 - bound with all components corrected for min-max property -
- - - - -
-
- - inset (a, a) -
-
- Shrink bounding box with fixed margin - - -

Parameters:

-
    -
  • a - vec2 - margin -
  • -
  • a - vec2 - margin -
  • -
- -

Returns:

-
    - - bound2 - bound with margin subtracted from all edges. May not be valid, consider calling check() -
- - - - -
-
- - outset (a, a) -
-
- Expand bounding box with fixed margin - - -

Parameters:

-
    -
  • a - vec2 - margin -
  • -
  • a - vec2 - margin -
  • -
- -

Returns:

-
    - - bound2 - bound with margin added to all edges. May not be valid, consider calling check() -
- - - - -
-
- - offset (a, offset) -
-
- Offset bounding box - - -

Parameters:

-
    -
  • a - bound2 - bound -
  • -
  • offset - vec2 - - - -
  • -
- -

Returns:

-
    - - bound2 - bound with same size, but position moved by offset -
- - - - -
-
- - contains (a, point) -
-
- Test if point in bound - - -

Parameters:

-
    -
  • a - bound2 - bound -
  • -
  • point - vec2 - to test -
  • -
- -

Returns:

-
    - - boolean - true if point in bounding box -
- - - - -
-
- - to_string (a) -
-
- Return a formatted string. - - -

Parameters:

-
    -
  • a - bound2 - bound to be turned into a string -
  • -
- -

Returns:

-
    - - string - formatted -
- - - - -
-
- - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/modules/bound3.html b/docs/modules/bound3.html deleted file mode 100644 index 222d1f2..0000000 --- a/docs/modules/bound3.html +++ /dev/null @@ -1,669 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module bound3

-

A 3-component axis-aligned bounding box.

-

- -

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new (min, max)The public constructor.
clone (a)Clone a bound.
at (a, b)Construct a bound covering one or two points
extend (a, point)Extend bound to include point
extend_bound (a, bound)Extend bound to entirety of other bound
size (a)Get size of bounding box as a vector
with_size (a, new)Resize bounding box from minimum corner
radius (a)Get half-size of bounding box as a vector.
center (a)Get center of bounding box
with_center (a, new)Move bounding box to new center
with_size_centered (a, new)Resize bounding box from center
check (a)Convert possibly-invalid bounding box to valid one
inset (a, a)Shrink bounding box with fixed margin
outset (a, a)Expand bounding box with fixed margin
offset (a, offset)Offset bounding box
contains (a, point)Test if point in bound
to_string (a)Return a formatted string.
- -
-
- - -

Functions

- -
-
- - new (min, max) -
-
- The public constructor. - - -

Parameters:

-
    -
  • min - Can be of two types:
    - vec3 min, minimum value for each component - nil Create bound at single point 0,0,0 -
  • -
  • max - vec3 - , maximum value for each component -
  • -
- -

Returns:

-
    - - bound3 - out -
- - - - -
-
- - clone (a) -
-
- Clone a bound. - - -

Parameters:

-
    -
  • a - bound3 - bound to be cloned -
  • -
- -

Returns:

-
    - - bound3 - out -
- - - - -
-
- - at (a, b) -
-
- Construct a bound covering one or two points - - -

Parameters:

-
    -
  • a - vec3 - Any vector -
  • -
  • b - vec3 - Any second vector (optional) -
  • -
- -

Returns:

-
    - - vec3 - Minimum bound containing the given points -
- - - - -
-
- - extend (a, point) -
-
- Extend bound to include point - - -

Parameters:

-
    -
  • a - bound3 - bound -
  • -
  • point - vec3 - to include -
  • -
- -

Returns:

-
    - - bound3 - Bound covering current min, current max and new point -
- - - - -
-
- - extend_bound (a, bound) -
-
- Extend bound to entirety of other bound - - -

Parameters:

-
    -
  • a - bound3 - bound -
  • -
  • bound - bound3 - to cover -
  • -
- -

Returns:

-
    - - bound3 - Bound covering current min and max of each bound in the pair -
- - - - -
-
- - size (a) -
-
- Get size of bounding box as a vector - - -

Parameters:

-
    -
  • a - bound3 - bound -
  • -
- -

Returns:

-
    - - vec3 - Vector spanning min to max points -
- - - - -
-
- - with_size (a, new) -
-
- Resize bounding box from minimum corner - - -

Parameters:

-
    -
  • a - bound3 - bound -
  • -
  • new - vec3 - size -
  • -
- -

Returns:

-
    - - bound3 - resized bound -
- - - - -
-
- - radius (a) -
-
- Get half-size of bounding box as a vector. A more correct term for this is probably "apothem" - - -

Parameters:

-
    -
  • a - bound3 - bound -
  • -
- -

Returns:

-
    - - vec3 - Vector spanning center to max point -
- - - - -
-
- - center (a) -
-
- Get center of bounding box - - -

Parameters:

-
    -
  • a - bound3 - bound -
  • -
- -

Returns:

-
    - - bound3 - Point in center of bound -
- - - - -
-
- - with_center (a, new) -
-
- Move bounding box to new center - - -

Parameters:

-
    -
  • a - bound3 - bound -
  • -
  • new - vec3 - center -
  • -
- -

Returns:

-
    - - bound3 - Bound with same size as input but different center -
- - - - -
-
- - with_size_centered (a, new) -
-
- Resize bounding box from center - - -

Parameters:

-
    -
  • a - bound3 - bound -
  • -
  • new - vec3 - size -
  • -
- -

Returns:

-
    - - bound3 - resized bound -
- - - - -
-
- - check (a) -
-
- Convert possibly-invalid bounding box to valid one - - -

Parameters:

-
    -
  • a - bound3 - bound -
  • -
- -

Returns:

-
    - - bound3 - bound with all components corrected for min-max property -
- - - - -
-
- - inset (a, a) -
-
- Shrink bounding box with fixed margin - - -

Parameters:

-
    -
  • a - vec3 - margin -
  • -
  • a - vec3 - margin -
  • -
- -

Returns:

-
    - - bound3 - bound with margin subtracted from all edges. May not be valid, consider calling check() -
- - - - -
-
- - outset (a, a) -
-
- Expand bounding box with fixed margin - - -

Parameters:

-
    -
  • a - vec3 - margin -
  • -
  • a - vec3 - margin -
  • -
- -

Returns:

-
    - - bound3 - bound with margin added to all edges. May not be valid, consider calling check() -
- - - - -
-
- - offset (a, offset) -
-
- Offset bounding box - - -

Parameters:

-
    -
  • a - bound3 - bound -
  • -
  • offset - vec3 - - - -
  • -
- -

Returns:

-
    - - bound3 - bound with same size, but position moved by offset -
- - - - -
-
- - contains (a, point) -
-
- Test if point in bound - - -

Parameters:

-
    -
  • a - bound3 - bound -
  • -
  • point - vec3 - to test -
  • -
- -

Returns:

-
    - - boolean - true if point in bounding box -
- - - - -
-
- - to_string (a) -
-
- Return a formatted string. - - -

Parameters:

-
    -
  • a - bound3 - bound to be turned into a string -
  • -
- -

Returns:

-
    - - string - formatted -
- - - - -
-
- - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/modules/bvh.html b/docs/modules/bvh.html deleted file mode 100644 index ff3d68d..0000000 --- a/docs/modules/bvh.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module bvh

-

BVH Tree

-

- -

- - - -
-
- - - - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/modules/color.html b/docs/modules/color.html deleted file mode 100644 index 0783d8f..0000000 --- a/docs/modules/color.html +++ /dev/null @@ -1,737 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module color

-

Color utilities

-

- -

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new (x, g, b, a)The public constructor.
from_hsv (h, s, v)Convert hue,saturation,value to color object.
from_hsva (h, s, v, a)Convert hue,saturation,value to color object.
invert (to)Invert a color.
lighten (to, amount)Lighten a color by a component-wise fixed amount (alpha unchanged)
lerp (at, at, s)Interpolate between two colors.
unpack (to)Unpack a color into individual components in 0-1.
as_255 (to)Unpack a color into individual components in 0-255.
darken (to, amount)Darken a color by a component-wise fixed amount (alpha unchanged)
multiply (to, to)Multiply a color's components by a value (alpha unchanged)
opacity (to, to)Multiply a color's alpha by a value
hue (to, to)Set a color's hue (saturation, value, alpha unchanged)
saturation (to, to)Set a color's saturation (hue, value, alpha unchanged)
value (to, to)Set a color's value (saturation, hue, alpha unchanged)
is_color (to)Check if color is valid
to_string (a)Return a formatted string.
-

Fields

- - - - - - - - - -
hsv_to_color_tableConvert hue,saturation,value table to color object.
color_to_hsv_tableConvert color to hue,saturation,value table
- -
-
- - -

Functions

- -
-
- - new (x, g, b, a) -
-
- The public constructor. - - -

Parameters:

-
    -
  • x - Can be of three types:
    - number red component 0-1 - table {r, g, b, a} - nil for {0,0,0,0} -
  • -
  • g - number - Green component 0-1 -
  • -
  • b - number - Blue component 0-1 -
  • -
  • a - number - Alpha component 0-1 -
  • -
- -

Returns:

-
    - - color - out -
- - - - -
-
- - from_hsv (h, s, v) -
-
- Convert hue,saturation,value to color object. - - -

Parameters:

-
    -
  • h - number - hue 0-1 -
  • -
  • s - number - saturation 0-1 -
  • -
  • v - number - value 0-1 -
  • -
- -

Returns:

-
    - - color - out -
- - - - -
-
- - from_hsva (h, s, v, a) -
-
- Convert hue,saturation,value to color object. - - -

Parameters:

-
    -
  • h - number - hue 0-1 -
  • -
  • s - number - saturation 0-1 -
  • -
  • v - number - value 0-1 -
  • -
  • a - number - alpha 0-1 -
  • -
- -

Returns:

-
    - - color - out -
- - - - -
-
- - invert (to) -
-
- Invert a color. - - -

Parameters:

-
    -
  • to - color - invert -
  • -
- -

Returns:

-
    - - color - out -
- - - - -
-
- - lighten (to, amount) -
-
- Lighten a color by a component-wise fixed amount (alpha unchanged) - - -

Parameters:

-
    -
  • to - color - lighten -
  • -
  • amount - number - to increase each component by, 0-1 scale -
  • -
- -

Returns:

-
    - - color - out -
- - - - -
-
- - lerp (at, at, s) -
-
- Interpolate between two colors. - - -

Parameters:

-
    -
  • at - color - end -
  • -
  • at - color - end -
  • -
  • s - number - in 0-1 progress between the two colors -
  • -
- -

Returns:

-
    - - color - out -
- - - - -
-
- - unpack (to) -
-
- Unpack a color into individual components in 0-1. - - -

Parameters:

-
    -
  • to - color - unpack -
  • -
- -

Returns:

-
    -
  1. - number - r in 0-1
  2. -
  3. - number - g in 0-1
  4. -
  5. - number - b in 0-1
  6. -
  7. - number - a in 0-1
  8. -
- - - - -
-
- - as_255 (to) -
-
- Unpack a color into individual components in 0-255. - - -

Parameters:

-
    -
  • to - color - unpack -
  • -
- -

Returns:

-
    -
  1. - number - r in 0-255
  2. -
  3. - number - g in 0-255
  4. -
  5. - number - b in 0-255
  6. -
  7. - number - a in 0-255
  8. -
- - - - -
-
- - darken (to, amount) -
-
- Darken a color by a component-wise fixed amount (alpha unchanged) - - -

Parameters:

-
    -
  • to - color - darken -
  • -
  • amount - number - to decrease each component by, 0-1 scale -
  • -
- -

Returns:

-
    - - color - out -
- - - - -
-
- - multiply (to, to) -
-
- Multiply a color's components by a value (alpha unchanged) - - -

Parameters:

-
    -
  • to - number - multiply each component by -
  • -
  • to - number - multiply each component by -
  • -
- -

Returns:

-
    - - color - out -
- - - - -
-
- - opacity (to, to) -
-
- Multiply a color's alpha by a value - - -

Parameters:

-
    -
  • to - number - multiply alpha by -
  • -
  • to - number - multiply alpha by -
  • -
- -

Returns:

-
    - - color - out -
- - - - -
-
- - hue (to, to) -
-
- Set a color's hue (saturation, value, alpha unchanged) - - -

Parameters:

-
    -
  • to - hue - set 0-1 -
  • -
  • to - hue - set 0-1 -
  • -
- -

Returns:

-
    - - color - out -
- - - - -
-
- - saturation (to, to) -
-
- Set a color's saturation (hue, value, alpha unchanged) - - -

Parameters:

- - -

Returns:

-
    - - color - out -
- - - - -
-
- - value (to, to) -
-
- Set a color's value (saturation, hue, alpha unchanged) - - -

Parameters:

-
    -
  • to - value - set 0-1 -
  • -
  • to - value - set 0-1 -
  • -
- -

Returns:

-
    - - color - out -
- - - - -
-
- - is_color (to) -
-
- Check if color is valid - - -

Parameters:

-
    -
  • to - color - test -
  • -
- -

Returns:

-
    - - boolean - is color -
- - - - -
-
- - to_string (a) -
-
- Return a formatted string. - - -

Parameters:

-
    -
  • a - color - color to be turned into a string -
  • -
- -

Returns:

-
    - - string - formatted -
- - - - -
-
-

Fields

- -
-
- - hsv_to_color_table -
-
- Convert hue,saturation,value table to color object. - - -
    -
  • hsva - table - {hue 0-1, saturation 0-1, value 0-1, alpha 0-1} -
  • -
- - - - - -
-
- - color_to_hsv_table -
-
- Convert color to hue,saturation,value table - - -
    -
  • in - color - - - -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/modules/constants.html b/docs/modules/constants.html deleted file mode 100644 index 3c38757..0000000 --- a/docs/modules/constants.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module constants

-

Various useful constants

-

- -

- - -

Tables

- - - - - -
constantsConstants
- -
-
- - -

Tables

- -
-
- - constants -
-
- Constants - - -

Fields:

-
    -
  • FLT_EPSILON - Floating point precision breaks down -
  • -
  • DBL_EPSILON - Double-precise floating point precision breaks down -
  • -
  • DOT_THRESHOLD - Close enough to 1 for interpolations to occur -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/modules/intersect.html b/docs/modules/intersect.html deleted file mode 100644 index 996d410..0000000 --- a/docs/modules/intersect.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module intersect

-

Various geometric intersections

-

- -

- - - -
-
- - - - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/modules/mat4.html b/docs/modules/mat4.html deleted file mode 100644 index 60d3421..0000000 --- a/docs/modules/mat4.html +++ /dev/null @@ -1,1512 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module mat4

-

double 4x4, 1-based, column major matrices

-

- -

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new (a)The public constructor.
identity (a)Create an identity matrix.
from_angle_axis (angle, axis)Create a matrix from an angle/axis pair.
from_quaternion (q)Create a matrix from a quaternion.
set_rot_from_quaternion (q)set the rotation of a matrix from a quaternion.
from_direction (direction, up)Create a matrix from a direction/up pair.
from_transform (trans, rot, scale)Create a matrix from a transform.
set_rot_zxy (pitch, yaw, roll)set the rotation of a given matrix in euler in the ZXY application order.
set_rot_luanti_entity (pitch, yaw, roll)alias of set_rot_zxy.
get_rot_zxy (the)get the ZXY euler rotation of the given matrix.
get_rot_luanti_entity (the)Alias of get_rot_zxy.
set_rot_xyz (pitch, yaw, roll)set the rotation of a given matrix in euler in the XYZ application order.
set_rot_irrlicht_bone (pitch, yaw, roll)alias of set_rot_xyz.
get_rot_xyz (the)Get the XYZ euler rotation of the given matrix.
get_rot_irrlicht_bone (the)Alias of get_rot_zxy.
from_ortho (left, right, top, bottom, near, far)Create matrix from orthogonal.
from_perspective (fovy, aspect, near, far)Create matrix from perspective.
clone (a)Clone a matrix.
mul (out, or, right)Multiply N matrices.
mul_vec3_perspective (out, a, b)Multiply a matrix and a vec3, with perspective division.
mul_vec4 (out, a, b)Multiply a matrix and a vec4.
invert (out, a)Invert a matrix.
scale (out, a, s)Scale a matrix.
rotate (out, a, angle, axis)Rotate a matrix.
translate (out, a, t)Translate a matrix.
shear (out, a, yx, zx, xy, zy, xz, yz)Shear a matrix.
reflect (Matrix, Matrix, position, normal)Reflect a matrix across a plane.
look_at (out, eye, center, up)Transform matrix to look at a point.
target (out, eye, center, up)Transform matrix to target a point.
transpose (out, a)Transpose a matrix.
project (obj, mvp, viewport)Project a point into screen space
unproject (win, mvp, viewport)Unproject a point from screen space to world space.
is_mat4 (a)Return a boolean showing if a table is or is not a mat4.
vec2.has_nan (a)Return whether any component is NaN
to_string (a)Return a formatted string.
to_vec4s (a)Convert a matrix to row vec4s.
to_vec4s_cols (a)Convert a matrix to col vec4s.
- -
-
- - -

Functions

- -
-
- - new (a) -
-
- The public constructor. - - -

Parameters:

-
    -
  • a - Can be of four types:
    - table Length 16 (4x4 matrix) - table Length 9 (3x3 matrix) - table Length 4 (4 vec4s) - nil -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - identity (a) -
-
- Create an identity matrix. - - -

Parameters:

-
    -
  • a - mat4 - Matrix to overwrite -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - from_angle_axis (angle, axis) -
-
- Create a matrix from an angle/axis pair. - - -

Parameters:

-
    -
  • angle - number - Angle of rotation -
  • -
  • axis - vec3 - Axis of rotation -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - from_quaternion (q) -
-
- Create a matrix from a quaternion. - - -

Parameters:

-
    -
  • q - quat - Rotation quaternion -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - set_rot_from_quaternion (q) -
-
- set the rotation of a matrix from a quaternion. Not sure at all where i got this code from, but it works... - i refactored so it works with https://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToMatrix/index.html - I think I got it from https://github.com/minetest/irrlicht/blob/7173c2c62997b6416f17b90f9a50bff11fef1c4c/include/quaternion.h#L367 - - -

Parameters:

-
    -
  • q - quat - rotation quaternion. only supports normal quaternion rotation (will normalize) -
  • -
- - - - - -
-
- - from_direction (direction, up) -
-
- Create a matrix from a direction/up pair. - - -

Parameters:

-
    -
  • direction - vec3 - Vector direction -
  • -
  • up - vec3 - Up direction -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - from_transform (trans, rot, scale) -
-
- Create a matrix from a transform. - - -

Parameters:

-
    -
  • trans - vec3 - Translation vector -
  • -
  • rot - quat - Rotation quaternion -
  • -
  • scale - vec3 - Scale vector -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - set_rot_zxy (pitch, yaw, roll) -
-
- set the rotation of a given matrix in euler in the ZXY application order. This is the order that minetest entities are rotated in. - - -

Parameters:

-
    -
  • pitch - float - the clockwise pitch in radians -
  • -
  • yaw - float - the clockwise yaw in radians -
  • -
  • roll - float - the clockwise yaw in roll -
  • -
- -

Returns:

-
    - - matrix - - - -
- - - - -
-
- - set_rot_luanti_entity (pitch, yaw, roll) -
-
- alias of set_rot_zxy. Sets the rotation of a given matrix in euler in the ZXY application order. This is the order that minetest entities are rotated in. - - -

Parameters:

-
    -
  • pitch - float - the clockwise pitch in radians -
  • -
  • yaw - float - the clockwise yaw in radians -
  • -
  • roll - float - the clockwise yaw in roll -
  • -
- -

Returns:

-
    - - matrix - - - -
- - - - -
-
- - get_rot_zxy (the) -
-
- get the ZXY euler rotation of the given matrix. This is the order that minetest entities are rotated in. - - -

Parameters:

-
    -
  • the - matrix - matrix to get the rotation of -
  • -
- -

Returns:

-
    -
  1. - float - pitch
  2. -
  3. - float - yaw
  4. -
  5. - float - roll
  6. -
- - - - -
-
- - get_rot_luanti_entity (the) -
-
- Alias of get_rot_zxy. Gets the ZXY euler rotation of the given matrix. This is the order that minetest entities are rotated in. - - -

Parameters:

-
    -
  • the - matrix - matrix to get the rotation of -
  • -
- -

Returns:

-
    -
  1. - float - pitch
  2. -
  3. - float - yaw
  4. -
  5. - float - roll
  6. -
- - - - -
-
- - set_rot_xyz (pitch, yaw, roll) -
-
- set the rotation of a given matrix in euler in the XYZ application order. This is the rotation order irrlicht uses (i.e. for bones in Luanti) - - -

Parameters:

-
    -
  • pitch - float - the clockwise pitch in radians -
  • -
  • yaw - float - the clockwise yaw in radians -
  • -
  • roll - float - the clockwise yaw in roll -
  • -
- -

Returns:

-
    - - matrix - - - -
- - - - -
-
- - set_rot_irrlicht_bone (pitch, yaw, roll) -
-
- alias of set_rot_xyz. Sets the rotation of a given matrix in euler in the XYZ application order. This is the rotation order irrlicht uses (i.e. for bones in Luanti) - - -

Parameters:

-
    -
  • pitch - float - the clockwise pitch in radians -
  • -
  • yaw - float - the clockwise yaw in radians -
  • -
  • roll - float - the clockwise yaw in roll -
  • -
- -

Returns:

-
    - - matrix - - - -
- - - - -
-
- - get_rot_xyz (the) -
-
- Get the XYZ euler rotation of the given matrix. This is the rotation order irrlicht uses (i.e. for bones in Luanti) - - -

Parameters:

-
    -
  • the - matrix - matrix to get the rotation of -
  • -
- -

Returns:

-
    -
  1. - float - pitch
  2. -
  3. - float - yaw
  4. -
  5. - float - roll
  6. -
- - - - -
-
- - get_rot_irrlicht_bone (the) -
-
- Alias of get_rot_zxy. Gets the XYZ euler rotation of the given matrix. This is the rotation order irrlicht uses (i.e. for bones in Luanti). - - -

Parameters:

-
    -
  • the - matrix - matrix to get the rotation of -
  • -
- -

Returns:

-
    -
  1. - float - pitch
  2. -
  3. - float - yaw
  4. -
  5. - float - roll
  6. -
- - - - -
-
- - from_ortho (left, right, top, bottom, near, far) -
-
- Create matrix from orthogonal. - - -

Parameters:

-
    -
  • left - number - - - -
  • -
  • right - number - - - -
  • -
  • top - number - - - -
  • -
  • bottom - number - - - -
  • -
  • near - number - - - -
  • -
  • far - number - - - -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - from_perspective (fovy, aspect, near, far) -
-
- Create matrix from perspective. - - -

Parameters:

-
    -
  • fovy - number - Field of view -
  • -
  • aspect - number - Aspect ratio -
  • -
  • near - number - Near plane -
  • -
  • far - number - Far plane -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - clone (a) -
-
- Clone a matrix. - - -

Parameters:

-
    -
  • a - mat4 - Matrix to clone -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - mul (out, or, right) -
-
- Multiply N matrices. - - -

Parameters:

-
    -
  • out - mat4 - Matrix to store the result -
  • -
  • or - mat4 - {mat4, ...} left hand operand(s) -
  • -
  • right - mat4 - hand operand if a is not table -
  • -
- -

Returns:

-
    - - mat4 - out multiplied matrix result -
- - - - -
-
- - mul_vec3_perspective (out, a, b) -
-
- Multiply a matrix and a vec3, with perspective division. - This function uses an implicit 1 for the fourth component. - - -

Parameters:

-
    -
  • out - vec3 - vec3 to store the result -
  • -
  • a - mat4 - Left hand operand -
  • -
  • b - vec3 - Right hand operand -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - mul_vec4 (out, a, b) -
-
- Multiply a matrix and a vec4. - - -

Parameters:

-
    -
  • out - table - table to store the result -
  • -
  • a - mat4 - Left hand operand -
  • -
  • b - table - Right hand operand -
  • -
- -

Returns:

-
    - - vec4 - out -
- - - - -
-
- - invert (out, a) -
-
- Invert a matrix. - - -

Parameters:

-
    -
  • out - mat4 - Matrix to store the result -
  • -
  • a - mat4 - Matrix to invert -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - scale (out, a, s) -
-
- Scale a matrix. - - -

Parameters:

-
    -
  • out - mat4 - Matrix to store the result -
  • -
  • a - mat4 - Matrix to scale -
  • -
  • s - vec3 - Scalar -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - rotate (out, a, angle, axis) -
-
- Rotate a matrix. - - -

Parameters:

-
    -
  • out - mat4 - Matrix to store the result -
  • -
  • a - mat4 - Matrix to rotate -
  • -
  • angle - number - Angle to rotate by (in radians) -
  • -
  • axis - vec3 - Axis to rotate on -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - translate (out, a, t) -
-
- Translate a matrix. - - -

Parameters:

-
    -
  • out - mat4 - Matrix to store the result -
  • -
  • a - mat4 - Matrix to translate -
  • -
  • t - vec3 - Translation vector -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - shear (out, a, yx, zx, xy, zy, xz, yz) -
-
- Shear a matrix. - - -

Parameters:

-
    -
  • out - mat4 - Matrix to store the result -
  • -
  • a - mat4 - Matrix to translate -
  • -
  • yx - number - - - -
  • -
  • zx - number - - - -
  • -
  • xy - number - - - -
  • -
  • zy - number - - - -
  • -
  • xz - number - - - -
  • -
  • yz - number - - - -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - reflect (Matrix, Matrix, position, normal) -
-
- Reflect a matrix across a plane. - - -

Parameters:

-
    -
  • Matrix - a - to reflect -
  • -
  • Matrix - a - to reflect -
  • -
  • position - vec3 - A point on the plane -
  • -
  • normal - vec3 - The (normalized!) normal vector of the plane -
  • -
- - - - - -
-
- - look_at (out, eye, center, up) -
-
- Transform matrix to look at a point. - - -

Parameters:

-
    -
  • out - mat4 - Matrix to store result -
  • -
  • eye - vec3 - Location of viewer's view plane -
  • -
  • center - vec3 - Location of object to view -
  • -
  • up - vec3 - Up direction -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - target (out, eye, center, up) -
-
- Transform matrix to target a point. - - -

Parameters:

-
    -
  • out - mat4 - Matrix to store result -
  • -
  • eye - vec3 - Location of viewer's view plane -
  • -
  • center - vec3 - Location of object to view -
  • -
  • up - vec3 - Up direction -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - transpose (out, a) -
-
- Transpose a matrix. - - -

Parameters:

-
    -
  • out - mat4 - Matrix to store the result -
  • -
  • a - mat4 - Matrix to transpose -
  • -
- -

Returns:

-
    - - mat4 - out -
- - - - -
-
- - project (obj, mvp, viewport) -
-
- Project a point into screen space - - -

Parameters:

-
    -
  • obj - vec3 - Object position in world space -
  • -
  • mvp - mat4 - Projection matrix -
  • -
  • viewport - table - XYWH of viewport -
  • -
- -

Returns:

-
    - - vec3 - win -
- - - - -
-
- - unproject (win, mvp, viewport) -
-
- Unproject a point from screen space to world space. - - -

Parameters:

-
    -
  • win - vec3 - Object position in screen space -
  • -
  • mvp - mat4 - Projection matrix -
  • -
  • viewport - table - XYWH of viewport -
  • -
- -

Returns:

-
    - - vec3 - obj -
- - - - -
-
- - is_mat4 (a) -
-
- Return a boolean showing if a table is or is not a mat4. - - -

Parameters:

-
    -
  • a - mat4 - Matrix to be tested -
  • -
- -

Returns:

-
    - - boolean - is_mat4 -
- - - - -
-
- - vec2.has_nan (a) -
-
- Return whether any component is NaN - - -

Parameters:

-
    -
  • a - mat4 - Matrix to be tested -
  • -
- -

Returns:

-
    - - boolean - if any component is NaN -
- - - - -
-
- - to_string (a) -
-
- Return a formatted string. - - -

Parameters:

-
    -
  • a - mat4 - Matrix to be turned into a string -
  • -
- -

Returns:

-
    - - string - formatted -
- - - - -
-
- - to_vec4s (a) -
-
- Convert a matrix to row vec4s. - - -

Parameters:

-
    -
  • a - mat4 - Matrix to be converted -
  • -
- -

Returns:

-
    - - table - vec4s -
- - - - -
-
- - to_vec4s_cols (a) -
-
- Convert a matrix to col vec4s. - - -

Parameters:

-
    -
  • a - mat4 - Matrix to be converted -
  • -
- -

Returns:

-
    - - table - vec4s -
- - - - -
-
- - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/modules/mesh.html b/docs/modules/mesh.html deleted file mode 100644 index 32b89ef..0000000 --- a/docs/modules/mesh.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module mesh

-

Mesh utilities

-

- -

- - - -
-
- - - - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/modules/octree.html b/docs/modules/octree.html deleted file mode 100644 index 2b7e5c7..0000000 --- a/docs/modules/octree.html +++ /dev/null @@ -1,710 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module octree

-

Octree

-

- -

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Octree:add (obj, objBounds)Add an object.
Octree:remove (obj)Remove an object.
Octree:is_colliding (checkBounds)Check if the specified bounds intersect with anything in the tree.
Octree:get_colliding (checkBounds)Returns an array of objects that intersect with the specified bounds, if any.
Octree:cast_ray (ray, func, out)Cast a ray through the node and its children
Octree:draw_bounds (cube)Draws node boundaries visually for debugging.
Octree:draw_objects (cube, filter)Draws the bounds of all objects in the tree visually for debugging.
Octree:grow (direction)Grow the octree to fit in all objects.
Octree:shrink ()Shrink the octree if possible, else leave it the same.
OctreeNode:add (obj, objBounds)Add an object.
OctreeNode:remove (obj)Remove an object.
OctreeNode:is_colliding (checkBounds)Check if the specified bounds intersect with anything in the tree.
OctreeNode:get_colliding (checkBounds, results)Returns an array of objects that intersect with the specified bounds, if any.
OctreeNode:cast_ray (ray, func, out, depth)Cast a ray through the node and its children
OctreeNode:set_children (childOctrees)Set the 8 children of this octree.
OctreeNode:shrink_if_possible (minLength)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!
OctreeNode:set_values (baseLength, minSize, looseness, center)Set values for this node.
OctreeNode:split ()Splits the octree into eight children.
OctreeNode:merge ()Merge all children into this node - the opposite of Split.
OctreeNode:best_fit_child (objBounds)Find which child node this object would be most likely to fit in.
OctreeNode:should_merge ()Checks if there are few enough objects in this node and its children that the children should all be merged into this.
OctreeNode:has_any_objects ()Checks if this node or anything below it has something in it.
- -
-
- - -

Functions

- -
-
- - Octree:add (obj, objBounds) -
-
- Add an object. - - -

Parameters:

-
    -
  • obj - Object to add -
  • -
  • objBounds - 3D bounding box around the object -
  • -
- - - - - -
-
- - Octree:remove (obj) -
-
- Remove an object. Makes the assumption that the object only exists once in the tree. - - -

Parameters:

-
    -
  • obj - Object to remove -
  • -
- -

Returns:

-
    - - bool True if the object was removed successfully -
- - - - -
-
- - Octree:is_colliding (checkBounds) -
-
- Check if the specified bounds intersect with anything in the tree. See also: get_colliding. - - -

Parameters:

-
    -
  • checkBounds - bounds to check -
  • -
- -

Returns:

-
    - - bool True if there was a collision -
- - - - -
-
- - Octree:get_colliding (checkBounds) -
-
- Returns an array of objects that intersect with the specified bounds, if any. Otherwise returns an empty array. See also: is_colliding. - - -

Parameters:

-
    -
  • checkBounds - bounds to check -
  • -
- -

Returns:

-
    - - table Objects that intersect with the specified bounds -
- - - - -
-
- - Octree:cast_ray (ray, func, out) -
-
- Cast a ray through the node and its children - - -

Parameters:

-
    -
  • ray - Ray with a position and a direction -
  • -
  • func - Function to execute on any objects within child nodes -
  • -
  • out - Table to store results of func in -
  • -
- -

Returns:

-
    - - boolean True if an intersect detected -
- - - - -
-
- - Octree:draw_bounds (cube) -
-
- Draws node boundaries visually for debugging. - - -

Parameters:

-
    -
  • cube - - - -
  • -
- - - - - -
-
- - Octree:draw_objects (cube, filter) -
-
- Draws the bounds of all objects in the tree visually for debugging. - - -

Parameters:

-
    -
  • cube - - - -
  • -
  • filter - - - -
  • -
- - - - - -
-
- - Octree:grow (direction) -
-
- Grow the octree to fit in all objects. - - -

Parameters:

-
    -
  • direction - Direction to grow -
  • -
- - - - - -
-
- - Octree:shrink () -
-
- Shrink the octree if possible, else leave it the same. - - - - - - - -
-
- - OctreeNode:add (obj, objBounds) -
-
- Add an object. - - -

Parameters:

-
    -
  • obj - Object to add -
  • -
  • objBounds - 3D bounding box around the object -
  • -
- -

Returns:

-
    - - boolean True if the object fits entirely within this node -
- - - - -
-
- - OctreeNode:remove (obj) -
-
- Remove an object. Makes the assumption that the object only exists once in the tree. - - -

Parameters:

-
    -
  • obj - Object to remove -
  • -
- -

Returns:

-
    - - boolean True if the object was removed successfully -
- - - - -
-
- - OctreeNode:is_colliding (checkBounds) -
-
- Check if the specified bounds intersect with anything in the tree. See also: get_colliding. - - -

Parameters:

-
    -
  • checkBounds - Bounds to check -
  • -
- -

Returns:

-
    - - boolean True if there was a collision -
- - - - -
-
- - OctreeNode:get_colliding (checkBounds, results) -
-
- Returns an array of objects that intersect with the specified bounds, if any. Otherwise returns an empty array. See also: is_colliding. - - -

Parameters:

-
    -
  • checkBounds - Bounds to check. Passing by ref as it improve performance with structs -
  • -
  • results - List results -
  • -
- -

Returns:

-
    - - table Objects that intersect with the specified bounds -
- - - - -
-
- - OctreeNode:cast_ray (ray, func, out, depth) -
-
- Cast a ray through the node and its children - - -

Parameters:

-
    -
  • ray - Ray with a position and a direction -
  • -
  • func - Function to execute on any objects within child nodes -
  • -
  • out - Table to store results of func in -
  • -
  • depth - (used internally) -
  • -
- -

Returns:

-
    - - boolean True if an intersect is detected -
- - - - -
-
- - OctreeNode:set_children (childOctrees) -
-
- Set the 8 children of this octree. - - -

Parameters:

-
    -
  • childOctrees - The 8 new child nodes -
  • -
- - - - - -
-
- - OctreeNode:shrink_if_possible (minLength) -
-
- 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! - - -

Parameters:

-
    -
  • minLength - Minimum dimensions of a node in this octree -
  • -
- -

Returns:

-
    - - table The new root, or the existing one if we didn't shrink -
- - - - -
-
- - OctreeNode:set_values (baseLength, minSize, looseness, center) -
-
- Set values for this node. - - -

Parameters:

-
    -
  • baseLength - Length of this node, not taking looseness into account -
  • -
  • minSize - Minimum size of nodes in this octree -
  • -
  • looseness - Multiplier for baseLengthVal to get the actual size -
  • -
  • center - Centre position of this node -
  • -
- - - - - -
-
- - OctreeNode:split () -
-
- Splits the octree into eight children. - - - - - - - -
-
- - OctreeNode:merge () -
-
- 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. - - - - - - - -
-
- - OctreeNode:best_fit_child (objBounds) -
-
- Find which child node this object would be most likely to fit in. - - -

Parameters:

-
    -
  • objBounds - The object's bounds -
  • -
- -

Returns:

-
    - - number One of the eight child octants -
- - - - -
-
- - OctreeNode:should_merge () -
-
- Checks if there are few enough objects in this node and its children that the children should all be merged into this. - - - -

Returns:

-
    - - boolean True there are less or the same abount of objects in this and its children than numObjectsAllowed -
- - - - -
-
- - OctreeNode:has_any_objects () -
-
- Checks if this node or anything below it has something in it. - - - -

Returns:

-
    - - boolean True if this node or any of its children, grandchildren etc have something in the -
- - - - -
-
- - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/modules/quat.html b/docs/modules/quat.html deleted file mode 100644 index ab1bca8..0000000 --- a/docs/modules/quat.html +++ /dev/null @@ -1,1410 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module quat

-

A quaternion and associated utilities.

-

- -

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new (x, y, z, w)The public constructor.
from_angle_axis (angle, axis, y, z)Create a quaternion from an angle/axis pair.
from_direction (normal, up)Create a quaternion from a normal/up vector pair.
clone (a)Clone a quaternion.
add (a, b)Add two quaternions.
sub (a, b)Subtract a quaternion from another.
mul_vec3 (a, v)Multiply a quaternion and a vec3.
pow (a, s)Raise a normalized quaternion to a scalar power.
normalize (a)Normalize a quaternion.
dot (a, b)Get the dot product of two quaternions.
len (a)Return the length of a quaternion.
len2 (a)Return the squared length of a quaternion.
scale (a, s)Multiply a quaternion by a scalar.
rotate (angle, axis, y, z)Alias of from_angle_axis.
conjugate (a)Return the conjugate of a quaternion.
inverse (a)Return the inverse of a quaternion.
reciprocal (a)Return the reciprocal of a quaternion.
lerp (a, b, s)Lerp between two quaternions.
slerp (a, b, s)Slerp between two quaternions.
unpack (a)Unpack a quaternion into individual components.
is_quat (a)Return a boolean showing if a table is or is not a quat.
is_zero (a)Return a boolean showing if a table is or is not a zero quat.
is_real (a)Return a boolean showing if a table is or is not a real quat.
is_imaginary (a)Return a boolean showing if a table is or is not an imaginary quat.
has_nan (a)Return whether any component is NaN
to_angle_axis_unpack (a, vec3)Convert a quaternion into an angle plus axis components.
to_angle_axis (a, vec3)Convert a quaternion into an angle/axis pair.
set_matrix_rot (quaternion, the)set a matrix's rotation fields from a quaternion.
from_matrix (the)create a new quaternion from a matrix.
get_rot_luanti_entity ()alias of get_euler_zxy
from_euler_zxy (X, Y, Z)create a quaternion from euler angles in the ZXY rotation order.
get_rot_luanti_entity ()alias of from_euler_zxy
get_euler_xyz (quaternion)convert a quaternion to an xyz euler angles.
get_rot_irrlicht_bone ()alias of get_euler_xyz
from_euler_xyz (X, Y, Z)create a quaternion from euler angles in the xyz rotation order.
get_rot_irrlicht_bone ()alias of quat.from_euler_zxy
to_vec3 (a)Convert a quaternion into a vec3.
to_string (a)Return a formatted string.
-

Tables

- - - - - -
quatConstants
- -
-
- - -

Functions

- -
-
- - new (x, y, z, w) -
-
- The public constructor. - - -

Parameters:

-
    -
  • x - Can be of two types:
    - number x X component - table {x, y, z, w} or {x=x, y=y, z=z, w=w} -
  • -
  • y - number - Y component -
  • -
  • z - number - Z component -
  • -
  • w - number - W component -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - from_angle_axis (angle, axis, y, z) -
-
- Create a quaternion from an angle/axis pair. - - -

Parameters:

-
    -
  • angle - number - Angle (in radians) -
  • -
  • axis - /x -- Can be of two types, a vec3 axis, or the x component of that axis -
  • -
  • y - axis -- y component of axis (optional, only if x component param used) -
  • -
  • z - axis -- z component of axis (optional, only if x component param used) -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - from_direction (normal, up) -
-
- Create a quaternion from a normal/up vector pair. (accepts minetest vectors) - - -

Parameters:

-
    -
  • normal - vec3 - - - -
  • -
  • up - vec3 - (optional) -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - clone (a) -
-
- Clone a quaternion. - - -

Parameters:

-
    -
  • a - quat - Quaternion to clone -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - add (a, b) -
-
- Add two quaternions. - - -

Parameters:

-
    -
  • a - quat - Left hand operand -
  • -
  • b - quat - Right hand operand -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - sub (a, b) -
-
- Subtract a quaternion from another. - - -

Parameters:

-
    -
  • a - quat - Left hand operand -
  • -
  • b - quat - Right hand operand -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - mul_vec3 (a, v) -
-
- Multiply a quaternion and a vec3. Equivalent to rotating the vector (a) by the quaternion (v) - - -

Parameters:

-
    -
  • a - quat - Left hand operand -
  • -
  • v - vec3 - Right hand operand -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - pow (a, s) -
-
- Raise a normalized quaternion to a scalar power. - - -

Parameters:

-
    -
  • a - quat - Left hand operand (should be a unit quaternion) -
  • -
  • s - number - Right hand operand -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - normalize (a) -
-
- Normalize a quaternion. - - -

Parameters:

-
    -
  • a - quat - Quaternion to normalize -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - dot (a, b) -
-
- Get the dot product of two quaternions. - - -

Parameters:

-
    -
  • a - quat - Left hand operand -
  • -
  • b - quat - Right hand operand -
  • -
- -

Returns:

-
    - - number - dot -
- - - - -
-
- - len (a) -
-
- Return the length of a quaternion. - - -

Parameters:

-
    -
  • a - quat - Quaternion to get length of -
  • -
- -

Returns:

-
    - - number - len -
- - - - -
-
- - len2 (a) -
-
- Return the squared length of a quaternion. - - -

Parameters:

-
    -
  • a - quat - Quaternion to get length of -
  • -
- -

Returns:

-
    - - number - len -
- - - - -
-
- - scale (a, s) -
-
- Multiply a quaternion by a scalar. - - -

Parameters:

-
    -
  • a - quat - Left hand operand -
  • -
  • s - number - Right hand operand -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - rotate (angle, axis, y, z) -
-
- Alias of from_angle_axis. - - -

Parameters:

-
    -
  • angle - number - Angle (in radians) -
  • -
  • axis - /x -- Can be of two types, a vec3 axis, or the x component of that axis -
  • -
  • y - axis -- y component of axis (optional, only if x component param used) -
  • -
  • z - axis -- z component of axis (optional, only if x component param used) -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - conjugate (a) -
-
- Return the conjugate of a quaternion. - - -

Parameters:

-
    -
  • a - quat - Quaternion to conjugate -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - inverse (a) -
-
- Return the inverse of a quaternion. - - -

Parameters:

-
    -
  • a - quat - Quaternion to invert -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - reciprocal (a) -
-
- Return the reciprocal of a quaternion. - - -

Parameters:

-
    -
  • a - quat - Quaternion to reciprocate -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - lerp (a, b, s) -
-
- Lerp between two quaternions. - - -

Parameters:

-
    -
  • a - quat - Left hand operand -
  • -
  • b - quat - Right hand operand -
  • -
  • s - number - Step value -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - slerp (a, b, s) -
-
- Slerp between two quaternions. - - -

Parameters:

-
    -
  • a - quat - Left hand operand -
  • -
  • b - quat - Right hand operand -
  • -
  • s - number - Step value -
  • -
- -

Returns:

-
    - - quat - out -
- - - - -
-
- - unpack (a) -
-
- Unpack a quaternion into individual components. - - -

Parameters:

-
    -
  • a - quat - Quaternion to unpack -
  • -
- -

Returns:

-
    -
  1. - number - x
  2. -
  3. - number - y
  4. -
  5. - number - z
  6. -
  7. - number - w
  8. -
- - - - -
-
- - is_quat (a) -
-
- Return a boolean showing if a table is or is not a quat. - - -

Parameters:

-
    -
  • a - quat - Quaternion to be tested -
  • -
- -

Returns:

-
    - - boolean - is_quat -
- - - - -
-
- - is_zero (a) -
-
- Return a boolean showing if a table is or is not a zero quat. - - -

Parameters:

-
    -
  • a - quat - Quaternion to be tested -
  • -
- -

Returns:

-
    - - boolean - is_zero -
- - - - -
-
- - is_real (a) -
-
- Return a boolean showing if a table is or is not a real quat. - - -

Parameters:

-
    -
  • a - quat - Quaternion to be tested -
  • -
- -

Returns:

-
    - - boolean - is_real -
- - - - -
-
- - is_imaginary (a) -
-
- Return a boolean showing if a table is or is not an imaginary quat. - - -

Parameters:

-
    -
  • a - quat - Quaternion to be tested -
  • -
- -

Returns:

-
    - - boolean - is_imaginary -
- - - - -
-
- - has_nan (a) -
-
- Return whether any component is NaN - - -

Parameters:

-
    -
  • a - quat - Quaternion to be tested -
  • -
- -

Returns:

-
    - - boolean - if x,y,z, or w is NaN -
- - - - -
-
- - to_angle_axis_unpack (a, vec3) -
-
- Convert a quaternion into an angle plus axis components. - - -

Parameters:

-
    -
  • a - quat - Quaternion to convert -
  • -
  • vec3 - identityAxis - of axis to use on identity/degenerate quaternions (optional, default returns 0,0,0,1) -
  • -
- -

Returns:

-
    -
  1. - number - angle
  2. -
  3. - x - axis-x
  4. -
  5. - y - axis-y
  6. -
  7. - z - axis-z
  8. -
- - - - -
-
- - to_angle_axis (a, vec3) -
-
- Convert a quaternion into an angle/axis pair. - - -

Parameters:

-
    -
  • a - quat - Quaternion to convert -
  • -
  • vec3 - identityAxis - of axis to use on identity/degenerate quaternions (optional, default returns 0,vec3(0,0,1)) -
  • -
- -

Returns:

-
    -
  1. - number - angle
  2. -
  3. - vec3 - axis
  4. -
- - - - -
-
- - set_matrix_rot (quaternion, the) -
-
- set a matrix's rotation fields from a quaternion. Uses mat4.setrotfrom_quaternion - - -

Parameters:

-
    -
  • quaternion - quat - to convert -
  • -
  • the - mat4 - mat4 to apply to. -
  • -
- -

Returns:

-
    - - mat4 - - - -
- - - - -
-
- - from_matrix (the) -
-
- create a new quaternion from a matrix. Uses mat4.to_quaternion - - -

Parameters:

-
    -
  • the - mat4 - matrix to use -
  • -
- -

Returns:

-
    - - quat - - - -
- - - - -
-
- - get_rot_luanti_entity () -
-
- alias of get_euler_zxy - - - - - - - -
-
- - from_euler_zxy (X, Y, Z) -
-
- create a quaternion from euler angles in the ZXY rotation order. This is the rotation order Luanti Entities use - - -

Parameters:

-
    -
  • X - float - - - -
  • -
  • Y - float - - - -
  • -
  • Z - float - - - -
  • -
- -

Returns:

-
    - - quat - q -
- - - - -
-
- - get_rot_luanti_entity () -
-
- alias of from_euler_zxy - - - - - - - -
-
- - get_euler_xyz (quaternion) -
-
- convert a quaternion to an xyz euler angles. This is the rotation order used by irrlicht bones. - - -

Parameters:

-
    -
  • quaternion - quat - to convert -
  • -
- -

Returns:

-
    -
  1. - X - - -
  2. -
  3. - Y - - -
  4. -
  5. - Z - - -
  6. -
- - - - -
-
- - get_rot_irrlicht_bone () -
-
- alias of get_euler_xyz - - - - - - - -
-
- - from_euler_xyz (X, Y, Z) -
-
- create a quaternion from euler angles in the xyz rotation order. This is the rotation order irrlicht bones use - - -

Parameters:

-
    -
  • X - float - - - -
  • -
  • Y - float - - - -
  • -
  • Z - float - - - -
  • -
- -

Returns:

-
    - - quat - q -
- - - - -
-
- - get_rot_irrlicht_bone () -
-
- alias of quat.from_euler_zxy - - - - - - - -
-
- - to_vec3 (a) -
-
- Convert a quaternion into a vec3. - - -

Parameters:

-
    -
  • a - quat - Quaternion to convert -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - to_string (a) -
-
- Return a formatted string. - - -

Parameters:

-
    -
  • a - quat - Quaternion to be turned into a string -
  • -
- -

Returns:

-
    - - string - formatted -
- - - - -
-
-

Tables

- -
-
- - quat -
-
- Constants - - -

Fields:

-
    -
  • unit - Unit quaternion -
  • -
  • zero - Empty quaternion -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/modules/simplex.html b/docs/modules/simplex.html deleted file mode 100644 index 7551bcc..0000000 --- a/docs/modules/simplex.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module simplex

-

Simplex Noise

-

- -

- - - -
-
- - - - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/modules/utils.html b/docs/modules/utils.html deleted file mode 100644 index c6786d3..0000000 --- a/docs/modules/utils.html +++ /dev/null @@ -1,557 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module utils

-

Various utility functions

-

- -

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
clamp (value, min, max)Clamps a value within the specified range.
deadzone (value, size)Returns value if it is equal or greater than |size|, or 0.
threshold (value, threshold)Check if value is equal or greater than threshold.
tolerance (value, threshold)Check if value is equal or less than threshold.
map (value, min_in, max_in, min_out, max_out)Scales a value from one range to another.
lerp (low, high, progress)Linear interpolation.
decay (low, high, rate, dt)Exponential decay
smoothstep (progress, low, high)Hermite interpolation.
wrap (value, limit)Wrap value around if it exceeds limit.
is_pot (value)Check if a value is a power-of-two.
sign (value)Get the sign of a number - returns 1 for positive values, -1 for negative and 0 for zero.
-

Fields

- - - - - - - - - -
roundRound number at a given precision.
is_nanCheck if a value is NaN - Returns true if a number is not a valid number
- -
-
- - -

Functions

- -
-
- - clamp (value, min, max) -
-
- Clamps a value within the specified range. - - -

Parameters:

-
    -
  • value - Input value -
  • -
  • min - Minimum output value -
  • -
  • max - Maximum output value -
  • -
- -

Returns:

-
    - - number -
- - - - -
-
- - deadzone (value, size) -
-
- Returns value if it is equal or greater than |size|, or 0. - - -

Parameters:

-
    -
  • value - - - -
  • -
  • size - - - -
  • -
- -

Returns:

-
    - - number -
- - - - -
-
- - threshold (value, threshold) -
-
- Check if value is equal or greater than threshold. - - -

Parameters:

-
    -
  • value - - - -
  • -
  • threshold - - - -
  • -
- -

Returns:

-
    - - boolean -
- - - - -
-
- - tolerance (value, threshold) -
-
- Check if value is equal or less than threshold. - - -

Parameters:

-
    -
  • value - - - -
  • -
  • threshold - - - -
  • -
- -

Returns:

-
    - - boolean -
- - - - -
-
- - map (value, min_in, max_in, min_out, max_out) -
-
- Scales a value from one range to another. - - -

Parameters:

-
    -
  • value - Input value -
  • -
  • min_in - Minimum input value -
  • -
  • max_in - Maximum input value -
  • -
  • min_out - Minimum output value -
  • -
  • max_out - Maximum output value -
  • -
- -

Returns:

-
    - - number -
- - - - -
-
- - lerp (low, high, progress) -
-
- Linear interpolation. - Performs linear interpolation between 0 and 1 when low < progress < high. - - -

Parameters:

-
    -
  • low - value to return when progress is 0 -
  • -
  • high - value to return when progress is 1 -
  • -
  • progress - (0-1) -
  • -
- -

Returns:

-
    - - number -
- - - - -
-
- - decay (low, high, rate, dt) -
-
- Exponential decay - - -

Parameters:

-
    -
  • low - initial value -
  • -
  • high - target value -
  • -
  • rate - portion of the original value remaining per second -
  • -
  • dt - time delta -
  • -
- -

Returns:

-
    - - number -
- - - - -
-
- - smoothstep (progress, low, high) -
-
- Hermite interpolation. - Performs smooth Hermite interpolation between 0 and 1 when low < progress < high. - - -

Parameters:

-
    -
  • progress - (0-1) -
  • -
  • low - value to return when progress is 0 -
  • -
  • high - value to return when progress is 1 -
  • -
- -

Returns:

-
    - - number -
- - - - -
-
- - wrap (value, limit) -
-
- Wrap value around if it exceeds limit. - - -

Parameters:

-
    -
  • value - - - -
  • -
  • limit - - - -
  • -
- -

Returns:

-
    - - number -
- - - - -
-
- - is_pot (value) -
-
- Check if a value is a power-of-two. - Returns true if a number is a valid power-of-two, otherwise false. - - -

Parameters:

-
    -
  • value - - - -
  • -
- -

Returns:

-
    - - boolean -
- - - - -
-
- - sign (value) -
-
- Get the sign of a number - returns 1 for positive values, -1 for negative and 0 for zero. - - -

Parameters:

-
    -
  • value - - - -
  • -
- -

Returns:

-
    - - number -
- - - - -
-
-

Fields

- -
-
- - round -
-
- Round number at a given precision. - Truncates value at precision points after the decimal (whole number if - left unspecified). - - -
    -
  • value - - - -
  • -
  • precision - - - -
  • -
- - - - - -
-
- - is_nan -
-
- Check if a value is NaN - Returns true if a number is not a valid number - - -
    -
  • value - - - -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/modules/vec2.html b/docs/modules/vec2.html deleted file mode 100644 index e55c07b..0000000 --- a/docs/modules/vec2.html +++ /dev/null @@ -1,1124 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module vec2

-

A 2 component vector.

-

- -

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new (x, y)The public constructor.
from_cartesian (radius, theta)Convert point from polar to cartesian.
clone (a)Clone a vector.
add (a, b)Add two vectors.
sub (a, b)Subtract one vector from another.
mul (a, b)Multiply a vector by another vector.
div (a, b)Divide a vector by another vector.
normalize (a)Get the normal of a vector.
trim (a, len)Trim a vector to a given length.
cross (a, b)Get the cross product of two vectors.
dot (a, b)Get the dot product of two vectors.
len (a)Get the length of a vector.
len2 (a)Get the squared length of a vector.
dist (a, b)Get the distance between two vectors.
dist2 (a, b)Get the squared distance between two vectors.
scale (a, b)Scale a vector by a scalar.
rotate (a, phi)Rotate a vector.
perpendicular (a)Get the perpendicular vector of a vector.
angle_to (a, b)Signed angle from one vector to another.
angle_between (a, b)Unsigned angle between two vectors.
lerp (a, b, s)Lerp between two vectors.
unpack (a)Unpack a vector into individual components.
component_min (a, b)Return the component-wise minimum of two vectors.
component_max (a, b)Return the component-wise maximum of two vectors.
is_vec2 (a)Return a boolean showing if a table is or is not a vec2.
is_zero (a)Return a boolean showing if a table is or is not a zero vec2.
has_nan (a)Return whether either value is NaN
to_polar (a)Convert point from cartesian to polar.
to_string (a)Return a formatted string.
-

Tables

- - - - - -
vec2Constants
- -
-
- - -

Functions

- -
-
- - new (x, y) -
-
- The public constructor. - - -

Parameters:

-
    -
  • x - Can be of three types:
    - number X component - table {x, y} or {x = x, y = y} - scalar to fill the vector eg. {x, x} -
  • -
  • y - number - Y component -
  • -
- -

Returns:

-
    - - vec2 - out -
- - - - -
-
- - from_cartesian (radius, theta) -
-
- Convert point from polar to cartesian. - - -

Parameters:

-
    -
  • radius - number - Radius of the point -
  • -
  • theta - number - Angle of the point (in radians) -
  • -
- -

Returns:

-
    - - vec2 - out -
- - - - -
-
- - clone (a) -
-
- Clone a vector. - - -

Parameters:

-
    -
  • a - vec2 - Vector to be cloned -
  • -
- -

Returns:

-
    - - vec2 - out -
- - - - -
-
- - add (a, b) -
-
- Add two vectors. - - -

Parameters:

-
    -
  • a - vec2 - Left hand operand -
  • -
  • b - vec2 - Right hand operand -
  • -
- -

Returns:

-
    - - vec2 - out -
- - - - -
-
- - sub (a, b) -
-
- Subtract one vector from another. - Order: If a and b are positions, computes the direction and distance from b - to a. - - -

Parameters:

-
    -
  • a - vec2 - Left hand operand -
  • -
  • b - vec2 - Right hand operand -
  • -
- -

Returns:

-
    - - vec2 - out -
- - - - -
-
- - mul (a, b) -
-
- Multiply a vector by another vector. - Component-size multiplication not matrix multiplication. - - -

Parameters:

-
    -
  • a - vec2 - Left hand operand -
  • -
  • b - vec2 - Right hand operand -
  • -
- -

Returns:

-
    - - vec2 - out -
- - - - -
-
- - div (a, b) -
-
- Divide a vector by another vector. - Component-size inv multiplication. Like a non-uniform scale(). - - -

Parameters:

-
    -
  • a - vec2 - Left hand operand -
  • -
  • b - vec2 - Right hand operand -
  • -
- -

Returns:

-
    - - vec2 - out -
- - - - -
-
- - normalize (a) -
-
- Get the normal of a vector. - - -

Parameters:

-
    -
  • a - vec2 - Vector to normalize -
  • -
- -

Returns:

-
    - - vec2 - out -
- - - - -
-
- - trim (a, len) -
-
- Trim a vector to a given length. - - -

Parameters:

-
    -
  • a - vec2 - Vector to be trimmed -
  • -
  • len - number - Length to trim the vector to -
  • -
- -

Returns:

-
    - - vec2 - out -
- - - - -
-
- - cross (a, b) -
-
- Get the cross product of two vectors. - Order: Positive if a is clockwise from b. Magnitude is the area spanned by - the parallelograms that a and b span. - - -

Parameters:

-
    -
  • a - vec2 - Left hand operand -
  • -
  • b - vec2 - Right hand operand -
  • -
- -

Returns:

-
    - - number - magnitude -
- - - - -
-
- - dot (a, b) -
-
- Get the dot product of two vectors. - - -

Parameters:

-
    -
  • a - vec2 - Left hand operand -
  • -
  • b - vec2 - Right hand operand -
  • -
- -

Returns:

-
    - - number - dot -
- - - - -
-
- - len (a) -
-
- Get the length of a vector. - - -

Parameters:

-
    -
  • a - vec2 - Vector to get the length of -
  • -
- -

Returns:

-
    - - number - len -
- - - - -
-
- - len2 (a) -
-
- Get the squared length of a vector. - - -

Parameters:

-
    -
  • a - vec2 - Vector to get the squared length of -
  • -
- -

Returns:

-
    - - number - len -
- - - - -
-
- - dist (a, b) -
-
- Get the distance between two vectors. - - -

Parameters:

-
    -
  • a - vec2 - Left hand operand -
  • -
  • b - vec2 - Right hand operand -
  • -
- -

Returns:

-
    - - number - dist -
- - - - -
-
- - dist2 (a, b) -
-
- Get the squared distance between two vectors. - - -

Parameters:

-
    -
  • a - vec2 - Left hand operand -
  • -
  • b - vec2 - Right hand operand -
  • -
- -

Returns:

-
    - - number - dist -
- - - - -
-
- - scale (a, b) -
-
- Scale a vector by a scalar. - - -

Parameters:

-
    -
  • a - vec2 - Left hand operand -
  • -
  • b - number - Right hand operand -
  • -
- -

Returns:

-
    - - vec2 - out -
- - - - -
-
- - rotate (a, phi) -
-
- Rotate a vector. - - -

Parameters:

-
    -
  • a - vec2 - Vector to rotate -
  • -
  • phi - number - Angle to rotate vector by (in radians) -
  • -
- -

Returns:

-
    - - vec2 - out -
- - - - -
-
- - perpendicular (a) -
-
- Get the perpendicular vector of a vector. - - -

Parameters:

-
    -
  • a - vec2 - Vector to get perpendicular axes from -
  • -
- -

Returns:

-
    - - vec2 - out -
- - - - -
-
- - angle_to (a, b) -
-
- Signed angle from one vector to another. - Rotations from +x to +y are positive. - - -

Parameters:

-
    -
  • a - vec2 - Vector -
  • -
  • b - vec2 - Vector -
  • -
- -

Returns:

-
    - - number - angle in (-pi, pi] -
- - - - -
-
- - angle_between (a, b) -
-
- Unsigned angle between two vectors. - Directionless and thus commutative. - - -

Parameters:

-
    -
  • a - vec2 - Vector -
  • -
  • b - vec2 - Vector -
  • -
- -

Returns:

-
    - - number - angle in [0, pi] -
- - - - -
-
- - lerp (a, b, s) -
-
- Lerp between two vectors. - - -

Parameters:

-
    -
  • a - vec2 - Left hand operand -
  • -
  • b - vec2 - Right hand operand -
  • -
  • s - number - Step value -
  • -
- -

Returns:

-
    - - vec2 - out -
- - - - -
-
- - unpack (a) -
-
- Unpack a vector into individual components. - - -

Parameters:

-
    -
  • a - vec2 - Vector to unpack -
  • -
- -

Returns:

-
    -
  1. - number - x
  2. -
  3. - number - y
  4. -
- - - - -
-
- - component_min (a, b) -
-
- Return the component-wise minimum of two vectors. - - -

Parameters:

-
    -
  • a - vec2 - Left hand operand -
  • -
  • b - vec2 - Right hand operand -
  • -
- -

Returns:

-
    - - vec2 - A vector where each component is the lesser value for that component between the two given vectors. -
- - - - -
-
- - component_max (a, b) -
-
- Return the component-wise maximum of two vectors. - - -

Parameters:

-
    -
  • a - vec2 - Left hand operand -
  • -
  • b - vec2 - Right hand operand -
  • -
- -

Returns:

-
    - - vec2 - A vector where each component is the lesser value for that component between the two given vectors. -
- - - - -
-
- - is_vec2 (a) -
-
- Return a boolean showing if a table is or is not a vec2. - - -

Parameters:

-
    -
  • a - vec2 - Vector to be tested -
  • -
- -

Returns:

-
    - - boolean - is_vec2 -
- - - - -
-
- - is_zero (a) -
-
- Return a boolean showing if a table is or is not a zero vec2. - - -

Parameters:

-
    -
  • a - vec2 - Vector to be tested -
  • -
- -

Returns:

-
    - - boolean - is_zero -
- - - - -
-
- - has_nan (a) -
-
- Return whether either value is NaN - - -

Parameters:

-
    -
  • a - vec2 - Vector to be tested -
  • -
- -

Returns:

-
    - - boolean - if x or y is nan -
- - - - -
-
- - to_polar (a) -
-
- Convert point from cartesian to polar. - - -

Parameters:

-
    -
  • a - vec2 - Vector to convert -
  • -
- -

Returns:

-
    -
  1. - number - radius
  2. -
  3. - number - theta
  4. -
- - - - -
-
- - to_string (a) -
-
- Return a formatted string. - - -

Parameters:

-
    -
  • a - vec2 - Vector to be turned into a string -
  • -
- -

Returns:

-
    - - string - formatted -
- - - - -
-
-

Tables

- -
-
- - vec2 -
-
- Constants - - -

Fields:

-
    -
  • unit_x - X axis of rotation -
  • -
  • unit_y - Y axis of rotation -
  • -
  • zero - Empty vector -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/modules/vec3.html b/docs/modules/vec3.html deleted file mode 100644 index 6260a4f..0000000 --- a/docs/modules/vec3.html +++ /dev/null @@ -1,1032 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- -

Module vec3

-

A 3 component vector.

-

- -

- - -

Functions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new (x, y, z)The public constructor.
clone (a)Clone a vector.
add (a, b)Add two vectors.
sub (a, b)Subtract one vector from another.
mul (a, b)Multiply a vector by another vector.
div (a, b)Divide a vector by another.
normalize (a)Scale a vector to unit length (1).
normalize_len (a)Scale a vector to unit length (1), and return the input length.
trim (a, len)Trim a vector to a given length
cross (a, b)Get the cross product of two vectors.
dot (a, b)Get the dot product of two vectors.
len (a)Get the length of a vector.
len2 (a)Get the squared length of a vector.
dist (a, b)Get the distance between two vectors.
dist2 (a, b)Get the squared distance between two vectors.
scale (a, b)Scale a vector by a scalar.
rotate (a, phi, axis)Rotate vector about an axis.
perpendicular (a)Get the perpendicular vector of a vector.
lerp (a, b, s)Lerp between two vectors.
unpack (a)Unpack a vector into individual components.
component_min (a, b)Return the component-wise minimum of two vectors.
component_max (a, b)Return the component-wise maximum of two vectors.
is_vec3 (a)Return a boolean showing if a table is or is not a vec3.
is_zero (a)Return a boolean showing if a table is or is not a zero vec3.
has_nan (a)Return whether any component is NaN
to_string (a)Return a formatted string.
-

Tables

- - - - - -
vec3Constants
- -
-
- - -

Functions

- -
-
- - new (x, y, z) -
-
- The public constructor. - - -

Parameters:

-
    -
  • x - Can be of three types:
    - number X component - table {x, y, z} or {x=x, y=y, z=z} - scalar To fill the vector eg. {x, x, x} -
  • -
  • y - number - Y component -
  • -
  • z - number - Z component -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - clone (a) -
-
- Clone a vector. - - -

Parameters:

-
    -
  • a - vec3 - Vector to be cloned -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - add (a, b) -
-
- Add two vectors. - - -

Parameters:

-
    -
  • a - vec3 - Left hand operand -
  • -
  • b - vec3 - Right hand operand -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - sub (a, b) -
-
- Subtract one vector from another. - Order: If a and b are positions, computes the direction and distance from b - to a. - - -

Parameters:

-
    -
  • a - vec3 - Left hand operand -
  • -
  • b - vec3 - Right hand operand -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - mul (a, b) -
-
- Multiply a vector by another vector. - Component-wise multiplication not matrix multiplication. - - -

Parameters:

-
    -
  • a - vec3 - Left hand operand -
  • -
  • b - vec3 - Right hand operand -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - div (a, b) -
-
- Divide a vector by another. - Component-wise inv multiplication. Like a non-uniform scale(). - - -

Parameters:

-
    -
  • a - vec3 - Left hand operand -
  • -
  • b - vec3 - Right hand operand -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - normalize (a) -
-
- Scale a vector to unit length (1). - - -

Parameters:

-
    -
  • a - vec3 - vector to normalize -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - normalize_len (a) -
-
- Scale a vector to unit length (1), and return the input length. - - -

Parameters:

-
    -
  • a - vec3 - vector to normalize -
  • -
- -

Returns:

-
    -
  1. - vec3 - out
  2. -
  3. - number - input vector length
  4. -
- - - - -
-
- - trim (a, len) -
-
- Trim a vector to a given length - - -

Parameters:

-
    -
  • a - vec3 - vector to be trimmed -
  • -
  • len - number - Length to trim the vector to -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - cross (a, b) -
-
- Get the cross product of two vectors. - Resulting direction is right-hand rule normal of plane defined by a and b. - Magnitude is the area spanned by the parallelograms that a and b span. - Order: Direction determined by right-hand rule. - - -

Parameters:

-
    -
  • a - vec3 - Left hand operand -
  • -
  • b - vec3 - Right hand operand -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - dot (a, b) -
-
- Get the dot product of two vectors. - - -

Parameters:

-
    -
  • a - vec3 - Left hand operand -
  • -
  • b - vec3 - Right hand operand -
  • -
- -

Returns:

-
    - - number - dot -
- - - - -
-
- - len (a) -
-
- Get the length of a vector. - - -

Parameters:

-
    -
  • a - vec3 - Vector to get the length of -
  • -
- -

Returns:

-
    - - number - len -
- - - - -
-
- - len2 (a) -
-
- Get the squared length of a vector. - - -

Parameters:

-
    -
  • a - vec3 - Vector to get the squared length of -
  • -
- -

Returns:

-
    - - number - len -
- - - - -
-
- - dist (a, b) -
-
- Get the distance between two vectors. - - -

Parameters:

-
    -
  • a - vec3 - Left hand operand -
  • -
  • b - vec3 - Right hand operand -
  • -
- -

Returns:

-
    - - number - dist -
- - - - -
-
- - dist2 (a, b) -
-
- Get the squared distance between two vectors. - - -

Parameters:

-
    -
  • a - vec3 - Left hand operand -
  • -
  • b - vec3 - Right hand operand -
  • -
- -

Returns:

-
    - - number - dist -
- - - - -
-
- - scale (a, b) -
-
- Scale a vector by a scalar. - - -

Parameters:

-
    -
  • a - vec3 - Left hand operand -
  • -
  • b - number - Right hand operand -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - rotate (a, phi, axis) -
-
- Rotate vector about an axis. - - -

Parameters:

-
    -
  • a - vec3 - Vector to rotate -
  • -
  • phi - number - Angle to rotate vector by (in radians) -
  • -
  • axis - vec3 - Axis to rotate by -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - perpendicular (a) -
-
- Get the perpendicular vector of a vector. - - -

Parameters:

-
    -
  • a - vec3 - Vector to get perpendicular axes from -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - lerp (a, b, s) -
-
- Lerp between two vectors. - - -

Parameters:

-
    -
  • a - vec3 - Left hand operand -
  • -
  • b - vec3 - Right hand operand -
  • -
  • s - number - Step value -
  • -
- -

Returns:

-
    - - vec3 - out -
- - - - -
-
- - unpack (a) -
-
- Unpack a vector into individual components. - - -

Parameters:

-
    -
  • a - vec3 - Vector to unpack -
  • -
- -

Returns:

-
    -
  1. - number - x
  2. -
  3. - number - y
  4. -
  5. - number - z
  6. -
- - - - -
-
- - component_min (a, b) -
-
- Return the component-wise minimum of two vectors. - - -

Parameters:

-
    -
  • a - vec3 - Left hand operand -
  • -
  • b - vec3 - Right hand operand -
  • -
- -

Returns:

-
    - - vec3 - A vector where each component is the lesser value for that component between the two given vectors. -
- - - - -
-
- - component_max (a, b) -
-
- Return the component-wise maximum of two vectors. - - -

Parameters:

-
    -
  • a - vec3 - Left hand operand -
  • -
  • b - vec3 - Right hand operand -
  • -
- -

Returns:

-
    - - vec3 - A vector where each component is the lesser value for that component between the two given vectors. -
- - - - -
-
- - is_vec3 (a) -
-
- Return a boolean showing if a table is or is not a vec3. - - -

Parameters:

-
    -
  • a - vec3 - Vector to be tested -
  • -
- -

Returns:

-
    - - boolean - is_vec3 -
- - - - -
-
- - is_zero (a) -
-
- Return a boolean showing if a table is or is not a zero vec3. - - -

Parameters:

-
    -
  • a - vec3 - Vector to be tested -
  • -
- -

Returns:

-
    - - boolean - is_zero -
- - - - -
-
- - has_nan (a) -
-
- Return whether any component is NaN - - -

Parameters:

-
    -
  • a - vec3 - Vector to be tested -
  • -
- -

Returns:

-
    - - boolean - if x,y, or z are nan -
- - - - -
-
- - to_string (a) -
-
- Return a formatted string. - - -

Parameters:

-
    -
  • a - vec3 - Vector to be turned into a string -
  • -
- -

Returns:

-
    - - string - formatted -
- - - - -
-
-

Tables

- -
-
- - vec3 -
-
- Constants - - -

Fields:

-
    -
  • unit_x - X axis of rotation -
  • -
  • unit_y - Y axis of rotation -
  • -
  • unit_z - Z axis of rotation -
  • -
  • zero - Empty vector -
  • -
- - - - - -
-
- - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/docs/topics/readme.md.html b/docs/topics/readme.md.html deleted file mode 100644 index f6e396b..0000000 --- a/docs/topics/readme.md.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - CPML documentation - - - - -
- -
- -
-
-
- - -
- - - - - - -
- - -

Cirno's Perfect Math Library

- -

This is a Love (the game framework) library CPML which has been ported and modified to work in the context of Luanti.

- -

Main features

-

* only Luanti Library which implements the ability to manipulate matrices and quaternions and convert them reliably to irrlicht bone rotations. -* bounding box modules -* mat4 -* vec3 -* quaternions -* octrees -* bvh lib -* more

- -

Adapted for Luanti

-

For best memory performance: have luaJIT & it's FFI library (this should be built into luaJIT), and add LEEF-Math to your trusted list (so it can require() call the FFI library).

- -

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

- -

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

- -

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

- -

TODO:

-

* Vec3s and Vec2s are not currently adapted for functionality with MT vectors, fix.

- - -
-
-
-generated by LDoc 1.5.0 -Last updated 2024-12-09 17:59:28 -
-
- - diff --git a/ldoc/config.ld b/ldoc/config.ld deleted file mode 100644 index 967e6db..0000000 --- a/ldoc/config.ld +++ /dev/null @@ -1,12 +0,0 @@ -project="LEEF Math" -title="CPML documentation" -description="The CPML library ported to Luanti and extended." -format="markdown" -backtick_references=false -file = { - "../init.lua", - "../modules" -} -dir='../docs' -readme='../README.md' -style='!new' diff --git a/ldoc/install_and_build_docs b/ldoc/install_and_build_docs deleted file mode 100644 index cdf02a1..0000000 --- a/ldoc/install_and_build_docs +++ /dev/null @@ -1,13 +0,0 @@ -#! /bin/sh - -# on github, leafo/gh-actions-lua leafo/gh-actions-luarocks setup luarocks for us. -#~ sudo apt-get install lua5.3 liblua5.3-dev luarocks - -# github ldoc is far ahead of the released version. -echo ldoc version: -git ls-remote https://github.com/lunarmodules/LDoc master -luarocks --local install https://raw.githubusercontent.com/lunarmodules/LDoc/master/ldoc-scm-3.rockspec - -echo -cd ./doc -~/.luarocks/bin/ldoc . diff --git a/ldoc/windows_quick_generate.bat b/ldoc/windows_quick_generate.bat deleted file mode 100644 index f8004d5..0000000 --- a/ldoc/windows_quick_generate.bat +++ /dev/null @@ -1 +0,0 @@ -ldoc . \ No newline at end of file diff --git a/modules/bound2.lua b/modules/bound2.lua index 90f558d..771ac35 100644 --- a/modules/bound2.lua +++ b/modules/bound2.lua @@ -1,5 +1,5 @@ --- A 2 component bounding box. --- @module bound2 +-- @module math.bound2 local vec2 = require(modules .. "vec2") diff --git a/modules/bound3.lua b/modules/bound3.lua index b7f93b5..b781541 100644 --- a/modules/bound3.lua +++ b/modules/bound3.lua @@ -1,5 +1,5 @@ --- A 3-component axis-aligned bounding box. --- @module bound3 +-- @module math.bound3 local vec3 = require(modules .. "vec3") diff --git a/modules/bvh.lua b/modules/bvh.lua index 6a8bfd9..d962f55 100644 --- a/modules/bvh.lua +++ b/modules/bvh.lua @@ -1,7 +1,7 @@ -- https://github.com/benraziel/bvh-tree --- BVH Tree --- @module bvh +-- @module math.bvh local intersect = require(modules .. "intersect") local vec3 = require(modules .. "vec3") diff --git a/modules/color.lua b/modules/color.lua index f0c1242..6e21f7c 100644 --- a/modules/color.lua +++ b/modules/color.lua @@ -1,5 +1,5 @@ --- Color utilities --- @module color +-- @module math.color local constants = require(modules .. "constants") local utils = require(modules .. "utils") diff --git a/modules/constants.lua b/modules/constants.lua index 9b9dab0..fb7ab13 100644 --- a/modules/constants.lua +++ b/modules/constants.lua @@ -1,5 +1,5 @@ --- Various useful constants --- @module constants +-- @module math.constants --- Constants -- @table constants diff --git a/modules/intersect.lua b/modules/intersect.lua index fbd845a..d667ee1 100644 --- a/modules/intersect.lua +++ b/modules/intersect.lua @@ -1,5 +1,5 @@ --- Various geometric intersections --- @module intersect +-- @module math.intersect local constants = require(modules .. "constants") local mat4 = require(modules .. "mat4") diff --git a/modules/mat4.lua b/modules/mat4.lua index db81e60..270cccb 100644 --- a/modules/mat4.lua +++ b/modules/mat4.lua @@ -1,5 +1,5 @@ --- double 4x4, 1-based, column major matrices --- @module mat4 +-- @module math.mat4 local constants = require(modules .. "constants") local vec2 = require(modules .. "vec2") local vec3 = require(modules .. "vec3") diff --git a/modules/mesh.lua b/modules/mesh.lua index 963a6ff..e542797 100644 --- a/modules/mesh.lua +++ b/modules/mesh.lua @@ -1,5 +1,5 @@ --- Mesh utilities --- @module mesh +-- @module math.mesh local vec3 = require(modules .. "vec3") local mesh = {} diff --git a/modules/octree.lua b/modules/octree.lua index cb72d72..e69ff87 100644 --- a/modules/octree.lua +++ b/modules/octree.lua @@ -4,7 +4,7 @@ -- https://github.com/Nition/UnityOctree/blob/master/Scripts/BoundsOctreeNode.cs --- Octree --- @module octree +-- @module math.octree local intersect = require(modules .. "intersect") local mat4 = require(modules .. "mat4") diff --git a/modules/quat.lua b/modules/quat.lua index 1241e87..1eb4203 100644 --- a/modules/quat.lua +++ b/modules/quat.lua @@ -1,5 +1,5 @@ --- A quaternion and associated utilities. --- @module quat +-- @module math.quat local constants = require(modules .. "constants") local vec3 = require(modules .. "vec3") diff --git a/modules/simplex.lua b/modules/simplex.lua index a0c0bf0..c6ca453 100644 --- a/modules/simplex.lua +++ b/modules/simplex.lua @@ -1,5 +1,5 @@ --- Simplex Noise --- @module simplex +-- @module math.simplex -- -- Based on code in "Simplex noise demystified", by Stefan Gustavson diff --git a/modules/utils.lua b/modules/utils.lua index 1296f12..3c63d0c 100644 --- a/modules/utils.lua +++ b/modules/utils.lua @@ -1,5 +1,5 @@ --- Various utility functions --- @module utils +-- @module math.utils local vec2 = require(modules .. "vec2") local vec3 = require(modules .. "vec3") diff --git a/modules/vec2.lua b/modules/vec2.lua index 00ffdd5..8fb1ba5 100644 --- a/modules/vec2.lua +++ b/modules/vec2.lua @@ -1,5 +1,5 @@ --- A 2 component vector. --- @module vec2 +-- @module math.vec2 local vec3 = require(modules .. "vec3") local precond = require(modules .. "_private_precond") diff --git a/modules/vec3.lua b/modules/vec3.lua index d634d22..2272734 100644 --- a/modules/vec3.lua +++ b/modules/vec3.lua @@ -1,5 +1,5 @@ --- A 3 component vector. --- @module vec3 +-- @module math.vec3 local precond = require(modules .. "_private_precond") local private = require(modules .. "_private_utils")