Array-based vector, quaternion and matrix math with utils for PEX.
npm install pex-math








Array-based vector, quaternion and matrix math with utils for PEX.
``bash`
npm install pex-math
`javascript
import { mat4 } from "pex-math";
const identityMatrix = mat4.create();
// => [1, 0, 0, 0,
// 0, 1, 0, 0,
// 0, 0, 1, 0,
// 0, 0, 0, 1]
`
Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64ArrayTypedArrayTypedArrayTypedArrayTypedArrayTypedArrayArray.<number>Array.<number>Array.<number>Array.<number>Array.<number>Array.<number>Array.<number>Array.<number>numbernumberfunctionCallback for iterating typed arrays.
numberEase functions signature.
numberEase step functions signature.
- pex-math
- .mat2x3 : mat2x3
- .mat3 : mat3
- .mat4 : mat4
- .vec2 : vec2
- .vec3 : vec3
- .vec4 : vec4
- .avec2 : avec2
- .avec3 : avec3
- .avec4 : avec4
- .quat : quat
- .euler : euler
- .eases : eases
- .utils : utils
Kind: static property of pex-math
Kind: static property of pex-math
Kind: static property of pex-math
Kind: static property of pex-math
Kind: static property of pex-math
Kind: static property of pex-math
Kind: static property of pex-math
Kind: static property of pex-math
Kind: static property of pex-math
Kind: static property of pex-math
Kind: static property of pex-math
Kind: static property of pex-math
Kind: static property of pex-math
- avec2
- .set2(a, i, x, y)
- .set(a, i, b, j)
- .equals(a, i, b, j) ⇒ boolean
- .add(a, i, b, j)
- .sub(a, i, b, j)
- .scale(a, i, s)
- .addScaled(a, i, b, j, s)
- .dot(a, i, b, j) ⇒ number
- .length(a, i) ⇒ number
- .lengthSq(a, i) ⇒ number
- .normalize(a, i)
- .distance(a, i, b, j) ⇒ number
- .distanceSq(a, i, b, j) ⇒ number
- .limit(a, i, len)
- .lerp(a, i, b, j, t)
- .forEach(a, callbackFn)
- .map(a, callbackFn) ⇒ avec2
- [.toString(a, i, [precision])](#module_avec2.toString) ⇒ string
Sets a vector components.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
| x | number |
| y | number |
Sets a vector to another vector.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
| b | avec2 |
| j | number |
Compares two vectors.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
| b | avec2 |
| j | number |
Adds a vector to another.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
| b | avec2 |
| j | number |
Subtracts a vector from another.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
| b | avec2 |
| j | number |
Scales a vector by a number.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
| s | number |
Adds two vectors after scaling the second one.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
| b | avec2 |
| j | number |
| s | number |
Calculates the dot product of two vectors.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
| b | avec2 |
| j | number |
Calculates the length of a vector.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
Calculates the squared length of a vector.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
Normalises a vector.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
Calculates the distance between two vectors.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
| b | avec2 |
| j | number |
Calculates the squared distance between two vectors.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
| b | avec2 |
| j | number |
Limits a vector to a length.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
| len | number |
Linearly interpolates between two vectors.
Kind: static method of avec2
| Param | Type |
| ----- | ---------------------------- |
| a | avec2 |
| i | number |
| b | avec2 |
| j | number |
| t | number |
Executes a function once for each array element.
Kind: static method of avec2
| Param | Type |
| ---------- | ---------------------------------------------------- |
| a | avec2 |
| callbackFn | iterativeCallback |
Creates a new array populated with the results of calling a provided function on every element in the calling array.
Kind: static method of avec2
| Param | Type |
| ---------- | ---------------------------------------------------- |
| a | avec2 |
| callbackFn | iterativeCallback |
Prints a vector to a string.
Kind: static method of avec2
| Param | Type | Default |
| ----------- | ---------------------------- | -------------- |
| a | avec2 | |
| i | number | |
| [precision] | number | 4 |
- avec3
- .set3(a, i, x, y, z)
- .set(a, i, b, j)
- .equals(a, i, b, j) ⇒ boolean
- .add(a, i, b, j)
- .sub(a, i, b, j)
- .scale(a, i, s)
- .addScaled(a, i, b, j, s)
- .multMat4(a, i, m, j)
- .multQuat(a, i, q, j)
- .dot(a, i, b, j) ⇒ number
- .cross(a, i, b, j)
- .length(a, i) ⇒ number
- .lengthSq(a, i) ⇒ number
- .normalize(a, i)
- .distance(a, i, b, j) ⇒ number
- .distanceSq(a, i, b, j) ⇒ number
- .limit(a, i, len)
- .lerp(a, i, b, j, t)
- .forEach(a, callbackFn)
- .map(a, callbackFn) ⇒ avec3
- [.toString(a, i, [precision])](#module_avec3.toString) ⇒ string
Sets a vector components.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| x | number |
| y | number |
| z | number |
Sets a vector to another vector.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| b | avec3 |
| j | number |
Compares two vectors.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| b | avec3 |
| j | number |
Adds a vector to another.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| b | avec3 |
| j | number |
Subtracts a vector from another.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| b | avec3 |
| j | number |
Scales a vector by a number.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| s | number |
Adds two vectors after scaling the second one.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| b | avec3 |
| j | number |
| s | number |
Multiplies a vector by a matrix.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| m | amat4 |
| j | number |
Multiplies a vector by a quaternion.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| q | aquat |
| j | number |
Calculates the dot product of two vectors.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| b | avec3 |
| j | number |
Calculates the cross product of two vectors.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| b | avec3 |
| j | number |
Calculates the length of a vector.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
Calculates the squared length of a vector.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
Normalises a vector.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
Calculates the distance between two vectors.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| b | avec3 |
| j | number |
Calculates the squared distance between two vectors.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| b | avec3 |
| j | number |
Limits a vector to a length.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| len | number |
Linearly interpolates between two vectors.
Kind: static method of avec3
| Param | Type |
| ----- | ---------------------------- |
| a | avec3 |
| i | number |
| b | avec3 |
| j | number |
| t | number |
Executes a function once for each array element.
Kind: static method of avec3
| Param | Type |
| ---------- | ---------------------------------------------------- |
| a | avec3 |
| callbackFn | iterativeCallback |
Creates a new array populated with the results of calling a provided function on every element in the calling array.
Kind: static method of avec3
| Param | Type |
| ---------- | ---------------------------------------------------- |
| a | avec3 |
| callbackFn | iterativeCallback |
Prints a vector to a string.
Kind: static method of avec3
| Param | Type | Default |
| ----------- | ---------------------------- | -------------- |
| a | avec3 | |
| i | number | |
| [precision] | number | 4 |
- avec4
- .set4(a, i, x, y, z, w)
- .set(a, i, b, j)
- .equals(a, i, b, j) ⇒ boolean
- .add(a, i, b, j)
- .sub(a, i, b, j)
- .scale(a, i, s)
- .addScaled(a, i, b, j, s)
- .multMat4(a, i, m, j)
- .lerp(a, i, b, j, t)
- .forEach(a, callbackFn)
- .map(a, callbackFn) ⇒ avec4
- [.toString(a, i, [precision])](#module_avec4.toString) ⇒ string
Sets a vector components.
Kind: static method of avec4
| Param | Type |
| ----- | ---------------------------- |
| a | avec4 |
| i | number |
| x | number |
| y | number |
| z | number |
| w | number |
Sets a vector to another vector.
Kind: static method of avec4
| Param | Type |
| ----- | ---------------------------- |
| a | avec4 |
| i | number |
| b | avec4 |
| j | number |
Compares two vectors.
Kind: static method of avec4
| Param | Type |
| ----- | ---------------------------- |
| a | avec4 |
| i | number |
| b | avec4 |
| j | number |
Adds a vector to another.
Kind: static method of avec4
| Param | Type |
| ----- | ---------------------------- |
| a | avec4 |
| i | number |
| b | avec4 |
| j | number |
Subtracts a vector from another.
Kind: static method of avec4
| Param | Type |
| ----- | ---------------------------- |
| a | avec4 |
| i | number |
| b | avec4 |
| j | number |
Scales a vector by a number.
Kind: static method of avec4
| Param | Type |
| ----- | ---------------------------- |
| a | avec4 |
| i | number |
| s | number |
Adds two vectors after scaling the second one.
Kind: static method of avec4
| Param | Type |
| ----- | ---------------------------- |
| a | avec4 |
| i | number |
| b | avec4 |
| j | number |
| s | number |
Multiplies a vector with a matrix.
Kind: static method of avec4
| Param | Type |
| ----- | ---------------------------- |
| a | avec4 |
| i | number |
| m | amat4 |
| j | number |
Linearly interpolates between two vectors.
Kind: static method of avec4
| Param | Type |
| ----- | ---------------------------- |
| a | avec4 |
| i | number |
| b | avec4 |
| j | number |
| t | number |
Executes a function once for each array element.
Kind: static method of avec4
| Param | Type |
| ---------- | ---------------------------------------------------- |
| a | avec4 |
| callbackFn | iterativeCallback |
Creates a new array populated with the results of calling a provided function on every element in the calling array.
Kind: static method of avec4
| Param | Type |
| ---------- | ---------------------------------------------------- |
| a | avec4 |
| callbackFn | iterativeCallback |
Prints a vector to a string.
Kind: static method of avec4
| Param | Type | Default |
| ----------- | ---------------------------- | -------------- |
| a | avec4 | |
| i | number | |
| [precision] | number | 4 |
- eases
- .linear() : easeFn
- .sineIn() : easeFn
- .sineOut() : easeFn
- .sineInOut() : easeFn
- .quadIn() : easeFn
- .quadOut() : easeFn
- .quadInOut() : easeFn
- .cubicIn() : easeFn
- .cubicOut() : easeFn
- .cubicInOut() : easeFn
- .quartIn() : easeFn
- .quartOut() : easeFn
- .quartInOut() : easeFn
- .quintIn() : easeFn
- .quintOut() : easeFn
- .quintInOut() : easeFn
- .expoIn() : easeFn
- .expoOut() : easeFn
- .expoInOut() : easeFn
- .circIn() : easeFn
- .circOut() : easeFn
- .circInOut() : easeFn
- .backIn() : easeFn
- .backOut() : easeFn
- .backInOut() : easeFn
- .elasticIn() : easeFn
- .elasticOut() : easeFn
- .elasticInOut() : easeFn
- .bounceIn() : easeFn
- .bounceOut() : easeFn
- .bounceInOut() : easeFn
- .stepStart() : easeStepFn
- .stepEnd() : easeStepFn
- .stepNone() : easeStepFn
- .stepBoth() : easeStepFn
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
Kind: static method of eases
- euler
- .create() ⇒ euler
- .fromQuat(a, q) ⇒ euler
Create a new euler angles [0, 0, 0]: vec3 array of [x, y, z] rotation [yaw, pitch, roll] in radians.
Kind: static method of euler
Creates euler angles from quaternion. Assumes XYZ order of rotations.
Kind: static method of euler
| Param | Type |
| ----- | ---------------------------- |
| a | euler |
| q | quat |
- mat2x3
- .create() ⇒ mat2x3
- .identity(a) ⇒ mat2x3
- .copy(a) ⇒ mat2x3
- .set(a, b) ⇒ mat2x3
- .equals(a, b) ⇒ boolean
- .mult(a, b) ⇒ mat2x3
- .translate(a, v) ⇒ mat2x3
- .rotate(a, rad) ⇒ mat2x3
- .scale(a, v) ⇒ mat2x3
Returns a 2x3 identity matrix, a short form for a 3x3 matrix with the last row ignored.
Row major memory layout:
``
0 1
2 3
4 5
Equivalent to the column major OpenGL spec:
`
0 3
1 4
2 5
m00 m10
m01 m11
m02 m12
`
Kind: static method of mat2x3
Sets a matrix to the identity matrix.
Kind: static method of mat2x3
| Param | Type |
| ----- | ------------------------------ |
| a | mat2x3 |
Returns a copy of a matrix.
Kind: static method of mat2x3
| Param | Type |
| ----- | ------------------------------ |
| a | mat2x3 |
Sets a matrix from another matrix.
Kind: static method of mat2x3
| Param | Type |
| ----- | ------------------------------ |
| a | mat2x3 |
| b | mat2x3 |
Compares two matrices.
Kind: static method of mat2x3
| Param | Type |
| ----- | ------------------------------ |
| a | mat2x3 |
| b | mat2x3 |
Multiplies two matrices.
Kind: static method of mat2x3
| Param | Type |
| ----- | ------------------------------ |
| a | mat2x3 |
| b | mat2x3 |
Translates a matrix by a vector.
Kind: static method of mat2x3
| Param | Type |
| ----- | ------------------------------ |
| a | mat2x3 |
| v | vec2 |
Rotates a matrix by an angle.
Kind: static method of mat2x3
| Param | Type |
| ----- | -------------------------------- |
| a | mat2x3 |
| rad | Radians |
Scales a matrix by a vector.
Kind: static method of mat2x3
| Param | Type |
| ----- | ------------------------------ |
| a | mat2x3 |
| v | vec2 |
- mat3
- .create() ⇒ mat3
- .identity(a) ⇒ mat3
- .copy(a) ⇒ mat3
- .set(a, b) ⇒ mat3
- .equals(a, b) ⇒ boolean
- .mult(a, b) ⇒ mat3
- .transpose(a) ⇒ mat3
- .fromQuat(a, q) ⇒ mat3
- .fromMat2x3(a, b) ⇒ mat3
- .fromMat4(a, b) ⇒ mat3
Returns a 3x3 identity matrix.
Row major memory layout:
``
0 1 2
3 4 5
6 7 8
Equivalent to the column major OpenGL spec:
`
0 3 6
1 4 7
2 5 8
m00 m10 m20
m01 m11 m21
m02 m12 m22
`
Kind: static method of mat3
Sets a matrix to the identity matrix.
Kind: static method of mat3
| Param | Type |
| ----- | -------------------------- |
| a | mat3 |
Returns a copy of a matrix.
Kind: static method of mat3
| Param | Type |
| ----- | -------------------------- |
| a | mat3 |
Sets a matrix from another matrix.
Kind: static method of mat3
| Param | Type |
| ----- | -------------------------- |
| a | mat3 |
| b | mat3 |
Compares two matrices.
Kind: static method of mat3
| Param | Type |
| ----- | -------------------------- |
| a | mat3 |
| b | mat3 |
Multiplies two matrices.
Kind: static method of mat3
| Param | Type |
| ----- | -------------------------- |
| a | mat3 |
| b | mat3 |
Transposes a matrix.
Kind: static method of mat3
| Param | Type |
| ----- | -------------------------- |
| a | mat3 |
Sets matrix to a quaternion.
Kind: static method of mat3
| Param | Type |
| ----- | -------------------------- |
| a | mat3 |
| q | quat |
Sets a 3x3 matrix from a 2x3 matrix.
Kind: static method of mat3
| Param | Type |
| ----- | ------------------------------ |
| a | mat3 |
| b | mat2x3 |
Sets a 3x3 matrix to a 4x4 matrix.
Kind: static method of mat3
| Param | Type |
| ----- | -------------------------- |
| a | mat3 |
| b | mat4 |
- mat4
- .create() ⇒ mat4
- .identity(a) ⇒ mat4
- .copy(a) ⇒ mat4
- .set(a, b) ⇒ mat4
- .equals(a, b) ⇒ boolean
- .mult(a, b) ⇒ mat4
- .invert(a) ⇒ mat4
- .transpose(a) ⇒ mat4
- .translate(a, v) ⇒ mat4
- .rotate(a, r, v) ⇒ mat4
- .scale(a, v) ⇒ mat4
- .fromQuat(a, q) ⇒ mat4
- .fromTranslationRotationScale(a, v, q, s) ⇒ mat4
- .fromMat3(a, b) ⇒ mat4
- .frustum(a, left, right, bottom, top, near, far) ⇒ mat4
- .perspective(a, fovy, aspectRatio, near, far) ⇒ mat4
- .ortho(a, left, right, bottom, top, near, far) ⇒ mat4
- [.lookAt(a, from, to, [up])](#module_mat4.lookAt) ⇒ mat4
- [.fromDirection(a, direction, [up])](#module_mat4.fromDirection) ⇒ mat4
- [.fromPointToPoint(a, from, to, [up])](#module_mat4.fromPointToPoint) ⇒ mat4
Returns a 4x4 identity matrix.
Row major memory layout:
``
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
Equivalent to the column major OpenGL spec:
`
0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15
m00 m10 m20 m30
m01 m11 m21 m31
m02 m12 m22 m32
m03 m13 m23 m33
``
Kind: static method of mat4
Sets a matrix to the identity matrix.
Kind: static method of mat4
| Param | Type |
| ----- | -------------------------- |
| a | mat4 |
Returns a copy of a matrix.
Kind: static method of mat4
| Param | Type |
| ----- | -------------------------- |
| a | mat4 |
Sets a matrix from another matrix.
Kind: static method of mat4
| Param | Type |
| ----- | -------------------------- |
| a | mat4 |
| b | mat4 |
Compares two matrices.
Kind: static method of mat4
| Param | Type |
| ----- | -------------------------- |
| a | mat4 |
| b | mat4 |
Multiplies two matrices.
Kind: static method of mat4
| Param | Type |
| ----- | -------------------------- |
| a | mat4 |
| b | mat4 |
Inverts a matrix.
Kind: static method of mat4
| Param | Type |
| ----- | -------------------------- |
| a | mat4 |
Transposes a matrix.
Kind: static method of mat4
| Param | Type |
| ----- | -------------------------- |
| a | mat4 |
Translates a matrix by a vector.
Kind: static method of mat4
| Param | Type |
| ----- | -------------------------- |
| a | mat4 |
| v | vec3 |
Rotates a matrix by an angle at an axis.
Kind: static method of mat4
| Param | Type |
| ----- | -------------------------------- |
| a | mat4 |
| r | Radians |
| v | vec3 |
Scales a matrix by a vector.
Kind: static method of mat4
| Param | Type |
| ----- | -------------------------- |
| a | mat4 |
| v | vec3 |
Sets a matrix to a quaternion.
Kind: static method of mat4
| Param | Type |
| ----- | -------------------------- |
| a | mat4 |
| q | quat |
Sets a matrix to the TRS matrix.
Kind: static method of mat4
| Param | Type |
| ----- | -------------------------- |
| a | mat4 |
| v | vec3 |
| q | quat |
| s | vec3 |
Sets a 4x4 matrix to a 3x3 matrix.
Kind: static method of mat4
| Param | Type |
| ----- | -------------------------- |
| a | mat4 |
| b | mat3 |
Creates a frustum matrix.
Kind: static method of mat4
| Param | Type |
| ------ | -------------------------- |
| a | mat4 |
| left | number |
| right | number |
| bottom | number |
| top | number |
| near | number |
| far | number |
Creates a perspective matrix.
Kind: static method of mat4
| Param | Type |
| ----------- | -------------------------------- |
| a | mat4 |
| fovy | Radians |
| aspectRatio | number |
| near | number |
| far | number |
Creates an orthographic matrix.
Kind: static method of mat4
| Param | Type |
| ------ | -------------------------- |
| a | mat4 |
| left | number |
| right | number |
| bottom | number |
| top | number |
| near | number |
| far | number |
Calculates a lookAt matrix from position, target and up vectors.
Kind: static method of mat4
| Param | Type | Default |
| ----- | -------------------------- | ----------------- |
| a | mat4 | |
| from | vec3 | |
| to | vec3 | |
| [up] | vec3 | Y_UP |
Sets a matrix from a direction.
Note: we assume +Z facing models.
Kind: static method of mat4
| Param | Type | Default |
| --------- | -------------------------- | ----------------- |
| a | mat4 | |
| direction | vec3 | |
| [up] | vec3 | Y_UP |
Sets a matrix from a point to another.
Kind: static method of mat4
| Param | Type | Default |
| ----- | -------------------------- | ----------------- |
| a | mat4 | |
| from | vec3 | |
| to | vec3 | |
| [up] | vec3 | Y_UP |
- quat
- .set ⇒ quat
- .equals ⇒ boolean
- .toString ⇒ quat
- .create() ⇒ quat
- .identity(a) ⇒ quat
- .copy(a) ⇒ quat
- .mult(a, b) ⇒ quat
- .invert(a) ⇒ quat
- .conjugate(a) ⇒ quat
- .length(a) ⇒ quat
- .normalize(a) ⇒ quat
- .dot(a, b) ⇒ quat
- .fromEuler(a, e) ⇒ quat
- .fromAxisAngle(a, v, r) ⇒ quat
- .fromAxes(a, x, y, z) ⇒ quat
- .fromMat3(a, m) ⇒ quat
- .fromMat4(a, m) ⇒ quat
- [.fromDirection(a, direction, [up])](#module_quat.fromDirection) ⇒ quat
- [.fromPointToPoint(a, from, to, [up])](#module_quat.fromPointToPoint) ⇒ quat
- .slerp(a, b, t) ⇒ quat
Sets a quaternion to another quaternion.
Kind: static constant of quat
| Param | Type |
| ----- | -------------------------- |
| a | quat |
| b | quat |
Compares two quaternions.
Kind: static constant of quat
| Param | Type |
| ----- | -------------------------- |
| a | quat |
| b | quat |
Prints a quaternion to a string.
Kind: static constant of quat
| Param | Type |
| --------- | -------------------------- |
| a | quat |
| precision | number |
Returns a new quat at 0, 0, 0, 1.
Kind: static method of quat
Sets a quaternion to the identity quaternion.
Kind: static method of quat
| Param | Type |
| ----- | -------------------------- |
| a | quat |
Returns a copy of a quaternion.
Kind: static method of quat
| Param | Type |
| ----- | -------------------------- |
| a | quat |
Multiplies one quaternion by another.
Kind: static method of quat
| Param | Type |
| ----- | -------------------------- |
| a | quat |
| b | quat |
Inverts a quaternion.
Kind: static method of quat
| Param | Type |
| ----- | -------------------------- |
| a | quat |
Conjugates a quaternion.
Kind: static method of quat
| Param | Type |
| ----- | -------------------------- |
| a | quat |
Calculates the length of a quaternion.
Kind: static method of quat
| Param | Type |
| ----- | -------------------------- |
| a | quat |
Normalizes a quaternion.
Kind: static method of quat
| Param | Type |
| ----- | -------------------------- |
| a | quat |
Calculates the dot product of two quaternions.
Kind: static method of quat
| Param | Type |
| ----- | -------------------------- |
| a | quat |
| b | quat |
Set euler angles to a quaternion. Assumes XYZ rotation order.
Kind: static method of quat
| Param | Type |
| ----- | ---------------------------- |
| a | quat |
| e | euler |
Set the angle at an axis of a quaternion.
Kind: static method of quat
| Param | Type |
| ----- | -------------------------------- |
| a | quat |
| v | vec3 |
| r | Radians |