Class Index | File Index

Classes


Class quat

Quaternion
Defined in: quat.js.

Methods

quat.add(out, a, b)
Adds two quat's
quat.calculateW(out, a)
Calculates the W component of a quat from the X, Y, and Z components.
quat.clone(a)
Creates a new quat initialized with values from an existing quaternion
quat.conjugate(out, a)
Calculates the conjugate of a quat If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
quat.copy(out, a)
Copy the values from one quat to another
quat.create()
Creates a new identity quat
quat.dot(a, b)
Calculates the dot product of two quat's
quat.fromValues(x, y, z, w)
Creates a new quat initialized with the given values
quat.identity(out)
Set a quat to the identity quaternion
quat.invert(out, a)
Calculates the inverse of a quat
quat.len()
Alias for quat.length
quat.length(a)
Calculates the length of a quat
quat.lerp(out, a, b, t)
Performs a linear interpolation between two quat's
quat.mul()
Alias for quat.multiply
quat.multiply(out, a, b)
Multiplies two quat's
quat.normalize(out, a)
Normalize a quat
quat.rotateX(out, a, rad)
Rotates a quaternion by the given angle around the X axis
quat.rotateY(out, a, rad)
Rotates a quaternion by the given angle around the Y axis
quat.rotateZ(out, a, rad)
Rotates a quaternion by the given angle around the Z axis
quat.scale(out, a, b)
Scales a quat by a scalar number
quat.set(out, x, y, z, w)
Set the components of a quat to the given values
quat.setAxisAngle(out, axis, rad)
Sets a quat from the given angle and rotation axis, then returns it.
quat.slerp(out, a, b, t)
Performs a spherical linear interpolation between two quat
quat.sqrLen()
quat.squaredLength(a)
Calculates the squared length of a quat
quat.str(vec)
Returns a string representation of a quatenion

Method Detail

{quat} quat.add(out, a, b)

Adds two quat's

Parameters:
{quat} out
the receiving quaternion
{quat} a
the first operand
{quat} b
the second operand
Returns:
{quat} out

{quat} quat.calculateW(out, a)

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:
{quat} out
the receiving quaternion
{quat} a
quat to calculate W component of
Returns:
{quat} out

{quat} quat.clone(a)

Creates a new quat initialized with values from an existing quaternion

Parameters:
{quat} a
quaternion to clone
Returns:
{quat} a new quaternion

{quat} quat.conjugate(out, a)

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

Parameters:
{quat} out
the receiving quaternion
{quat} a
quat to calculate conjugate of
Returns:
{quat} out

{quat} quat.copy(out, a)

Copy the values from one quat to another

Parameters:
{quat} out
the receiving quaternion
{quat} a
the source quaternion
Returns:
{quat} out

{quat} quat.create()

Creates a new identity quat

Returns:
{quat} a new quaternion

{Number} quat.dot(a, b)

Calculates the dot product of two quat's

Parameters:
{quat} a
the first operand
{quat} b
the second operand
Returns:
{Number} dot product of a and b

{quat} quat.fromValues(x, y, z, w)

Creates a new quat initialized with the given values

Parameters:
{Number} x
X component
{Number} y
Y component
{Number} z
Z component
{Number} w
W component
Returns:
{quat} a new quaternion

{quat} quat.identity(out)

Set a quat to the identity quaternion

Parameters:
{quat} out
the receiving quaternion
Returns:
{quat} out

{quat} quat.invert(out, a)

Calculates the inverse of a quat

Parameters:
{quat} out
the receiving quaternion
{quat} a
quat to calculate inverse of
Returns:
{quat} out

quat.len()

Alias for quat.length


{Number} quat.length(a)

Calculates the length of a quat

Parameters:
{quat} a
vector to calculate length of
Returns:
{Number} length of a

{quat} quat.lerp(out, a, b, t)

Performs a linear interpolation between two quat's

Parameters:
{quat} out
the receiving quaternion
{quat} a
the first operand
{quat} b
the second operand
{Number} t
interpolation amount between the two inputs
Returns:
{quat} out

quat.mul()

Alias for quat.multiply


{quat} quat.multiply(out, a, b)

Multiplies two quat's

Parameters:
{quat} out
the receiving quaternion
{quat} a
the first operand
{quat} b
the second operand
Returns:
{quat} out

{quat} quat.normalize(out, a)

Normalize a quat

Parameters:
{quat} out
the receiving quaternion
{quat} a
quaternion to normalize
Returns:
{quat} out

{quat} quat.rotateX(out, a, rad)

Rotates a quaternion by the given angle around the X axis

Parameters:
{quat} out
quat receiving operation result
{quat} a
quat to rotate
{number} rad
angle (in radians) to rotate
Returns:
{quat} out

{quat} quat.rotateY(out, a, rad)

Rotates a quaternion by the given angle around the Y axis

Parameters:
{quat} out
quat receiving operation result
{quat} a
quat to rotate
{number} rad
angle (in radians) to rotate
Returns:
{quat} out

{quat} quat.rotateZ(out, a, rad)

Rotates a quaternion by the given angle around the Z axis

Parameters:
{quat} out
quat receiving operation result
{quat} a
quat to rotate
{number} rad
angle (in radians) to rotate
Returns:
{quat} out

{quat} quat.scale(out, a, b)

Scales a quat by a scalar number

Parameters:
{quat} out
the receiving vector
{quat} a
the vector to scale
{Number} b
amount to scale the vector by
Returns:
{quat} out

{quat} quat.set(out, x, y, z, w)

Set the components of a quat to the given values

Parameters:
{quat} out
the receiving quaternion
{Number} x
X component
{Number} y
Y component
{Number} z
Z component
{Number} w
W component
Returns:
{quat} out

{quat} quat.setAxisAngle(out, axis, rad)

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

Parameters:
{quat} out
the receiving quaternion
{vec3} axis
the axis around which to rotate
{Number} rad
the angle in radians
Returns:
{quat} out

{quat} quat.slerp(out, a, b, t)

Performs a spherical linear interpolation between two quat

Parameters:
{quat} out
the receiving quaternion
{quat} a
the first operand
{quat} b
the second operand
{Number} t
interpolation amount between the two inputs
Returns:
{quat} out

quat.sqrLen()

Alias for quat.squaredLength


{Number} quat.squaredLength(a)

Calculates the squared length of a quat

Parameters:
{quat} a
vector to calculate squared length of
Returns:
{Number} squared length of a

{String} quat.str(vec)

Returns a string representation of a quatenion

Parameters:
{quat} vec
vector to represent as a string
Returns:
{String} string representation of the vector