Creates a new MutableQuaternion instance.
Float32Array containing the quaternion components [x, y, z, w]
Protected
_vInternal typed array storage for quaternion components [x, y, z, w].
Gets the class name for identification purposes.
The string 'MutableQuaternion'
Gets the w component of the quaternion.
The w component value
Sets the w component of the quaternion.
The w component value
Gets the x component of the quaternion.
The x component value
Sets the x component of the quaternion.
The x component value
Gets the y component of the quaternion.
The y component value
Sets the y component of the quaternion.
The y component value
Gets the z component of the quaternion.
The z component value
Sets the z component of the quaternion.
The z component value
Static
compositionGets the composition type for this quaternion class.
CompositionType.Vec4 indicating this is a 4-component vector
Adds another quaternion to this quaternion component-wise.
The quaternion to add
This instance for method chaining
Sets this quaternion from an axis and angle.
The rotation axis (will be normalized)
The rotation angle in radians
This instance for method chaining
Creates a copy of this quaternion.
A new IMutableQuaternion with the same component values
Copies components from another quaternion.
The quaternion to copy from
This instance for method chaining
Divides this quaternion by a scalar value.
The scalar value to divide by (must not be zero)
This instance for method chaining
Calculates the dot product between this quaternion and another quaternion. The dot product of two quaternions gives a scalar value that represents the cosine of half the angle between them when both quaternions are unit quaternions.
The quaternion to compute the dot product with
The dot product result
Sets this quaternion from a 4x4 transformation matrix. Extracts the rotation component from the matrix, ignoring scale and translation.
The 4x4 transformation matrix
This instance for method chaining
Sets this quaternion from a position vector (w component set to 0).
The position vector
This instance for method chaining
Creates a quaternion representing the rotation from one vector to another. This is an instance method version of the static fromToRotation.
The normalized quaternion representing the rotation
Sets this quaternion to the identity quaternion (0, 0, 0, 1).
This instance for method chaining
Inverts this quaternion in place (conjugate divided by magnitude squared).
This instance for method chaining
Checks if this quaternion is approximately equal to another quaternion within a tolerance.
The quaternion to compare with
The tolerance value (default: Number.EPSILON)
True if all components are within the tolerance, false otherwise
Checks if this quaternion is exactly equal to another quaternion.
The quaternion to compare with
True if all components are exactly equal, false otherwise
Performs linear interpolation and stores the result in this quaternion.
The starting quaternion
The ending quaternion
Interpolation factor (0.0 to 1.0)
This instance for method chaining
Multiplies this quaternion by another quaternion (quaternion composition). The result represents the combined rotation.
The quaternion to multiply by
This instance for method chaining
Multiplies this quaternion by a scalar value.
The scalar value to multiply by
This instance for method chaining
Normalizes this quaternion to unit length in place.
This instance for method chaining
Performs spherical linear interpolation (SLERP) and stores the result in this quaternion.
The starting quaternion
The ending quaternion
Interpolation factor (0.0 to 1.0)
This instance for method chaining
Sets a component value at the specified index.
The component index (0=x, 1=y, 2=z, 3=w)
The value to set
This instance for method chaining
Sets all quaternion components.
The x component
The y component
The z component
The w component
This instance for method chaining
Subtracts another quaternion from this quaternion component-wise.
The quaternion to subtract
This instance for method chaining
Converts the quaternion to Euler angles and stores the result in the output vector. The rotation order is XYZ (roll, pitch, yaw).
The output vector to store the Euler angles [x, y, z]
The output vector containing the Euler angles in radians
Transforms a 3D vector by this quaternion rotation and stores the result in the output parameter.
The vector to transform
The output vector to store the result
The output vector containing the transformed result
Static
addAdds two quaternions component-wise.
The left quaternion
The right quaternion
A new MutableQuaternion representing the sum
Static
addAdds two quaternions component-wise and stores the result in the output parameter.
The left quaternion
The right quaternion
The output quaternion to store the result
The output quaternion containing the sum
Static
axisCreates a quaternion from an axis and angle.
The rotation axis (normalized vector recommended)
The rotation angle in radians
A new MutableQuaternion representing the axis-angle rotation
Static
clampClamps the rotation angle of a quaternion to a maximum value. If the quaternion's rotation angle exceeds thetaMax, it scales the rotation down.
The quaternion to clamp
The maximum allowed rotation angle in radians
A quaternion with rotation angle clamped to thetaMax
Static
divideDivides a quaternion by a scalar value.
The quaternion to divide
The scalar value (must not be zero)
A new MutableQuaternion representing the scaled quaternion
Static
divideDivides a quaternion by a scalar and stores the result in the output parameter.
The quaternion to divide
The scalar value to divide by (must not be zero)
The output quaternion to store the result
The output quaternion containing the divided result
Static
dummyCreates a dummy quaternion with empty array (for initialization purposes).
A new MutableQuaternion with zero-length array
Static
fromCreates a quaternion from an axis-angle representation.
The rotation axis vector
The rotation angle in radians
A new quaternion representing the rotation
Static
fromCreates a quaternion from an axis-angle representation and stores it in the output parameter.
The rotation axis vector
The rotation angle in radians
The output quaternion to store the result
The output quaternion containing the rotation
Static
fromCreates a MutableQuaternion from individual component values.
The x component
The y component
The z component
The w component
A new MutableQuaternion instance
Static
fromCreates a MutableQuaternion by copying from an array (takes first 4 elements).
Array containing quaternion components
A new MutableQuaternion instance
Static
fromCreates a MutableQuaternion by copying from a 4-element array.
Array containing [x, y, z, w] components
A new MutableQuaternion instance
Static
fromCreates a MutableQuaternion from a logarithmic quaternion. Converts from log space back to quaternion space using exponential map.
The logarithmic quaternion to convert
A new MutableQuaternion instance
Static
fromCreates a MutableQuaternion by copying from another quaternion.
The quaternion to copy from
A new MutableQuaternion instance
Static
fromCreates a MutableQuaternion by copying from a 4D vector.
The 4D vector to copy from
A new MutableQuaternion instance
Static
fromCreates a MutableQuaternion from an existing Float32Array.
The Float32Array containing quaternion components
A new MutableQuaternion instance
Static
fromCreates a quaternion from a rotation matrix.
The 4x4 transformation matrix
A new MutableQuaternion representing the matrix's rotation
Static
fromCreates a quaternion from a 4x4 rotation matrix and stores it in the output parameter.
The 4x4 matrix containing rotation information
The output quaternion to store the result
The output quaternion containing the extracted rotation
Static
fromCreates a quaternion from a position vector (w component set to 0).
The position vector
A new MutableQuaternion with position data
Static
fromCreates a quaternion representing the rotation from one vector to another (static version).
A normalized quaternion representing the rotation
Static
fromCreates a quaternion representing the rotation from one vector to another and stores it in the output parameter.
The starting direction vector
The target direction vector
The output quaternion to store the result
The output quaternion containing the normalized rotation
Static
getGets the rotation angle (0 to π) represented by a quaternion.
The quaternion to analyze (assumed to be normalized)
The rotation angle in radians
Static
identityCreates an identity quaternion (0, 0, 0, 1).
A new MutableQuaternion representing no rotation
Static
invertInverts a quaternion and returns a new MutableQuaternion.
The quaternion to invert
A new MutableQuaternion representing the inverse rotation
Static
invertComputes the inverse of a quaternion and stores the result in the output parameter.
The quaternion to invert
The output quaternion to store the result
The output quaternion containing the inverted result
Static
lerpPerforms linear interpolation between two quaternions.
The starting quaternion
The ending quaternion
Interpolation factor (0.0 to 1.0)
A new MutableQuaternion representing the interpolated rotation
Static
lerpPerforms linear interpolation (LERP) and stores the result in the output parameter.
The starting quaternion
The ending quaternion
The interpolation parameter (0.0 = l_quat, 1.0 = r_quat)
The output quaternion to store the result
The output quaternion containing the interpolated result
Static
lookCreates a quaternion that looks in the specified forward direction using default up vector (0, 1, 0).
The forward direction vector
A quaternion representing the look rotation
Static
lookCreates a quaternion that looks in the specified forward direction with a custom up vector.
A quaternion representing the look rotation with the specified up vector
Static
lookCreates a quaternion that rotates from one direction to another.
A quaternion representing the rotation from fromDirection to toDirection
Static
multiplyMultiplies two quaternions (quaternion composition).
The left quaternion
The right quaternion
A new MutableQuaternion representing the composed rotation
Static
multiplyMultiplies a quaternion by a scalar value.
The quaternion to multiply
The scalar value
A new MutableQuaternion representing the scaled quaternion
Static
multiplyMultiplies a quaternion by a scalar and stores the result in the output parameter.
The quaternion to multiply
The scalar value to multiply by
The output quaternion to store the result
The output quaternion containing the scaled result
Static
multiplyMultiplies two quaternions and stores the result in the output parameter.
The left quaternion
The right quaternion
The output quaternion to store the result
The output quaternion containing the product
Static
normalizeNormalizes a quaternion to unit length.
The quaternion to normalize
A new normalized quaternion
Static
normalizeNormalizes a quaternion to unit length and stores the result in the output parameter.
The quaternion to normalize
The output quaternion to store the result
The output quaternion containing the normalized result
Static
qlerpPerforms spherical linear interpolation (SLERP) between two quaternions.
The starting quaternion
The ending quaternion
Interpolation factor (0.0 to 1.0)
A new MutableQuaternion representing the interpolated rotation
Static
qlerpPerforms spherical linear interpolation (SLERP) and stores the result in the output parameter.
The starting quaternion
The ending quaternion
The interpolation parameter (0.0 = l_quat, 1.0 = r_quat)
The output quaternion to store the result
The output quaternion containing the interpolated result
Static
subtractSubtracts the second quaternion from the first component-wise.
The left quaternion
The right quaternion
A new MutableQuaternion representing the difference
Static
subtractSubtracts two quaternions component-wise and stores the result in the output parameter.
The left quaternion
The right quaternion
The output quaternion to store the result
The output quaternion containing the difference
A mutable quaternion class that extends the immutable Quaternion class. Provides methods for quaternion operations that modify the instance in place. Quaternions are used to represent rotations in 3D space and are particularly useful for avoiding gimbal lock and providing smooth interpolations.