npm package: @rbxts/mathcat
Description: a collection of math helpers for 3D graphics and simulations
Author: Isaac Mason
Latest version: 0.0.10

```sh
> npm install @rbxts/mathcat
```

# mathcat

mathcat is a collection of math helpers for 3D graphics and simulations.

**Features:**

- Vector, Quaternion, Euler, and Matrix math
- Easing functions
- Randomness utilities
- Noise utilities
- Simple JSON-serializable data structures (no classes or typed arrays)
- TypeScript-first, great DX for both JavaScript and TypeScript projects
- Excellent tree-shaking support

**Acknowledgements:**

- The vec*, quat*, mat* code started as a typescript port of glMatrix (https://glmatrix.net/). This library doesn't aim to stay in sync with glMatrix however.
- Simplex noise functions are adapted from https://github.com/pmndrs/maath, which were adapted from https://github.com/josephg/noisejs :)

## API Documentation

**types**

<table><tr>
<td><a href="#vec2"><code>Vec2</code></a></td><td><a href="#vec3"><code>Vec3</code></a></td><td><a href="#vec4"><code>Vec4</code></a></td><td><a href="#quat"><code>Quat</code></a></td>
</tr><tr>
<td><a href="#quat2"><code>Quat2</code></a></td><td><a href="#mat2"><code>Mat2</code></a></td><td><a href="#mat3"><code>Mat3</code></a></td><td><a href="#mat4"><code>Mat4</code></a></td>
</tr><tr>
<td><a href="#mat2d"><code>Mat2d</code></a></td><td><a href="#box3"><code>Box3</code></a></td><td><a href="#obb3"><code>OBB3</code></a></td><td><a href="#eulerorder"><code>EulerOrder</code></a></td>
</tr><tr>
<td><a href="#euler"><code>Euler</code></a></td><td><a href="#plane3"><code>Plane3</code></a></td><td><a href="#sphere"><code>Sphere</code></a></td><td><a href="#circle"><code>Circle</code></a></td>
</tr><tr>
<td><a href="#ray3"><code>Ray3</code></a></td><td><a href="#raycast3"><code>Raycast3</code></a></td><td><a href="#mutablearraylike"><code>MutableArrayLike</code></a></td><td></td>
</tr></table>

**vec2**

<table><tr>
<td><a href="#vec2create"><code>vec2.create</code></a></td><td><a href="#vec2clone"><code>vec2.clone</code></a></td><td><a href="#vec2fromvalues"><code>vec2.fromValues</code></a></td>
</tr><tr>
<td><a href="#vec2copy"><code>vec2.copy</code></a></td><td><a href="#vec2set"><code>vec2.set</code></a></td><td><a href="#vec2add"><code>vec2.add</code></a></td>
</tr><tr>
<td><a href="#vec2addscalar"><code>vec2.addScalar</code></a></td><td><a href="#vec2subtract"><code>vec2.subtract</code></a></td><td><a href="#vec2subtractscalar"><code>vec2.subtractScalar</code></a></td>
</tr><tr>
<td><a href="#vec2multiply"><code>vec2.multiply</code></a></td><td><a href="#vec2divide"><code>vec2.divide</code></a></td><td><a href="#vec2ceil"><code>vec2.ceil</code></a></td>
</tr><tr>
<td><a href="#vec2floor"><code>vec2.floor</code></a></td><td><a href="#vec2min"><code>vec2.min</code></a></td><td><a href="#vec2max"><code>vec2.max</code></a></td>
</tr><tr>
<td><a href="#vec2round"><code>vec2.round</code></a></td><td><a href="#vec2scale"><code>vec2.scale</code></a></td><td><a href="#vec2scaleandadd"><code>vec2.scaleAndAdd</code></a></td>
</tr><tr>
<td><a href="#vec2distance"><code>vec2.distance</code></a></td><td><a href="#vec2squareddistance"><code>vec2.squaredDistance</code></a></td><td><a href="#vec2length"><code>vec2.length</code></a></td>
</tr><tr>
<td><a href="#vec2squaredlength"><code>vec2.squaredLength</code></a></td><td><a href="#vec2negate"><code>vec2.negate</code></a></td><td><a href="#vec2inverse"><code>vec2.inverse</code></a></td>
</tr><tr>
<td><a href="#vec2normalize"><code>vec2.normalize</code></a></td><td><a href="#vec2dot"><code>vec2.dot</code></a></td><td><a href="#vec2cross"><code>vec2.cross</code></a></td>
</tr><tr>
<td><a href="#vec2lerp"><code>vec2.lerp</code></a></td><td><a href="#vec2transformmat2"><code>vec2.transformMat2</code></a></td><td><a href="#vec2transformmat2d"><code>vec2.transformMat2d</code></a></td>
</tr><tr>
<td><a href="#vec2transformmat3"><code>vec2.transformMat3</code></a></td><td><a href="#vec2transformmat4"><code>vec2.transformMat4</code></a></td><td><a href="#vec2rotate"><code>vec2.rotate</code></a></td>
</tr><tr>
<td><a href="#vec2angle"><code>vec2.angle</code></a></td><td><a href="#vec2zero"><code>vec2.zero</code></a></td><td><a href="#vec2str"><code>vec2.str</code></a></td>
</tr><tr>
<td><a href="#vec2exactequals"><code>vec2.exactEquals</code></a></td><td><a href="#vec2equals"><code>vec2.equals</code></a></td><td><a href="#vec2finite"><code>vec2.finite</code></a></td>
</tr><tr>
<td><a href="#vec2len"><code>vec2.len</code></a></td><td><a href="#vec2sub"><code>vec2.sub</code></a></td><td><a href="#vec2mul"><code>vec2.mul</code></a></td>
</tr><tr>
<td><a href="#vec2div"><code>vec2.div</code></a></td><td><a href="#vec2dist"><code>vec2.dist</code></a></td><td><a href="#vec2sqrdist"><code>vec2.sqrDist</code></a></td>
</tr><tr>
<td><a href="#vec2sqrlen"><code>vec2.sqrLen</code></a></td><td></td><td></td>
</tr></table>

**vec3**

<table><tr>
<td><a href="#vec3create"><code>vec3.create</code></a></td><td><a href="#vec3clone"><code>vec3.clone</code></a></td><td><a href="#vec3length"><code>vec3.length</code></a></td>
</tr><tr>
<td><a href="#vec3fromvalues"><code>vec3.fromValues</code></a></td><td><a href="#vec3copy"><code>vec3.copy</code></a></td><td><a href="#vec3set"><code>vec3.set</code></a></td>
</tr><tr>
<td><a href="#vec3setscalar"><code>vec3.setScalar</code></a></td><td><a href="#vec3frombuffer"><code>vec3.fromBuffer</code></a></td><td><a href="#vec3tobuffer"><code>vec3.toBuffer</code></a></td>
</tr><tr>
<td><a href="#vec3add"><code>vec3.add</code></a></td><td><a href="#vec3addscalar"><code>vec3.addScalar</code></a></td><td><a href="#vec3subtract"><code>vec3.subtract</code></a></td>
</tr><tr>
<td><a href="#vec3subtractscalar"><code>vec3.subtractScalar</code></a></td><td><a href="#vec3multiply"><code>vec3.multiply</code></a></td><td><a href="#vec3divide"><code>vec3.divide</code></a></td>
</tr><tr>
<td><a href="#vec3ceil"><code>vec3.ceil</code></a></td><td><a href="#vec3floor"><code>vec3.floor</code></a></td><td><a href="#vec3min"><code>vec3.min</code></a></td>
</tr><tr>
<td><a href="#vec3max"><code>vec3.max</code></a></td><td><a href="#vec3round"><code>vec3.round</code></a></td><td><a href="#vec3scale"><code>vec3.scale</code></a></td>
</tr><tr>
<td><a href="#vec3scaleandadd"><code>vec3.scaleAndAdd</code></a></td><td><a href="#vec3distance"><code>vec3.distance</code></a></td><td><a href="#vec3squareddistance"><code>vec3.squaredDistance</code></a></td>
</tr><tr>
<td><a href="#vec3squaredlength"><code>vec3.squaredLength</code></a></td><td><a href="#vec3negate"><code>vec3.negate</code></a></td><td><a href="#vec3inverse"><code>vec3.inverse</code></a></td>
</tr><tr>
<td><a href="#vec3normalize"><code>vec3.normalize</code></a></td><td><a href="#vec3dot"><code>vec3.dot</code></a></td><td><a href="#vec3cross"><code>vec3.cross</code></a></td>
</tr><tr>
<td><a href="#vec3perpendicular"><code>vec3.perpendicular</code></a></td><td><a href="#vec3lerp"><code>vec3.lerp</code></a></td><td><a href="#vec3slerp"><code>vec3.slerp</code></a></td>
</tr><tr>
<td><a href="#vec3hermite"><code>vec3.hermite</code></a></td><td><a href="#vec3bezier"><code>vec3.bezier</code></a></td><td><a href="#vec3transformmat4"><code>vec3.transformMat4</code></a></td>
</tr><tr>
<td><a href="#vec3transformmat3"><code>vec3.transformMat3</code></a></td><td><a href="#vec3transformquat"><code>vec3.transformQuat</code></a></td><td><a href="#vec3rotatex"><code>vec3.rotateX</code></a></td>
</tr><tr>
<td><a href="#vec3rotatey"><code>vec3.rotateY</code></a></td><td><a href="#vec3rotatez"><code>vec3.rotateZ</code></a></td><td><a href="#vec3angle"><code>vec3.angle</code></a></td>
</tr><tr>
<td><a href="#vec3zero"><code>vec3.zero</code></a></td><td><a href="#vec3str"><code>vec3.str</code></a></td><td><a href="#vec3exactequals"><code>vec3.exactEquals</code></a></td>
</tr><tr>
<td><a href="#vec3equals"><code>vec3.equals</code></a></td><td><a href="#vec3finite"><code>vec3.finite</code></a></td><td><a href="#vec3isscaleinsideout"><code>vec3.isScaleInsideOut</code></a></td>
</tr><tr>
<td><a href="#vec3sub"><code>vec3.sub</code></a></td><td><a href="#vec3mul"><code>vec3.mul</code></a></td><td><a href="#vec3div"><code>vec3.div</code></a></td>
</tr><tr>
<td><a href="#vec3dist"><code>vec3.dist</code></a></td><td><a href="#vec3sqrdist"><code>vec3.sqrDist</code></a></td><td><a href="#vec3len"><code>vec3.len</code></a></td>
</tr><tr>
<td><a href="#vec3sqrlen"><code>vec3.sqrLen</code></a></td><td></td><td></td>
</tr></table>

**vec4**

<table><tr>
<td><a href="#vec4create"><code>vec4.create</code></a></td><td><a href="#vec4clone"><code>vec4.clone</code></a></td><td><a href="#vec4fromvalues"><code>vec4.fromValues</code></a></td>
</tr><tr>
<td><a href="#vec4copy"><code>vec4.copy</code></a></td><td><a href="#vec4set"><code>vec4.set</code></a></td><td><a href="#vec4add"><code>vec4.add</code></a></td>
</tr><tr>
<td><a href="#vec4subtract"><code>vec4.subtract</code></a></td><td><a href="#vec4multiply"><code>vec4.multiply</code></a></td><td><a href="#vec4divide"><code>vec4.divide</code></a></td>
</tr><tr>
<td><a href="#vec4ceil"><code>vec4.ceil</code></a></td><td><a href="#vec4floor"><code>vec4.floor</code></a></td><td><a href="#vec4min"><code>vec4.min</code></a></td>
</tr><tr>
<td><a href="#vec4max"><code>vec4.max</code></a></td><td><a href="#vec4round"><code>vec4.round</code></a></td><td><a href="#vec4scale"><code>vec4.scale</code></a></td>
</tr><tr>
<td><a href="#vec4scaleandadd"><code>vec4.scaleAndAdd</code></a></td><td><a href="#vec4distance"><code>vec4.distance</code></a></td><td><a href="#vec4squareddistance"><code>vec4.squaredDistance</code></a></td>
</tr><tr>
<td><a href="#vec4length"><code>vec4.length</code></a></td><td><a href="#vec4squaredlength"><code>vec4.squaredLength</code></a></td><td><a href="#vec4negate"><code>vec4.negate</code></a></td>
</tr><tr>
<td><a href="#vec4inverse"><code>vec4.inverse</code></a></td><td><a href="#vec4normalize"><code>vec4.normalize</code></a></td><td><a href="#vec4dot"><code>vec4.dot</code></a></td>
</tr><tr>
<td><a href="#vec4cross"><code>vec4.cross</code></a></td><td><a href="#vec4lerp"><code>vec4.lerp</code></a></td><td><a href="#vec4transformmat4"><code>vec4.transformMat4</code></a></td>
</tr><tr>
<td><a href="#vec4transformquat"><code>vec4.transformQuat</code></a></td><td><a href="#vec4zero"><code>vec4.zero</code></a></td><td><a href="#vec4str"><code>vec4.str</code></a></td>
</tr><tr>
<td><a href="#vec4exactequals"><code>vec4.exactEquals</code></a></td><td><a href="#vec4equals"><code>vec4.equals</code></a></td><td><a href="#vec4finite"><code>vec4.finite</code></a></td>
</tr><tr>
<td><a href="#vec4sub"><code>vec4.sub</code></a></td><td><a href="#vec4mul"><code>vec4.mul</code></a></td><td><a href="#vec4div"><code>vec4.div</code></a></td>
</tr><tr>
<td><a href="#vec4dist"><code>vec4.dist</code></a></td><td><a href="#vec4sqrdist"><code>vec4.sqrDist</code></a></td><td><a href="#vec4len"><code>vec4.len</code></a></td>
</tr><tr>
<td><a href="#vec4sqrlen"><code>vec4.sqrLen</code></a></td><td></td><td></td>
</tr></table>

**euler**

<table><tr>
<td><a href="#eulercreate"><code>euler.create</code></a></td><td><a href="#eulerfromvalues"><code>euler.fromValues</code></a></td><td><a href="#eulerset"><code>euler.set</code></a></td>
</tr><tr>
<td><a href="#eulerfromdegrees"><code>euler.fromDegrees</code></a></td><td><a href="#eulerfromrotationmat4"><code>euler.fromRotationMat4</code></a></td><td><a href="#eulerexactequals"><code>euler.exactEquals</code></a></td>
</tr><tr>
<td><a href="#eulerequals"><code>euler.equals</code></a></td><td><a href="#eulerfromquat"><code>euler.fromQuat</code></a></td><td><a href="#eulerreorder"><code>euler.reorder</code></a></td>
</tr></table>

**quat**

<table><tr>
<td><a href="#quatcreate"><code>quat.create</code></a></td><td><a href="#quatidentity"><code>quat.identity</code></a></td><td><a href="#quatsetaxisangle"><code>quat.setAxisAngle</code></a></td>
</tr><tr>
<td><a href="#quatgetaxisangle"><code>quat.getAxisAngle</code></a></td><td><a href="#quatgetangle"><code>quat.getAngle</code></a></td><td><a href="#quatmultiply"><code>quat.multiply</code></a></td>
</tr><tr>
<td><a href="#quatrotatex"><code>quat.rotateX</code></a></td><td><a href="#quatrotatey"><code>quat.rotateY</code></a></td><td><a href="#quatrotatez"><code>quat.rotateZ</code></a></td>
</tr><tr>
<td><a href="#quatcalculatew"><code>quat.calculateW</code></a></td><td><a href="#quatexp"><code>quat.exp</code></a></td><td><a href="#quatln"><code>quat.ln</code></a></td>
</tr><tr>
<td><a href="#quatpow"><code>quat.pow</code></a></td><td><a href="#quatslerp"><code>quat.slerp</code></a></td><td><a href="#quatinvert"><code>quat.invert</code></a></td>
</tr><tr>
<td><a href="#quatconjugate"><code>quat.conjugate</code></a></td><td><a href="#quatfrommat3"><code>quat.fromMat3</code></a></td><td><a href="#quatfrommat4"><code>quat.fromMat4</code></a></td>
</tr><tr>
<td><a href="#quatfromeuler"><code>quat.fromEuler</code></a></td><td><a href="#quatfromdegrees"><code>quat.fromDegrees</code></a></td><td><a href="#quatstr"><code>quat.str</code></a></td>
</tr><tr>
<td><a href="#quatclone"><code>quat.clone</code></a></td><td><a href="#quatfromvalues"><code>quat.fromValues</code></a></td><td><a href="#quatcopy"><code>quat.copy</code></a></td>
</tr><tr>
<td><a href="#quatset"><code>quat.set</code></a></td><td><a href="#quatadd"><code>quat.add</code></a></td><td><a href="#quatscale"><code>quat.scale</code></a></td>
</tr><tr>
<td><a href="#quatdot"><code>quat.dot</code></a></td><td><a href="#quatlerp"><code>quat.lerp</code></a></td><td><a href="#quatlength"><code>quat.length</code></a></td>
</tr><tr>
<td><a href="#quatlen"><code>quat.len</code></a></td><td><a href="#quatsquaredlength"><code>quat.squaredLength</code></a></td><td><a href="#quatsqrlen"><code>quat.sqrLen</code></a></td>
</tr><tr>
<td><a href="#quatmul"><code>quat.mul</code></a></td><td><a href="#quatnormalize"><code>quat.normalize</code></a></td><td><a href="#quatexactequals"><code>quat.exactEquals</code></a></td>
</tr><tr>
<td><a href="#quatequals"><code>quat.equals</code></a></td><td><a href="#quatrotationto"><code>quat.rotationTo</code></a></td><td><a href="#quatsqlerp"><code>quat.sqlerp</code></a></td>
</tr><tr>
<td><a href="#quatsetaxes"><code>quat.setAxes</code></a></td><td></td><td></td>
</tr></table>

**quat2**

<table><tr>
<td><a href="#quat2create"><code>quat2.create</code></a></td><td><a href="#quat2clone"><code>quat2.clone</code></a></td>
</tr><tr>
<td><a href="#quat2fromvalues"><code>quat2.fromValues</code></a></td><td><a href="#quat2fromrotationtranslationvalues"><code>quat2.fromRotationTranslationValues</code></a></td>
</tr><tr>
<td><a href="#quat2fromrotationtranslation"><code>quat2.fromRotationTranslation</code></a></td><td><a href="#quat2fromtranslation"><code>quat2.fromTranslation</code></a></td>
</tr><tr>
<td><a href="#quat2fromrotation"><code>quat2.fromRotation</code></a></td><td><a href="#quat2frommat4"><code>quat2.fromMat4</code></a></td>
</tr><tr>
<td><a href="#quat2copy"><code>quat2.copy</code></a></td><td><a href="#quat2identity"><code>quat2.identity</code></a></td>
</tr><tr>
<td><a href="#quat2set"><code>quat2.set</code></a></td><td><a href="#quat2getreal"><code>quat2.getReal</code></a></td>
</tr><tr>
<td><a href="#quat2getdual"><code>quat2.getDual</code></a></td><td><a href="#quat2setreal"><code>quat2.setReal</code></a></td>
</tr><tr>
<td><a href="#quat2setdual"><code>quat2.setDual</code></a></td><td><a href="#quat2gettranslation"><code>quat2.getTranslation</code></a></td>
</tr><tr>
<td><a href="#quat2translate"><code>quat2.translate</code></a></td><td><a href="#quat2rotatex"><code>quat2.rotateX</code></a></td>
</tr><tr>
<td><a href="#quat2rotatey"><code>quat2.rotateY</code></a></td><td><a href="#quat2rotatez"><code>quat2.rotateZ</code></a></td>
</tr><tr>
<td><a href="#quat2rotatebyquatappend"><code>quat2.rotateByQuatAppend</code></a></td><td><a href="#quat2rotatebyquatprepend"><code>quat2.rotateByQuatPrepend</code></a></td>
</tr><tr>
<td><a href="#quat2rotatearoundaxis"><code>quat2.rotateAroundAxis</code></a></td><td><a href="#quat2add"><code>quat2.add</code></a></td>
</tr><tr>
<td><a href="#quat2multiply"><code>quat2.multiply</code></a></td><td><a href="#quat2mul"><code>quat2.mul</code></a></td>
</tr><tr>
<td><a href="#quat2scale"><code>quat2.scale</code></a></td><td><a href="#quat2dot"><code>quat2.dot</code></a></td>
</tr><tr>
<td><a href="#quat2lerp"><code>quat2.lerp</code></a></td><td><a href="#quat2invert"><code>quat2.invert</code></a></td>
</tr><tr>
<td><a href="#quat2conjugate"><code>quat2.conjugate</code></a></td><td><a href="#quat2length"><code>quat2.length</code></a></td>
</tr><tr>
<td><a href="#quat2len"><code>quat2.len</code></a></td><td><a href="#quat2squaredlength"><code>quat2.squaredLength</code></a></td>
</tr><tr>
<td><a href="#quat2sqrlen"><code>quat2.sqrLen</code></a></td><td><a href="#quat2normalize"><code>quat2.normalize</code></a></td>
</tr><tr>
<td><a href="#quat2str"><code>quat2.str</code></a></td><td><a href="#quat2exactequals"><code>quat2.exactEquals</code></a></td>
</tr><tr>
<td><a href="#quat2equals"><code>quat2.equals</code></a></td><td></td>
</tr></table>

**mat2**

<table><tr>
<td><a href="#mat2create"><code>mat2.create</code></a></td><td><a href="#mat2clone"><code>mat2.clone</code></a></td>
</tr><tr>
<td><a href="#mat2copy"><code>mat2.copy</code></a></td><td><a href="#mat2identity"><code>mat2.identity</code></a></td>
</tr><tr>
<td><a href="#mat2fromvalues"><code>mat2.fromValues</code></a></td><td><a href="#mat2set"><code>mat2.set</code></a></td>
</tr><tr>
<td><a href="#mat2transpose"><code>mat2.transpose</code></a></td><td><a href="#mat2invert"><code>mat2.invert</code></a></td>
</tr><tr>
<td><a href="#mat2adjoint"><code>mat2.adjoint</code></a></td><td><a href="#mat2determinant"><code>mat2.determinant</code></a></td>
</tr><tr>
<td><a href="#mat2multiply"><code>mat2.multiply</code></a></td><td><a href="#mat2rotate"><code>mat2.rotate</code></a></td>
</tr><tr>
<td><a href="#mat2scale"><code>mat2.scale</code></a></td><td><a href="#mat2fromrotation"><code>mat2.fromRotation</code></a></td>
</tr><tr>
<td><a href="#mat2fromscaling"><code>mat2.fromScaling</code></a></td><td><a href="#mat2str"><code>mat2.str</code></a></td>
</tr><tr>
<td><a href="#mat2frob"><code>mat2.frob</code></a></td><td><a href="#mat2ldu"><code>mat2.LDU</code></a></td>
</tr><tr>
<td><a href="#mat2add"><code>mat2.add</code></a></td><td><a href="#mat2subtract"><code>mat2.subtract</code></a></td>
</tr><tr>
<td><a href="#mat2exactequals"><code>mat2.exactEquals</code></a></td><td><a href="#mat2equals"><code>mat2.equals</code></a></td>
</tr><tr>
<td><a href="#mat2multiplyscalar"><code>mat2.multiplyScalar</code></a></td><td><a href="#mat2multiplyscalarandadd"><code>mat2.multiplyScalarAndAdd</code></a></td>
</tr><tr>
<td><a href="#mat2mul"><code>mat2.mul</code></a></td><td><a href="#mat2sub"><code>mat2.sub</code></a></td>
</tr></table>

**mat2d**

<table><tr>
<td><a href="#mat2dcreate"><code>mat2d.create</code></a></td><td><a href="#mat2dclone"><code>mat2d.clone</code></a></td>
</tr><tr>
<td><a href="#mat2dcopy"><code>mat2d.copy</code></a></td><td><a href="#mat2didentity"><code>mat2d.identity</code></a></td>
</tr><tr>
<td><a href="#mat2dfromvalues"><code>mat2d.fromValues</code></a></td><td><a href="#mat2dset"><code>mat2d.set</code></a></td>
</tr><tr>
<td><a href="#mat2dinvert"><code>mat2d.invert</code></a></td><td><a href="#mat2ddeterminant"><code>mat2d.determinant</code></a></td>
</tr><tr>
<td><a href="#mat2dmultiply"><code>mat2d.multiply</code></a></td><td><a href="#mat2drotate"><code>mat2d.rotate</code></a></td>
</tr><tr>
<td><a href="#mat2dscale"><code>mat2d.scale</code></a></td><td><a href="#mat2dtranslate"><code>mat2d.translate</code></a></td>
</tr><tr>
<td><a href="#mat2dfromrotation"><code>mat2d.fromRotation</code></a></td><td><a href="#mat2dfromscaling"><code>mat2d.fromScaling</code></a></td>
</tr><tr>
<td><a href="#mat2dfromtranslation"><code>mat2d.fromTranslation</code></a></td><td><a href="#mat2dstr"><code>mat2d.str</code></a></td>
</tr><tr>
<td><a href="#mat2dfrob"><code>mat2d.frob</code></a></td><td><a href="#mat2dadd"><code>mat2d.add</code></a></td>
</tr><tr>
<td><a href="#mat2dsubtract"><code>mat2d.subtract</code></a></td><td><a href="#mat2dmultiplyscalar"><code>mat2d.multiplyScalar</code></a></td>
</tr><tr>
<td><a href="#mat2dmultiplyscalarandadd"><code>mat2d.multiplyScalarAndAdd</code></a></td><td><a href="#mat2dexactequals"><code>mat2d.exactEquals</code></a></td>
</tr><tr>
<td><a href="#mat2dequals"><code>mat2d.equals</code></a></td><td><a href="#mat2dmul"><code>mat2d.mul</code></a></td>
</tr><tr>
<td><a href="#mat2dsub"><code>mat2d.sub</code></a></td><td></td>
</tr></table>

**mat3**

<table><tr>
<td><a href="#mat3create"><code>mat3.create</code></a></td><td><a href="#mat3frommat4"><code>mat3.fromMat4</code></a></td>
</tr><tr>
<td><a href="#mat3clone"><code>mat3.clone</code></a></td><td><a href="#mat3copy"><code>mat3.copy</code></a></td>
</tr><tr>
<td><a href="#mat3fromvalues"><code>mat3.fromValues</code></a></td><td><a href="#mat3set"><code>mat3.set</code></a></td>
</tr><tr>
<td><a href="#mat3identity"><code>mat3.identity</code></a></td><td><a href="#mat3zero"><code>mat3.zero</code></a></td>
</tr><tr>
<td><a href="#mat3transpose"><code>mat3.transpose</code></a></td><td><a href="#mat3invert"><code>mat3.invert</code></a></td>
</tr><tr>
<td><a href="#mat3adjoint"><code>mat3.adjoint</code></a></td><td><a href="#mat3determinant"><code>mat3.determinant</code></a></td>
</tr><tr>
<td><a href="#mat3multiply"><code>mat3.multiply</code></a></td><td><a href="#mat3translate"><code>mat3.translate</code></a></td>
</tr><tr>
<td><a href="#mat3rotate"><code>mat3.rotate</code></a></td><td><a href="#mat3scale"><code>mat3.scale</code></a></td>
</tr><tr>
<td><a href="#mat3fromtranslation"><code>mat3.fromTranslation</code></a></td><td><a href="#mat3fromrotation"><code>mat3.fromRotation</code></a></td>
</tr><tr>
<td><a href="#mat3fromscaling"><code>mat3.fromScaling</code></a></td><td><a href="#mat3frommat2d"><code>mat3.fromMat2d</code></a></td>
</tr><tr>
<td><a href="#mat3fromquat"><code>mat3.fromQuat</code></a></td><td><a href="#mat3normalfrommat4"><code>mat3.normalFromMat4</code></a></td>
</tr><tr>
<td><a href="#mat3projection"><code>mat3.projection</code></a></td><td><a href="#mat3str"><code>mat3.str</code></a></td>
</tr><tr>
<td><a href="#mat3frob"><code>mat3.frob</code></a></td><td><a href="#mat3add"><code>mat3.add</code></a></td>
</tr><tr>
<td><a href="#mat3subtract"><code>mat3.subtract</code></a></td><td><a href="#mat3multiplyscalar"><code>mat3.multiplyScalar</code></a></td>
</tr><tr>
<td><a href="#mat3multiplyscalarandadd"><code>mat3.multiplyScalarAndAdd</code></a></td><td><a href="#mat3exactequals"><code>mat3.exactEquals</code></a></td>
</tr><tr>
<td><a href="#mat3equals"><code>mat3.equals</code></a></td><td><a href="#mat3mul"><code>mat3.mul</code></a></td>
</tr><tr>
<td><a href="#mat3sub"><code>mat3.sub</code></a></td><td></td>
</tr></table>

**mat4**

<table><tr>
<td><a href="#mat4create"><code>mat4.create</code></a></td><td><a href="#mat4clone"><code>mat4.clone</code></a></td>
</tr><tr>
<td><a href="#mat4copy"><code>mat4.copy</code></a></td><td><a href="#mat4fromvalues"><code>mat4.fromValues</code></a></td>
</tr><tr>
<td><a href="#mat4set"><code>mat4.set</code></a></td><td><a href="#mat4identity"><code>mat4.identity</code></a></td>
</tr><tr>
<td><a href="#mat4zero"><code>mat4.zero</code></a></td><td><a href="#mat4transpose"><code>mat4.transpose</code></a></td>
</tr><tr>
<td><a href="#mat4invert"><code>mat4.invert</code></a></td><td><a href="#mat4invert3x3"><code>mat4.invert3x3</code></a></td>
</tr><tr>
<td><a href="#mat4adjoint"><code>mat4.adjoint</code></a></td><td><a href="#mat4determinant"><code>mat4.determinant</code></a></td>
</tr><tr>
<td><a href="#mat4multiply"><code>mat4.multiply</code></a></td><td><a href="#mat4multiply3x3"><code>mat4.multiply3x3</code></a></td>
</tr><tr>
<td><a href="#mat4multiply3x3righttransposed"><code>mat4.multiply3x3RightTransposed</code></a></td><td><a href="#mat4multiply3x3transposedvec"><code>mat4.multiply3x3TransposedVec</code></a></td>
</tr><tr>
<td><a href="#mat4multiply3x3vec"><code>mat4.multiply3x3Vec</code></a></td><td><a href="#mat4crossproductmatrix"><code>mat4.crossProductMatrix</code></a></td>
</tr><tr>
<td><a href="#mat4translate"><code>mat4.translate</code></a></td><td><a href="#mat4scale"><code>mat4.scale</code></a></td>
</tr><tr>
<td><a href="#mat4rotate"><code>mat4.rotate</code></a></td><td><a href="#mat4rotatex"><code>mat4.rotateX</code></a></td>
</tr><tr>
<td><a href="#mat4rotatey"><code>mat4.rotateY</code></a></td><td><a href="#mat4rotatez"><code>mat4.rotateZ</code></a></td>
</tr><tr>
<td><a href="#mat4fromtranslation"><code>mat4.fromTranslation</code></a></td><td><a href="#mat4fromscaling"><code>mat4.fromScaling</code></a></td>
</tr><tr>
<td><a href="#mat4fromrotation"><code>mat4.fromRotation</code></a></td><td><a href="#mat4fromxrotation"><code>mat4.fromXRotation</code></a></td>
</tr><tr>
<td><a href="#mat4fromyrotation"><code>mat4.fromYRotation</code></a></td><td><a href="#mat4fromzrotation"><code>mat4.fromZRotation</code></a></td>
</tr><tr>
<td><a href="#mat4fromrotationtranslation"><code>mat4.fromRotationTranslation</code></a></td><td><a href="#mat4fromquat2"><code>mat4.fromQuat2</code></a></td>
</tr><tr>
<td><a href="#mat4gettranslation"><code>mat4.getTranslation</code></a></td><td><a href="#mat4getscaling"><code>mat4.getScaling</code></a></td>
</tr><tr>
<td><a href="#mat4getrotation"><code>mat4.getRotation</code></a></td><td><a href="#mat4decompose"><code>mat4.decompose</code></a></td>
</tr><tr>
<td><a href="#mat4fromrotationtranslationscale"><code>mat4.fromRotationTranslationScale</code></a></td><td><a href="#mat4fromrotationtranslationscaleorigin"><code>mat4.fromRotationTranslationScaleOrigin</code></a></td>
</tr><tr>
<td><a href="#mat4fromquat"><code>mat4.fromQuat</code></a></td><td><a href="#mat4frustum"><code>mat4.frustum</code></a></td>
</tr><tr>
<td><a href="#mat4perspectiveno"><code>mat4.perspectiveNO</code></a></td><td><a href="#mat4perspective"><code>mat4.perspective</code></a></td>
</tr><tr>
<td><a href="#mat4perspectivezo"><code>mat4.perspectiveZO</code></a></td><td><a href="#mat4perspectivefromfieldofview"><code>mat4.perspectiveFromFieldOfView</code></a></td>
</tr><tr>
<td><a href="#mat4orthono"><code>mat4.orthoNO</code></a></td><td><a href="#mat4ortho"><code>mat4.ortho</code></a></td>
</tr><tr>
<td><a href="#mat4orthozo"><code>mat4.orthoZO</code></a></td><td><a href="#mat4lookat"><code>mat4.lookAt</code></a></td>
</tr><tr>
<td><a href="#mat4targetto"><code>mat4.targetTo</code></a></td><td><a href="#mat4str"><code>mat4.str</code></a></td>
</tr><tr>
<td><a href="#mat4frob"><code>mat4.frob</code></a></td><td><a href="#mat4add"><code>mat4.add</code></a></td>
</tr><tr>
<td><a href="#mat4subtract"><code>mat4.subtract</code></a></td><td><a href="#mat4multiplyscalar"><code>mat4.multiplyScalar</code></a></td>
</tr><tr>
<td><a href="#mat4multiplyscalarandadd"><code>mat4.multiplyScalarAndAdd</code></a></td><td><a href="#mat4exactequals"><code>mat4.exactEquals</code></a></td>
</tr><tr>
<td><a href="#mat4equals"><code>mat4.equals</code></a></td><td><a href="#mat4mul"><code>mat4.mul</code></a></td>
</tr><tr>
<td><a href="#mat4sub"><code>mat4.sub</code></a></td><td></td>
</tr></table>

**circle**

<table><tr>
<td><a href="#circlecreate"><code>circle.create</code></a></td>
</tr></table>

**segment2**

<table><tr>
<td><a href="#segment2closestpoint"><code>segment2.closestPoint</code></a></td>
</tr></table>

**box3**

<table><tr>
<td><a href="#box3create"><code>box3.create</code></a></td><td><a href="#box3clone"><code>box3.clone</code></a></td>
</tr><tr>
<td><a href="#box3copy"><code>box3.copy</code></a></td><td><a href="#box3set"><code>box3.set</code></a></td>
</tr><tr>
<td><a href="#box3setfromvectors"><code>box3.setFromVectors</code></a></td><td><a href="#box3min"><code>box3.min</code></a></td>
</tr><tr>
<td><a href="#box3max"><code>box3.max</code></a></td><td><a href="#box3empty"><code>box3.empty</code></a></td>
</tr><tr>
<td><a href="#box3exactequals"><code>box3.exactEquals</code></a></td><td><a href="#box3equals"><code>box3.equals</code></a></td>
</tr><tr>
<td><a href="#box3setfromcenterandsize"><code>box3.setFromCenterAndSize</code></a></td><td><a href="#box3expandbypoint"><code>box3.expandByPoint</code></a></td>
</tr><tr>
<td><a href="#box3expandbyextents"><code>box3.expandByExtents</code></a></td><td><a href="#box3expandbymargin"><code>box3.expandByMargin</code></a></td>
</tr><tr>
<td><a href="#box3union"><code>box3.union</code></a></td><td><a href="#box3center"><code>box3.center</code></a></td>
</tr><tr>
<td><a href="#box3extents"><code>box3.extents</code></a></td><td><a href="#box3size"><code>box3.size</code></a></td>
</tr><tr>
<td><a href="#box3surfacearea"><code>box3.surfaceArea</code></a></td><td><a href="#box3scale"><code>box3.scale</code></a></td>
</tr><tr>
<td><a href="#box3transformmat4"><code>box3.transformMat4</code></a></td><td><a href="#box3containspoint"><code>box3.containsPoint</code></a></td>
</tr><tr>
<td><a href="#box3containsbox3"><code>box3.containsBox3</code></a></td><td><a href="#box3intersectsbox3"><code>box3.intersectsBox3</code></a></td>
</tr><tr>
<td><a href="#box3intersectstriangle3"><code>box3.intersectsTriangle3</code></a></td><td><a href="#box3intersectssphere"><code>box3.intersectsSphere</code></a></td>
</tr><tr>
<td><a href="#box3intersectsplane3"><code>box3.intersectsPlane3</code></a></td><td></td>
</tr></table>

**obb3**

<table><tr>
<td><a href="#obb3create"><code>obb3.create</code></a></td><td><a href="#obb3clone"><code>obb3.clone</code></a></td>
</tr><tr>
<td><a href="#obb3copy"><code>obb3.copy</code></a></td><td><a href="#obb3set"><code>obb3.set</code></a></td>
</tr><tr>
<td><a href="#obb3setfromcenterhalfextentsquaternion"><code>obb3.setFromCenterHalfExtentsQuaternion</code></a></td><td><a href="#obb3setfrombox3"><code>obb3.setFromBox3</code></a></td>
</tr><tr>
<td><a href="#obb3containspoint"><code>obb3.containsPoint</code></a></td><td><a href="#obb3clamppoint"><code>obb3.clampPoint</code></a></td>
</tr><tr>
<td><a href="#obb3intersectsobb3"><code>obb3.intersectsOBB3</code></a></td><td><a href="#obb3intersectsbox3"><code>obb3.intersectsBox3</code></a></td>
</tr><tr>
<td><a href="#obb3applymatrix4"><code>obb3.applyMatrix4</code></a></td><td></td>
</tr></table>

**plane3**

<table><tr>
<td><a href="#plane3create"><code>plane3.create</code></a></td><td><a href="#plane3fromnormalandconstant"><code>plane3.fromNormalAndConstant</code></a></td>
</tr><tr>
<td><a href="#plane3fromnormalandpoint"><code>plane3.fromNormalAndPoint</code></a></td><td><a href="#plane3fromcoplanarpoints"><code>plane3.fromCoplanarPoints</code></a></td>
</tr><tr>
<td><a href="#plane3clone"><code>plane3.clone</code></a></td><td><a href="#plane3copy"><code>plane3.copy</code></a></td>
</tr><tr>
<td><a href="#plane3normalize"><code>plane3.normalize</code></a></td><td><a href="#plane3negate"><code>plane3.negate</code></a></td>
</tr><tr>
<td><a href="#plane3offset"><code>plane3.offset</code></a></td><td><a href="#plane3distancetopoint"><code>plane3.distanceToPoint</code></a></td>
</tr><tr>
<td><a href="#plane3projectpoint"><code>plane3.projectPoint</code></a></td><td><a href="#plane3transform"><code>plane3.transform</code></a></td>
</tr><tr>
<td><a href="#plane3intersectssphere"><code>plane3.intersectsSphere</code></a></td><td><a href="#plane3exactequals"><code>plane3.exactEquals</code></a></td>
</tr><tr>
<td><a href="#plane3intersect"><code>plane3.intersect</code></a></td><td><a href="#plane3equals"><code>plane3.equals</code></a></td>
</tr></table>

**sphere**

<table><tr>
<td><a href="#spherecreate"><code>sphere.create</code></a></td>
</tr></table>

**triangle3**

<table><tr>
<td><a href="#triangle3bounds"><code>triangle3.bounds</code></a></td><td><a href="#triangle3normal"><code>triangle3.normal</code></a></td><td><a href="#triangle3centroid"><code>triangle3.centroid</code></a></td>
</tr></table>

**raycast3**

<table><tr>
<td><a href="#raycast3create"><code>raycast3.create</code></a></td><td><a href="#raycast3fromvalues"><code>raycast3.fromValues</code></a></td>
</tr><tr>
<td><a href="#raycast3set"><code>raycast3.set</code></a></td><td><a href="#raycast3copy"><code>raycast3.copy</code></a></td>
</tr><tr>
<td><a href="#raycast3fromsegment"><code>raycast3.fromSegment</code></a></td><td><a href="#raycast3intersectstriangleresult"><code>raycast3.IntersectsTriangleResult</code></a></td>
</tr><tr>
<td><a href="#raycast3createintersectstriangleresult"><code>raycast3.createIntersectsTriangleResult</code></a></td><td><a href="#raycast3intersectstriangle"><code>raycast3.intersectsTriangle</code></a></td>
</tr><tr>
<td><a href="#raycast3intersectsbox3"><code>raycast3.intersectsBox3</code></a></td><td></td>
</tr></table>

**quickhull3**

<table><tr>
<td><a href="#quickhull3"><code>quickhull3</code></a></td>
</tr></table>

**quickhull2**

<table><tr>
<td><a href="#quickhull2"><code>quickhull2</code></a></td>
</tr></table>

**circumcircle**

<table><tr>
<td><a href="#circumcircle"><code>circumcircle</code></a></td>
</tr></table>

**easing**

<table><tr>
<td><a href="#easingexp"><code>easing.exp</code></a></td><td><a href="#easinglinear"><code>easing.linear</code></a></td><td><a href="#easingsinein"><code>easing.sineIn</code></a></td>
</tr><tr>
<td><a href="#easingsineout"><code>easing.sineOut</code></a></td><td><a href="#easingsineinout"><code>easing.sineInOut</code></a></td><td><a href="#easingcubicin"><code>easing.cubicIn</code></a></td>
</tr><tr>
<td><a href="#easingcubicout"><code>easing.cubicOut</code></a></td><td><a href="#easingcubicinout"><code>easing.cubicInOut</code></a></td><td><a href="#easingquintin"><code>easing.quintIn</code></a></td>
</tr><tr>
<td><a href="#easingquintout"><code>easing.quintOut</code></a></td><td><a href="#easingquintinout"><code>easing.quintInOut</code></a></td><td><a href="#easingcircin"><code>easing.circIn</code></a></td>
</tr><tr>
<td><a href="#easingcircout"><code>easing.circOut</code></a></td><td><a href="#easingcircinout"><code>easing.circInOut</code></a></td><td><a href="#easingquartin"><code>easing.quartIn</code></a></td>
</tr><tr>
<td><a href="#easingquartout"><code>easing.quartOut</code></a></td><td><a href="#easingquartinout"><code>easing.quartInOut</code></a></td><td><a href="#easingexpoin"><code>easing.expoIn</code></a></td>
</tr><tr>
<td><a href="#easingexpoout"><code>easing.expoOut</code></a></td><td><a href="#easingexpoinout"><code>easing.expoInOut</code></a></td><td><a href="#easingrsqw"><code>easing.rsqw</code></a></td>
</tr></table>

**noise**

<table><tr>
<td><a href="#noisegenerator2d"><code>NoiseGenerator2D</code></a></td><td><a href="#noisegenerator3d"><code>NoiseGenerator3D</code></a></td><td><a href="#createsimplex2d"><code>createSimplex2D</code></a></td><td><a href="#createsimplex3d"><code>createSimplex3D</code></a></td>
</tr><tr>
<td><a href="#createperlin2d"><code>createPerlin2D</code></a></td><td><a href="#createperlin3d"><code>createPerlin3D</code></a></td><td></td><td></td>
</tr></table>

**random**

<table><tr>
<td><a href="#createmulberry32generator"><code>createMulberry32Generator</code></a></td><td><a href="#generatemulberry32seed"><code>generateMulberry32Seed</code></a></td>
</tr><tr>
<td><a href="#randomint"><code>randomInt</code></a></td><td><a href="#randomfloat"><code>randomFloat</code></a></td>
</tr><tr>
<td><a href="#randombool"><code>randomBool</code></a></td><td><a href="#randomsign"><code>randomSign</code></a></td>
</tr><tr>
<td><a href="#randomchoice"><code>randomChoice</code></a></td><td><a href="#randomvec2"><code>randomVec2</code></a></td>
</tr><tr>
<td><a href="#randomvec3"><code>randomVec3</code></a></td><td><a href="#randomvec4"><code>randomVec4</code></a></td>
</tr><tr>
<td><a href="#randomquat"><code>randomQuat</code></a></td><td></td>
</tr></table>

**common**

<table><tr>
<td><a href="#epsilon"><code>EPSILON</code></a></td><td><a href="#round"><code>round</code></a></td><td><a href="#degreestoradians"><code>degreesToRadians</code></a></td><td><a href="#radianstodegrees"><code>radiansToDegrees</code></a></td>
</tr><tr>
<td><a href="#equals"><code>equals</code></a></td><td><a href="#fade"><code>fade</code></a></td><td><a href="#lerp"><code>lerp</code></a></td><td><a href="#clamp"><code>clamp</code></a></td>
</tr><tr>
<td><a href="#remap"><code>remap</code></a></td><td><a href="#remapclamp"><code>remapClamp</code></a></td><td></td><td></td>
</tr></table>


---

## Reference

### types

#### `Vec2`

```ts
/** A 2D vector */
export type Vec2 = [
    x: number,
    y: number
];
```

#### `Vec3`

```ts
/** A 3D vector */
export type Vec3 = [
    x: number,
    y: number,
    z: number
];
```

#### `Vec4`

```ts
/** A 4D vector */
export type Vec4 = [
    x: number,
    y: number,
    z: number,
    w: number
];
```

#### `Quat`

```ts
/** A quaternion that represents rotation */
export type Quat = [
    x: number,
    y: number,
    z: number,
    w: number
];
```

#### `Quat2`

```ts
/** A dual quaternion that represents both rotation and translation */
export type Quat2 = [
    x: number,
    y: number,
    z: number,
    w: number,
    x2: number,
    y2: number,
    z2: number,
    w2: number
];
```

#### `Mat2`

```ts
/** A 2x2 matrix */
export type Mat2 = [
    e1: number,
    e2: number,
    e3: number,
    e4: number
];
```

#### `Mat3`

```ts
/** A 3x3 matrix */
export type Mat3 = [
    e1: number,
    e2: number,
    e3: number,
    e4: number,
    e5: number,
    e6: number,
    e7: number,
    e8: number,
    e9: number
];
```

#### `Mat4`

```ts
/** A 4x4 matrix */
export type Mat4 = [
    e1: number,
    e2: number,
    e3: number,
    e4: number,
    e5: number,
    e6: number,
    e7: number,
    e8: number,
    e9: number,
    e10: number,
    e11: number,
    e12: number,
    e13: number,
    e14: number,
    e15: number,
    e16: number
];
```

#### `Mat2d`

```ts
/** A 2D affine transform matrix */
export type Mat2d = [
    e1: number,
    e2: number,
    e3: number,
    e4: number,
    e5: number,
    e6: number
];
```

#### `Box3`

```ts
/** A box in 3D space */
export type Box3 = [
    minX: number,
    minY: number,
    minZ: number,
    maxX: number,
    maxY: number,
    maxZ: number
];
```

#### `OBB3`

```ts
/** A oriented bounding box in 3D space */
export type OBB3 = {
    center: Vec3;
    halfExtents: Vec3;
    rotation: Mat3;
};
```

#### `EulerOrder`

```ts
/** Euler orders */
export type EulerOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';
```

#### `Euler`

```ts
/** A Euler in 3D space, with an optional order (default is 'xyz') */
export type Euler = [
    x: number,
    y: number,
    z: number,
    order?: EulerOrder
];
```

#### `Plane3`

```ts
/**
 * A plane in 3D space
 * normal - a unit length vector defining the normal of the plane.
 * constant - the signed distance from the origin to the plane.
 */
export type Plane3 = {
    normal: Vec3;
    constant: number;
};
```

#### `Sphere`

```ts
/** A sphere in 3D space */
export type Sphere = {
    center: Vec3;
    radius: number;
};
```

#### `Circle`

```ts
/** A circle in 2D space */
export type Circle = {
    center: Vec2;
    radius: number;
};
```

#### `Ray3`

```ts
/** A ray in 3D space */
export type Ray3 = {
    origin: Vec3;
    direction: Vec3;
};
```

#### `Raycast3`

```ts
/** A raycast in 3D space */
export type Raycast3 = {
    origin: Vec3;
    direction: Vec3;
    length: number;
};
```

#### `MutableArrayLike`

```ts
export type MutableArrayLike<T> = {
    [index: number]: T;
    length: number;
};
```

### vec2

#### `vec2.create`

```ts
/**
 * Creates a new, empty vec2
 *
 * @returns a new 2D vector
 */
export function create(): Vec2;
```

#### `vec2.clone`

```ts
/**
 * Creates a new vec2 initialized with values from an existing vector
 *
 * @param a vector to clone
 * @returns a new 2D vector
 */
export function clone(a: Vec2): Vec2;
```

#### `vec2.fromValues`

```ts
/**
 * Creates a new vec2 initialized with the given values
 *
 * @param x X component
 * @param y Y component
 * @returns a new 2D vector
 */
export function fromValues(x: number, y: number): Vec2;
```

#### `vec2.copy`

```ts
/**
 * Copy the values from one vec2 to another
 *
 * @param out the receiving vector
 * @param a the source vector
 * @returns out
 */
export function copy(out: Vec2, a: Vec2): Vec2;
```

#### `vec2.set`

```ts
/**
 * Set the components of a vec2 to the given values
 *
 * @param out the receiving vector
 * @param x X component
 * @param y Y component
 * @returns out
 */
export function set(out: Vec2, x: number, y: number): Vec2;
```

#### `vec2.add`

```ts
/**
 * Adds two vec2's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function add(out: Vec2, a: Vec2, b: Vec2): Vec2;
```

#### `vec2.addScalar`

```ts
/**
 * Adds a scalar value to all components of a vec2
 *
 * @param out the receiving vector
 * @param a the source vector
 * @param b the scalar value to add
 * @returns out
 */
export function addScalar(out: Vec2, a: Vec2, b: number): Vec2;
```

#### `vec2.subtract`

```ts
/**
 * Subtracts vector b from vector a
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function subtract(out: Vec2, a: Vec2, b: Vec2): Vec2;
```

#### `vec2.subtractScalar`

```ts
/**
 * Subtracts a scalar value from all components of a vec2
 *
 * @param out the receiving vector
 * @param a the source vector
 * @param b the scalar value to subtract
 * @returns out
 */
export function subtractScalar(out: Vec2, a: Vec2, b: number): Vec2;
```

#### `vec2.multiply`

```ts
/**
 * Multiplies two vec2's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function multiply(out: Vec2, a: Vec2, b: Vec2): Vec2;
```

#### `vec2.divide`

```ts
/**
 * Divides two vec2's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function divide(out: Vec2, a: Vec2, b: Vec2): Vec2;
```

#### `vec2.ceil`

```ts
/**
 * Math.ceil the components of a vec2
 *
 * @param out the receiving vector
 * @param a vector to ceil
 * @returns out
 */
export function ceil(out: Vec2, a: Vec2): Vec2;
```

#### `vec2.floor`

```ts
/**
 * Math.floor the components of a vec2
 *
 * @param out the receiving vector
 * @param a vector to floor
 * @returns out
 */
export function floor(out: Vec2, a: Vec2): Vec2;
```

#### `vec2.min`

```ts
/**
 * Returns the minimum of two vec2's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function min(out: Vec2, a: Vec2, b: Vec2): Vec2;
```

#### `vec2.max`

```ts
/**
 * Returns the maximum of two vec2's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function max(out: Vec2, a: Vec2, b: Vec2): Vec2;
```

#### `vec2.round`

```ts
/**
 * symmetric round the components of a vec2
 *
 * @param out the receiving vector
 * @param a vector to round
 * @returns out
 */
export function round(out: Vec2, a: Vec2): Vec2;
```

#### `vec2.scale`

```ts
/**
 * Scales a vec2 by a scalar number
 *
 * @param out the receiving vector
 * @param a the vector to scale
 * @param b amount to scale the vector by
 * @returns out
 */
export function scale(out: Vec2, a: Vec2, b: number): Vec2;
```

#### `vec2.scaleAndAdd`

```ts
/**
 * Adds two vec2's after scaling the second operand by a scalar value
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @param scale the amount to scale b by before adding
 * @returns out
 */
export function scaleAndAdd(out: Vec2, a: Vec2, b: Vec2, scale: number): Vec2;
```

#### `vec2.distance`

```ts
/**
 * Calculates the euclidian distance between two vec2's
 *
 * @param a the first operand
 * @param b the second operand
 * @returns distance between a and b
 */
export function distance(a: Vec2, b: Vec2): number;
```

#### `vec2.squaredDistance`

```ts
/**
 * Calculates the squared euclidian distance between two vec2's
 *
 * @param a the first operand
 * @param b the second operand
 * @returns squared distance between a and b
 */
export function squaredDistance(a: Vec2, b: Vec2): number;
```

#### `vec2.length`

```ts
/**
 * Calculates the length of a vec2
 *
 * @param a vector to calculate length of
 * @returns length of a
 */
export function length(a: Vec2): number;
```

#### `vec2.squaredLength`

```ts
/**
 * Calculates the squared length of a vec2
 *
 * @param a vector to calculate squared length of
 * @returns squared length of a
 */
export function squaredLength(a: Vec2): number;
```

#### `vec2.negate`

```ts
/**
 * Negates the components of a vec2
 *
 * @param out the receiving vector
 * @param a vector to negate
 * @returns out
 */
export function negate(out: Vec2, a: Vec2): Vec2;
```

#### `vec2.inverse`

```ts
/**
 * Returns the inverse of the components of a vec2
 *
 * @param out the receiving vector
 * @param a vector to invert
 * @returns out
 */
export function inverse(out: Vec2, a: Vec2): Vec2;
```

#### `vec2.normalize`

```ts
/**
 * Normalize a vec2
 *
 * @param out the receiving vector
 * @param a vector to normalize
 * @returns out
 */
export function normalize(out: Vec2, a: Vec2): Vec2;
```

#### `vec2.dot`

```ts
/**
 * Calculates the dot product of two vec2's
 *
 * @param a the first operand
 * @param b the second operand
 * @returns dot product of a and b
 */
export function dot(a: Vec2, b: Vec2): number;
```

#### `vec2.cross`

```ts
/**
 * Computes the cross product of two vec2's
 * Note that the cross product must by definition produce a 3D vector
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function cross(out: Vec3, a: Vec2, b: Vec2): Vec3;
```

#### `vec2.lerp`

```ts
/**
 * Performs a linear interpolation between two vec2's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @param t interpolation amount, in the range [0-1], between the two inputs
 * @returns out
 */
export function lerp(out: Vec2, a: Vec2, b: Vec2, t: number): Vec2;
```

#### `vec2.transformMat2`

```ts
/**
 * Transforms the vec2 with a mat2
 *
 * @param out the receiving vector
 * @param a the vector to transform
 * @param m matrix to transform with
 * @returns out
 */
export function transformMat2(out: Vec2, a: Vec2, m: Mat2): Vec2;
```

#### `vec2.transformMat2d`

```ts
/**
 * Transforms the vec2 with a mat2d
 *
 * @param out the receiving vector
 * @param a the vector to transform
 * @param m matrix to transform with
 * @returns out
 */
export function transformMat2d(out: Vec2, a: Vec2, m: Mat2d): Vec2;
```

#### `vec2.transformMat3`

```ts
/**
 * Transforms the vec2 with a mat3
 * 3rd vector component is implicitly '1'
 *
 * @param out the receiving vector
 * @param a the vector to transform
 * @param m matrix to transform with
 * @returns out
 */
export function transformMat3(out: Vec2, a: Vec2, m: Mat3): Vec2;
```

#### `vec2.transformMat4`

```ts
/**
 * Transforms the vec2 with a mat4
 * 3rd vector component is implicitly '0'
 * 4th vector component is implicitly '1'
 *
 * @param out the receiving vector
 * @param a the vector to transform
 * @param m matrix to transform with
 * @returns out
 */
export function transformMat4(out: Vec2, a: Vec2, m: Mat4): Vec2;
```

#### `vec2.rotate`

```ts
/**
 * Rotate a 2D vector
 * @param out The receiving vec2
 * @param a The vec2 point to rotate
 * @param b The origin of the rotation
 * @param rad The angle of rotation in radians
 * @returns out
 */
export function rotate(out: Vec2, a: Vec2, b: Vec2, rad: number): Vec2;
```

#### `vec2.angle`

```ts
/**
 * Get the angle between two 2D vectors
 * @param a The first operand
 * @param b The second operand
 * @returns The angle in radians
 */
export function angle(a: Vec2, b: Vec2): number;
```

#### `vec2.zero`

```ts
/**
 * Set the components of a vec2 to zero
 *
 * @param out the receiving vector
 * @returns out
 */
export function zero(out: Vec2): Vec2;
```

#### `vec2.str`

```ts
/**
 * Returns a string representation of a vector
 *
 * @param a vector to represent as a string
 * @returns string representation of the vector
 */
export function str(a: Vec2): string;
```

#### `vec2.exactEquals`

```ts
/**
 * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)
 *
 * @param a The first vector.
 * @param b The second vector.
 * @returns True if the vectors are equal, false otherwise.
 */
export function exactEquals(a: Vec2, b: Vec2): boolean;
```

#### `vec2.equals`

```ts
/**
 * Returns whether or not the vectors have approximately the same elements in the same position.
 *
 * @param a The first vector.
 * @param b The second vector.
 * @returns True if the vectors are equal, false otherwise.
 */
export function equals(a: Vec2, b: Vec2): boolean;
```

#### `vec2.finite`

```ts
/**
 * Returns whether or not the vector is finite
 * @param a vector to test
 * @returns whether or not the vector is finite
 */
export function finite(a: Vec2): boolean;
```

#### `vec2.len`

```ts
/**
 * Alias for {@link length}
 */
export const len = length;
```

#### `vec2.sub`

```ts
/**
 * Alias for {@link subtract}
 */
export const sub = subtract;
```

#### `vec2.mul`

```ts
/**
 * Alias for {@link multiply}
 */
export const mul = multiply;
```

#### `vec2.div`

```ts
/**
 * Alias for {@link divide}
 */
export const div = divide;
```

#### `vec2.dist`

```ts
/**
 * Alias for {@link distance}
 */
export const dist = distance;
```

#### `vec2.sqrDist`

```ts
/**
 * Alias for {@link squaredDistance}
 */
export const sqrDist = squaredDistance;
```

#### `vec2.sqrLen`

```ts
/**
 * Alias for {@link squaredLength}
 */
export const sqrLen = squaredLength;
```

### vec3

#### `vec3.create`

```ts
/**
 * Creates a new, empty vec3
 *
 * @returns a new 3D vector
 */
export function create(): Vec3;
```

#### `vec3.clone`

```ts
/**
 * Creates a new vec3 initialized with values from an existing vector
 *
 * @param a vector to clone
 * @returns a new 3D vector
 */
export function clone(a: Vec3): Vec3;
```

#### `vec3.length`

```ts
/**
 * Calculates the length of a vec3
 *
 * @param a vector to calculate length of
 * @returns length of a
 */
export function length(a: Vec3): number;
```

#### `vec3.fromValues`

```ts
/**
 * Creates a new vec3 initialized with the given values
 *
 * @param x X component
 * @param y Y component
 * @param z Z component
 * @returns a new 3D vector
 */
export function fromValues(x: number, y: number, z: number): Vec3;
```

#### `vec3.copy`

```ts
/**
 * Copy the values from one vec3 to another
 *
 * @param out the receiving vector
 * @param a the source vector
 * @returns out
 */
export function copy(out: Vec3, a: Vec3): Vec3;
```

#### `vec3.set`

```ts
/**
 * Set the components of a vec3 to the given values
 *
 * @param out the receiving vector
 * @param x X component
 * @param y Y component
 * @param z Z component
 * @returns out
 */
export function set(out: Vec3, x: number, y: number, z: number): Vec3;
```

#### `vec3.setScalar`

```ts
/**
 * Sets all components of a vec3 to the given scalar value
 *
 * @param out the receiving vector
 * @param s scalar value to set
 * @returns out
 */
export function setScalar(out: Vec3, s: number): Vec3;
```

#### `vec3.fromBuffer`

```ts
/**
 * Sets the components of a vec3 from a buffer
 * @param out the receiving vector
 * @param buffer the source buffer
 * @param startIndex the starting index in the buffer
 * @returns out
 */
export function fromBuffer(out: Vec3, buffer: ArrayLike<number>, startIndex: number): Vec3;
```

#### `vec3.toBuffer`

```ts
/**
 * Writes the components of a vec3 to a buffer
 * @param outBuffer The output buffer
 * @param vec The source vector
 * @param startIndex The starting index in the buffer
 * @returns The output buffer
 */
export function toBuffer(outBuffer: MutableArrayLike<number>, vec: Vec3, startIndex: number): ArrayLike<number>;
```

#### `vec3.add`

```ts
/**
 * Adds two vec3's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function add(out: Vec3, a: Vec3, b: Vec3): Vec3;
```

#### `vec3.addScalar`

```ts
/**
 * Adds a scalar value to all components of a vec3
 *
 * @param out the receiving vector
 * @param a the source vector
 * @param b the scalar value to add
 * @returns out
 */
export function addScalar(out: Vec3, a: Vec3, b: number): Vec3;
```

#### `vec3.subtract`

```ts
/**
 * Subtracts vector b from vector a
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function subtract(out: Vec3, a: Vec3, b: Vec3): Vec3;
```

#### `vec3.subtractScalar`

```ts
/**
 * Subtracts a scalar value from all components of a vec3
 *
 * @param out the receiving vector
 * @param a the source vector
 * @param b the scalar value to subtract
 * @returns out
 */
export function subtractScalar(out: Vec3, a: Vec3, b: number): Vec3;
```

#### `vec3.multiply`

```ts
/**
 * Multiplies two vec3's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function multiply(out: Vec3, a: Vec3, b: Vec3): Vec3;
```

#### `vec3.divide`

```ts
/**
 * Divides two vec3's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function divide(out: Vec3, a: Vec3, b: Vec3): Vec3;
```

#### `vec3.ceil`

```ts
/**
 * Math.ceil the components of a vec3
 *
 * @param out the receiving vector
 * @param a vector to ceil
 * @returns out
 */
export function ceil(out: Vec3, a: Vec3): Vec3;
```

#### `vec3.floor`

```ts
/**
 * Math.floor the components of a vec3
 *
 * @param out the receiving vector
 * @param a vector to floor
 * @returns out
 */
export function floor(out: Vec3, a: Vec3): Vec3;
```

#### `vec3.min`

```ts
/**
 * Returns the minimum of two vec3's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function min(out: Vec3, a: Vec3, b: Vec3): Vec3;
```

#### `vec3.max`

```ts
/**
 * Returns the maximum of two vec3's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function max(out: Vec3, a: Vec3, b: Vec3): Vec3;
```

#### `vec3.round`

```ts
/**
 * symmetric round the components of a vec3
 *
 * @param out the receiving vector
 * @param a vector to round
 * @returns out
 */
export function round(out: Vec3, a: Vec3): Vec3;
```

#### `vec3.scale`

```ts
/**
 * Scales a vec3 by a scalar number
 *
 * @param out the receiving vector
 * @param a the vector to scale
 * @param b amount to scale the vector by
 * @returns out
 */
export function scale(out: Vec3, a: Vec3, b: number): Vec3;
```

#### `vec3.scaleAndAdd`

```ts
/**
 * Adds two vec3's after scaling the second operand by a scalar value
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @param scale the amount to scale b by before adding
 * @returns out
 */
export function scaleAndAdd(out: Vec3, a: Vec3, b: Vec3, scale: number): Vec3;
```

#### `vec3.distance`

```ts
/**
 * Calculates the euclidian distance between two vec3's
 *
 * @param a the first operand
 * @param b the second operand
 * @returns distance between a and b
 */
export function distance(a: Vec3, b: Vec3): number;
```

#### `vec3.squaredDistance`

```ts
/**
 * Calculates the squared euclidian distance between two vec3's
 *
 * @param a the first operand
 * @param b the second operand
 * @returns squared distance between a and b
 */
export function squaredDistance(a: Vec3, b: Vec3): number;
```

#### `vec3.squaredLength`

```ts
/**
 * Calculates the squared length of a vec3
 *
 * @param a vector to calculate squared length of
 * @returns squared length of a
 */
export function squaredLength(a: Vec3): number;
```

#### `vec3.negate`

```ts
/**
 * Negates the components of a vec3
 *
 * @param out the receiving vector
 * @param a vector to negate
 * @returns out
 */
export function negate(out: Vec3, a: Vec3): Vec3;
```

#### `vec3.inverse`

```ts
/**
 * Returns the inverse of the components of a vec3
 *
 * @param out the receiving vector
 * @param a vector to invert
 * @returns out
 */
export function inverse(out: Vec3, a: Vec3): Vec3;
```

#### `vec3.normalize`

```ts
/**
 * Normalize a vec3
 *
 * @param out the receiving vector
 * @param a vector to normalize
 * @returns out
 */
export function normalize(out: Vec3, a: Vec3): Vec3;
```

#### `vec3.dot`

```ts
/**
 * Calculates the dot product of two vec3's
 *
 * @param a the first operand
 * @param b the second operand
 * @returns dot product of a and b
 */
export function dot(a: Vec3, b: Vec3): number;
```

#### `vec3.cross`

```ts
/**
 * Computes the cross product of two vec3's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function cross(out: Vec3, a: Vec3, b: Vec3): Vec3;
```

#### `vec3.perpendicular`

```ts
/**
 * Calculates a normalized perpendicular vector to the given vector.
 * Useful for finding an arbitrary orthogonal basis vector.
 *
 * @param out the receiving vector
 * @param a the source vector
 * @returns the out vector
 */
export function perpendicular(out: Vec3, a: Vec3): Vec3;
```

#### `vec3.lerp`

```ts
/**
 * Performs a linear interpolation between two vec3's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @param t interpolation amount, in the range [0-1], between the two inputs
 * @returns out
 */
export function lerp(out: Vec3, a: Vec3, b: Vec3, t: number): Vec3;
```

#### `vec3.slerp`

```ts
/**
 * Performs a spherical linear interpolation between two vec3's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @param t interpolation amount, in the range [0-1], between the two inputs
 * @returns out
 */
export function slerp(out: Vec3, a: Vec3, b: Vec3, t: number): Vec3;
```

#### `vec3.hermite`

```ts
/**
 * Performs a hermite interpolation with two control points
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @param c the third operand
 * @param d the fourth operand
 * @param t interpolation amount, in the range [0-1], between the two inputs
 * @returns out
 */
export function hermite(out: Vec3, a: Vec3, b: Vec3, c: Vec3, d: Vec3, t: number): Vec3;
```

#### `vec3.bezier`

```ts
/**
 * Performs a bezier interpolation with two control points
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @param c the third operand
 * @param d the fourth operand
 * @param t interpolation amount, in the range [0-1], between the two inputs
 * @returns out
 */
export function bezier(out: Vec3, a: Vec3, b: Vec3, c: Vec3, d: Vec3, t: number): Vec3;
```

#### `vec3.transformMat4`

```ts
/**
 * Transforms the vec3 with a mat4.
 * 4th vector component is implicitly '1'
 *
 * @param out the receiving vector
 * @param a the vector to transform
 * @param m matrix to transform with
 * @returns out
 */
export function transformMat4(out: Vec3, a: Vec3, m: Mat4): Vec3;
```

#### `vec3.transformMat3`

```ts
/**
 * Transforms the vec3 with a mat3.
 *
 * @param out the receiving vector
 * @param a the vector to transform
 * @param m the 3x3 matrix to transform with
 * @returns out
 */
export function transformMat3(out: Vec3, a: Vec3, m: Mat3): Vec3;
```

#### `vec3.transformQuat`

```ts
/**
 * Transforms the vec3 with a quat
 * Can also be used for dual quaternions. (Multiply it with the real part)
 *
 * @param out the receiving vector
 * @param a the vector to transform
 * @param q quaternion to transform with
 * @returns out
 */
export function transformQuat(out: Vec3, a: Vec3, q: Quat): Vec3;
```

#### `vec3.rotateX`

```ts
/**
 * Rotate a 3D vector around the x-axis
 * @param out The receiving vec3
 * @param a The vec3 point to rotate
 * @param b The origin of the rotation
 * @param rad The angle of rotation in radians
 * @returns out
 */
export function rotateX(out: Vec3, a: Vec3, b: Vec3, rad: number): Vec3;
```

#### `vec3.rotateY`

```ts
/**
 * Rotate a 3D vector around the y-axis
 * @param out The receiving vec3
 * @param a The vec3 point to rotate
 * @param b The origin of the rotation
 * @param rad The angle of rotation in radians
 * @returns out
 */
export function rotateY(out: Vec3, a: Vec3, b: Vec3, rad: number): Vec3;
```

#### `vec3.rotateZ`

```ts
/**
 * Rotate a 3D vector around the z-axis
 * @param out The receiving vec3
 * @param a The vec3 point to rotate
 * @param b The origin of the rotation
 * @param rad The angle of rotation in radians
 * @returns out
 */
export function rotateZ(out: Vec3, a: Vec3, b: Vec3, rad: number): Vec3;
```

#### `vec3.angle`

```ts
/**
 * Get the angle between two 3D vectors
 * @param a The first operand
 * @param b The second operand
 * @returns The angle in radians
 */
export function angle(a: Vec3, b: Vec3): number;
```

#### `vec3.zero`

```ts
/**
 * Set the components of a vec3 to zero
 *
 * @param out the receiving vector
 * @returns out
 */
export function zero(out: Vec3): Vec3;
```

#### `vec3.str`

```ts
/**
 * Returns a string representation of a vector
 *
 * @param a vector to represent as a string
 * @returns string representation of the vector
 */
export function str(a: Vec3): string;
```

#### `vec3.exactEquals`

```ts
/**
 * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
 *
 * @param a The first vector.
 * @param b The second vector.
 * @returns True if the vectors are equal, false otherwise.
 */
export function exactEquals(a: Vec3, b: Vec3): boolean;
```

#### `vec3.equals`

```ts
/**
 * Returns whether or not the vectors have approximately the same elements in the same position.
 *
 * @param a The first vector.
 * @param b The second vector.
 * @returns True if the vectors are equal, false otherwise.
 */
export function equals(a: Vec3, b: Vec3): boolean;
```

#### `vec3.finite`

```ts
/**
 * Returns whether or not the vector is finite
 * @param a vector to test
 * @returns whether or not the vector is finite
 */
export function finite(a: Vec3): boolean;
```

#### `vec3.isScaleInsideOut`

```ts
/**
 * Determines if a scale vector represents an inside-out transformation (reflection)
 * Returns true if an odd number of scale components are negative
 *
 * @param scale The scale vector to test
 * @returns true if the scale represents a reflection (odd number of negative components)
 */
export function isScaleInsideOut(scale: Vec3): boolean;
```

#### `vec3.sub`

```ts
/**
 * Alias for {@link subtract}
 */
export const sub = subtract;
```

#### `vec3.mul`

```ts
/**
 * Alias for {@link multiply}
 */
export const mul = multiply;
```

#### `vec3.div`

```ts
/**
 * Alias for {@link divide}
 */
export const div = divide;
```

#### `vec3.dist`

```ts
/**
 * Alias for {@link distance}
 */
export const dist = distance;
```

#### `vec3.sqrDist`

```ts
/**
 * Alias for {@link squaredDistance}
 */
export const sqrDist = squaredDistance;
```

#### `vec3.len`

```ts
/**
 * Alias for {@link length}
 */
export const len = length;
```

#### `vec3.sqrLen`

```ts
/**
 * Alias for {@link squaredLength}
 */
export const sqrLen = squaredLength;
```

### vec4

#### `vec4.create`

```ts
/**
 * Creates a new, empty vec4
 *
 * @returns a new 4D vector
 */
export function create(): Vec4;
```

#### `vec4.clone`

```ts
/**
 * Creates a new vec4 initialized with values from an existing vector
 *
 * @param a vector to clone
 * @returns a new 4D vector
 */
export function clone(a: Vec4): Vec4;
```

#### `vec4.fromValues`

```ts
/**
 * Creates a new vec4 initialized with the given values
 *
 * @param x X component
 * @param y Y component
 * @param z Z component
 * @param w W component
 * @returns a new 4D vector
 */
export function fromValues(x: number, y: number, z: number, w: number): Vec4;
```

#### `vec4.copy`

```ts
/**
 * Copy the values from one vec4 to another
 *
 * @param out the receiving vector
 * @param a the source vector
 * @returns out
 */
export function copy(out: Vec4, a: Vec4): Vec4;
```

#### `vec4.set`

```ts
/**
 * Set the components of a vec4 to the given values
 *
 * @param out the receiving vector
 * @param x X component
 * @param y Y component
 * @param z Z component
 * @param w W component
 * @returns out
 */
export function set(out: Vec4, x: number, y: number, z: number, w: number): Vec4;
```

#### `vec4.add`

```ts
/**
 * Adds two vec4's
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @returns out
 */
export function add(out: Vec4, a: Vec4, b: Vec4): Vec4;
```

#### `vec4.subtract`

```ts
/**
 * Subtracts vector b from vector a
 *
 * @param out the receiving vector
 * @param a the first operand
 * @param b the second operand
 * @retur