Options
All
• Public
• Public/Protected
• All

# Module quat

## Functions

• Adds two quat's

function

#### Parameters

• ##### out: IArray

the receiving quaternion

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### calculateW

• Calculates the W component of a quat from the X, Y, and Z components. Assumes that quaternion is 1 unit in length. Any existing W component will be ignored.

#### Parameters

• ##### out: IArray

the receiving quaternion

• ##### a: IArray

quat to calculate W component of

out

### clone

• Creates a new quat initialized with values from an existing quaternion

function

#### Parameters

• ##### a: IArray

quaternion to clone

#### Returns IArray

a new quaternion

### conjugate

• Calculates the conjugate of a quat If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.

#### Parameters

• ##### out: IArray

the receiving quaternion

• ##### a: IArray

quat to calculate conjugate of

out

### copy

• Copy the values from one quat to another

function

#### Parameters

• ##### out: IArray

the receiving quaternion

• ##### a: IArray

the source quaternion

out

### create

• Creates a new identity quat

#### Returns IArray

a new quaternion

### dot

• Calculates the dot product of two quat's

function

#### Parameters

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

#### Returns number

dot product of a and b

### fromMat3

• Creates a quaternion from the given 3x3 rotation matrix.

NOTE: The resultant quaternion is not normalized, so you should be sure to renormalize the quaternion yourself where necessary.

function

#### Parameters

• ##### out: IArray

the receiving quaternion

• ##### m: IArray

rotation matrix

out

### fromValues

• fromValues(x: number, y: number, z: number, w: number): IArray
• Creates a new quat initialized with the given values

function

#### Parameters

• ##### x: number

X component

• ##### y: number

Y component

• ##### z: number

Z component

• ##### w: number

W component

#### Returns IArray

a new quaternion

### identity

• Set a quat to the identity quaternion

#### Parameters

• ##### out: IArray

the receiving quaternion

out

### invert

• Calculates the inverse of a quat

#### Parameters

• ##### out: IArray

the receiving quaternion

• ##### a: IArray

quat to calculate inverse of

out

### len

• Calculates the length of a quat

function

#### Parameters

• ##### a: IArray

vector to calculate length of

length of a

### length

• Calculates the length of a quat

function

#### Parameters

• ##### a: IArray

vector to calculate length of

length of a

### lerp

• Performs a linear interpolation between two quat's

function

#### Parameters

• ##### out: IArray

the receiving quaternion

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

• ##### t: number

interpolation amount between the two inputs

out

### mul

• Multiplies two quat's

#### Parameters

• ##### out: IArray

the receiving quaternion

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### multiply

• Multiplies two quat's

#### Parameters

• ##### out: IArray

the receiving quaternion

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### normalize

• Normalize a quat

function

#### Parameters

• ##### out: IArray

the receiving quaternion

• ##### a: IArray

quaternion to normalize

out

### rotateX

• Rotates a quaternion by the given angle about the X axis

#### Parameters

• ##### out: IArray

quat receiving operation result

• ##### a: IArray

quat to rotate

• ##### rad: number

angle (in radians) to rotate

out

### rotateY

• Rotates a quaternion by the given angle about the Y axis

#### Parameters

• ##### out: IArray

quat receiving operation result

• ##### a: IArray

quat to rotate

• ##### rad: number

angle (in radians) to rotate

out

### rotateZ

• Rotates a quaternion by the given angle about the Z axis

#### Parameters

• ##### out: IArray

quat receiving operation result

• ##### a: IArray

quat to rotate

• ##### rad: number

angle (in radians) to rotate

out

### rotationTo

• Sets a quaternion to represent the shortest rotation from one vector to another.

Both vectors are assumed to be unit length.

#### Parameters

• ##### out: IArray

the receiving quaternion.

• ##### a: IArray

the initial vector

• ##### b: IArray

the destination vector

out

### scale

• Scales a quat by a scalar number

function

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the vector to scale

• ##### b: number

amount to scale the vector by

out

### set

• set(out: IArray, x: number, y: number, z: number, w: number): IArray
• Set the components of a quat to the given values

function

#### Parameters

• ##### out: IArray

the receiving quaternion

• ##### x: number

X component

• ##### y: number

Y component

• ##### z: number

Z component

• ##### w: number

W component

out

### setAxes

• Sets the specified quaternion with values corresponding to the given axes. Each axis is a vec3 and is expected to be unit length and perpendicular to all other specified axes.

#### Parameters

• ##### view: IArray

the vector representing the viewing direction

• ##### right: IArray

the vector representing the local "right" direction

• ##### up: IArray

the vector representing the local "up" direction

out

### setAxisAngle

• Sets a quat from the given angle and rotation axis, then returns it.

#### Parameters

• ##### out: IArray

the receiving quaternion

• ##### axis: IArray

the axis around which to rotate

• ##### rad: number

the angle in radians

out

### slerp

• Performs a spherical linear interpolation between two quat

#### Parameters

• ##### out: IArray

the receiving quaternion

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

• ##### t: number

interpolation amount between the two inputs

out

### sqrLen

• Calculates the squared length of a quat

function

#### Parameters

• ##### a: IArray

vector to calculate squared length of

#### Returns number

squared length of a

### squaredLength

• squaredLength(a: IArray): number
• Calculates the squared length of a quat

function

#### Parameters

• ##### a: IArray

vector to calculate squared length of

#### Returns number

squared length of a

### str

• Returns a string representation of a quatenion

#### Returns string

string representation of the vector

Generated using TypeDoc