Class quat4
Quaternion
Defined in: glMatrix.js.
Constructor Attributes | Constructor Name and Description |
---|---|
quat4()
|
Method Attributes | Method Name and Description |
---|---|
<static> |
quat4.add(quat, quat2, dest)
Performs quaternion addition
|
<static> |
quat4.calculateW(quat, dest)
Calculates the W component of a quat4 from the X, Y, and Z components.
|
<static> |
quat4.conjugate(quat, dest)
Calculates the conjugate of a quat4
If the quaternion is normalized, this function is faster than quat4.inverse and produces the same result.
|
<static> |
quat4.create(quat)
Creates a new instance of a quat4 using the default array type
Any javascript array containing at least 4 numeric elements can serve as a quat4
|
<static> |
quat4.createFrom(x, y, z, w)
Creates a new instance of a quat4, initializing it with the given arguments
|
<static> |
quat4.dot(quat, quat2)
Calculates the dot product of two quaternions
|
<static> |
quat4.equal(a, b)
Compares two quaternions for equality within a certain margin of error
|
<static> |
quat4.fromAngleAxis(angle, axis, dest)
Sets a quat4 from the given angle and rotation axis,
then returns it.
|
<static> |
quat4.fromRotationMatrix(mat, dest)
Creates a quaternion from the given 3x3 rotation matrix.
|
<static> |
quat4.identity(dest)
Creates a new identity Quat4
|
<static> |
quat4.inverse(quat, dest)
Calculates the inverse of a quat4
|
<static> |
quat4.length(quat)
Calculates the length of a quat4
Params:
|
<static> |
quat4.multiply(quat, quat2, dest)
Performs a quaternion multiplication
|
<static> |
quat4.multiplyVec3(quat, vec, dest)
Transforms a vec3 with the given quaternion
|
<static> |
quat4.normalize(quat, dest)
Generates a unit quaternion of the same direction as the provided quat4
If quaternion length is 0, returns [0, 0, 0, 0]
|
<static> |
quat4.scale(quat, val, dest)
Multiplies the components of a quaternion by a scalar value
|
<static> |
quat4.set(quat, dest)
Copies the values of one quat4 to another
|
<static> |
quat4.slerp(quat, quat2, slerp, dest)
Performs a spherical linear interpolation between two quat4
|
<static> |
quat4.str(quat)
Returns a string representation of a quaternion
|
<static> |
quat4.toAngleAxis(quat, dest)
Stores the angle and axis in a vec4, where the XYZ components represent
the axis and the W (4th) component is the angle in radians.
|
<static> |
quat4.toMat4(quat, dest)
Calculates a 4x4 matrix from the given quat4
|
Method Detail
<static>
{quat4}
quat4.add(quat, quat2, dest)
Performs quaternion addition
- Parameters:
- {quat4} quat
- First operand
- {quat4} quat2
- Second operand
- {quat4} dest Optional
- quat4 receiving operation result. If not specified result is written to quat
- Returns:
- {quat4} dest if specified, quat otherwise
<static>
{quat4}
quat4.calculateW(quat, dest)
Calculates the W component of a quat4 from the X, Y, and Z components.
Assumes that quaternion is 1 unit in length.
Any existing W component will be ignored.
- Parameters:
- {quat4} quat
- quat4 to calculate W component of
- {quat4} dest Optional
- quat4 receiving calculated values. If not specified result is written to quat
- Returns:
- {quat4} dest if specified, quat otherwise
<static>
{quat4}
quat4.conjugate(quat, dest)
Calculates the conjugate of a quat4
If the quaternion is normalized, this function is faster than quat4.inverse and produces the same result.
- Parameters:
- {quat4} quat
- quat4 to calculate conjugate of
- {quat4} dest Optional
- quat4 receiving conjugate values. If not specified result is written to quat
- Returns:
- {quat4} dest if specified, quat otherwise
<static>
{quat4}
quat4.create(quat)
Creates a new instance of a quat4 using the default array type
Any javascript array containing at least 4 numeric elements can serve as a quat4
- Parameters:
- {quat4} quat Optional
- quat4 containing values to initialize with
- Returns:
- {quat4} New quat4
<static>
{quat4}
quat4.createFrom(x, y, z, w)
Creates a new instance of a quat4, initializing it with the given arguments
- Parameters:
- {number} x
- X value
- {number} y
- Y value
- {number} z
- Z value
- {number} w
- W value
- Returns:
- {quat4} New quat4
<static>
{number}
quat4.dot(quat, quat2)
Calculates the dot product of two quaternions
- Returns:
- {number} Dot product of quat and quat2
<static>
{Boolean}
quat4.equal(a, b)
Compares two quaternions for equality within a certain margin of error
- Returns:
- {Boolean} True if a is equivalent to b
<static>
{quat4}
quat4.fromAngleAxis(angle, axis, dest)
Sets a quat4 from the given angle and rotation axis,
then returns it. If dest is not given, a new quat4 is created.
- Parameters:
- {Number} angle
- the angle in radians
- {vec3} axis
- the axis around which to rotate
- {quat4} dest Optional
- the optional quat4 to store the result
- Returns:
- {quat4} dest
<static>
{quat4}
quat4.fromRotationMatrix(mat, dest)
Creates a quaternion from the given 3x3 rotation matrix.
If dest is omitted, a new quaternion will be created.
- Parameters:
- {mat3} mat
- the rotation matrix
- {quat4} dest Optional
- an optional receiving quaternion
- Returns:
- {quat4} the quaternion constructed from the rotation matrix
<static>
{quat4}
quat4.identity(dest)
Creates a new identity Quat4
- Parameters:
- {quat4} dest Optional
- quat4 receiving copied values
- Returns:
- {quat4} dest is specified, new quat4 otherwise
<static>
{quat4}
quat4.inverse(quat, dest)
Calculates the inverse of a quat4
- Parameters:
- {quat4} quat
- quat4 to calculate inverse of
- {quat4} dest Optional
- quat4 receiving inverse values. If not specified result is written to quat
- Returns:
- {quat4} dest if specified, quat otherwise
<static>
quat4.length(quat)
Calculates the length of a quat4
Params:
- Parameters:
- {quat4} quat
- quat4 to calculate length of
- Returns:
- Length of quat
<static>
{quat4}
quat4.multiply(quat, quat2, dest)
Performs a quaternion multiplication
- Parameters:
- {quat4} quat
- First operand
- {quat4} quat2
- Second operand
- {quat4} dest Optional
- quat4 receiving operation result. If not specified result is written to quat
- Returns:
- {quat4} dest if specified, quat otherwise
<static>
quat4.multiplyVec3(quat, vec, dest)
Transforms a vec3 with the given quaternion
- Parameters:
- {quat4} quat
- quat4 to transform the vector with
- {vec3} vec
- vec3 to transform
- {vec3} dest Optional
- vec3 receiving operation result. If not specified result is written to vec
- Returns:
- dest if specified, vec otherwise
<static>
{quat4}
quat4.normalize(quat, dest)
Generates a unit quaternion of the same direction as the provided quat4
If quaternion length is 0, returns [0, 0, 0, 0]
- Parameters:
- {quat4} quat
- quat4 to normalize
- {quat4} dest Optional
- quat4 receiving operation result. If not specified result is written to quat
- Returns:
- {quat4} dest if specified, quat otherwise
<static>
{quat4}
quat4.scale(quat, val, dest)
Multiplies the components of a quaternion by a scalar value
- Parameters:
- {quat4} quat
- to scale
- {number} val
- Value to scale by
- {quat4} dest Optional
- quat4 receiving operation result. If not specified result is written to quat
- Returns:
- {quat4} dest if specified, quat otherwise
<static>
{quat4}
quat4.set(quat, dest)
Copies the values of one quat4 to another
- Returns:
- {quat4} dest
<static>
{quat4}
quat4.slerp(quat, quat2, slerp, dest)
Performs a spherical linear interpolation between two quat4
- Parameters:
- {quat4} quat
- First quaternion
- {quat4} quat2
- Second quaternion
- {number} slerp
- Interpolation amount between the two inputs
- {quat4} dest Optional
- quat4 receiving operation result. If not specified result is written to quat
- Returns:
- {quat4} dest if specified, quat otherwise
<static>
{string}
quat4.str(quat)
Returns a string representation of a quaternion
- Parameters:
- {quat4} quat
- quat4 to represent as a string
- Returns:
- {string} String representation of quat
<static>
{vec4}
quat4.toAngleAxis(quat, dest)
Stores the angle and axis in a vec4, where the XYZ components represent
the axis and the W (4th) component is the angle in radians.
If dest is not given, src will be modified in place and returned, after
which it should not be considered not a quaternion (just an axis and angle).
- Parameters:
- {quat4} quat
- the quaternion whose angle and axis to store
- {vec4} dest Optional
- the optional vec4 to receive the data
- Returns:
- {vec4} dest
<static>
{mat4}
quat4.toMat4(quat, dest)
Calculates a 4x4 matrix from the given quat4
- Parameters:
- {quat4} quat
- quat4 to create matrix from
- {mat4} dest Optional
- mat4 receiving operation result
- Returns:
- {mat4} dest if specified, a new mat4 otherwise