Documentation / @sw-file-lib/core / math
math
Utilities for mathematical operations, including vector and matrix math.
Classes
| Class | Description |
|---|---|
| Orientation | Axis-aligned orientation for Stormworks' left-handed coordinate system. |
Interfaces
| Interface | Description |
|---|---|
| Vec2 | A simple two-dimensional numeric vector. |
| ReadonlyVec2 | Read only Vec2 type. |
| AxisMapping | Mapping from an output axis to a signed input axis. Used in Orientation. |
| Vec3 | A simple three-dimensional numeric vector. |
| ReadonlyVec3 | Read only Vec3 type. |
Type Aliases
| Type Alias | Description |
|---|---|
| Mat3 | A simple 3x3 matrix. |
| ReadonlyMat3 | Read only Mat3 type. |
| Axis | Axis name used by an axis-aligned orientation. Used in Orientation. |
Functions
| Function | Description |
|---|---|
| modulo | Positive modulo, useful for cyclic indices. |
| isMat3 | Return true when value is a nine-number array. |
| transposeMat3 | Return the transpose of a row-major 3x3 matrix. |
| mulMat3 | Multiply two row-major 3x3 matrices. |
| mulMat3Vec3 | Transform a vector by a row-major 3x3 matrix. |
| detMat3 | Return the determinant of a row-major 3x3 matrix. |
| parseMat3 | Parse a comma-separated row-major 3x3 matrix. |
| vec3 | Create a full vector from a partial value, using 0 for omitted components. |
| minVec3 | Return the component-wise minimum of two vectors. |
| maxVec3 | Return the component-wise maximum of two vectors. |
| addVec3 | Add two vectors component-wise. |
| subVec3 | Subtract b from a component-wise. |
| mulVec3 | Multiply every component by a scalar. |
| dotVec3 | Return the dot product of two vectors. |
| crossVec3 | Return the right-handed cross product a x b. |
| normalizeVec3 | Return a unit-length vector in the same direction as v. |
| eqVec3 | Return true when all vector components are exactly equal. |