Creates a new MutableQuaternionD instance.
The typed array containing the quaternion components
Protected_Internal typed array storage for quaternion components [x, y, z, w].
Protected Static Readonly_The typed array constructor used for newly created quaternions.
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
StaticcompositionGets 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
Gets the component at the specified index.
The index (0=x, 1=y, 2=z, 3=w)
The component value at the given index
Sets this quaternion from an axis and angle.
If the axis is degenerate (zero length), this quaternion is set to the
identity quaternion instead of being filled with Infinity/NaN.
Use MutableQuaternion.tryAxisAngle when the caller needs to detect the failure.
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
Converts the quaternion to a flat array representation.
An array containing [x, y, z, w] components
Sets this quaternion from a 4x4 transformation matrix. Extracts the rotation component from the matrix, ignoring scale and translation.
If the rotation cannot be extracted, this quaternion is set to the identity
quaternion instead of being filled with Infinity/NaN.
Use MutableQuaternion.tryFromMatrix when the caller needs to detect the failure.
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
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 a dummy (uninitialized) quaternion.
True if the internal array has zero length, false otherwise
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
Calculates the magnitude (length) of the quaternion.
The Euclidean norm of the quaternion
Calculates the squared magnitude of the quaternion. This is more efficient than length() when you only need to compare magnitudes.
The squared Euclidean norm of the quaternion
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
Gets the raw Float32Array containing the quaternion components.
The underlying Float32Array [x, y, z, w]
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. The rotation order is XYZ (roll, pitch, yaw).
A new Vector3 containing the Euler angles in radians
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
Converts the quaternion to a string representation.
A string in the format "(x, y, z, w)"
Converts the quaternion to an approximately formatted string using financial precision.
A formatted string with components separated by spaces and ending with newline
Transforms a 3D vector by the inverse of this quaternion rotation.
The vector to transform
A new transformed vector
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
Attempts to set this quaternion from an axis and angle.
The quaternion is left unchanged when the axis is degenerate (zero length or non-finite).
The rotation axis (will be normalized)
The rotation angle in radians
True if the quaternion could be set, false otherwise
Attempts to set this quaternion from a 4x4 transformation matrix. Extracts the rotation component from the matrix, ignoring scale and translation.
The quaternion is left unchanged when the rotation cannot be extracted.
The 4x4 transformation matrix
True if the rotation could be extracted, false otherwise
StaticaddStaticaddAdds 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
StaticaxisStaticclampClamps 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
StaticdivideStaticdivideDivides a quaternion by a scalar and stores the result in the output parameter.
If the divisor is zero, all components are set to 0 and an error is logged
instead of producing Infinity/NaN.
The quaternion to divide
The scalar value to divide by
The output quaternion to store the result
The output quaternion containing the divided result
Staticdummydummy
StaticfromCreates a quaternion from an axis-angle representation.
The rotation axis vector
The rotation angle in radians
A new quaternion representing the rotation
StaticfromCreates 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
StaticfromStaticfromStaticfromStaticfromStaticfromStaticfromStaticfromCreates a mutable quaternion that directly uses the given Float64Array (no copy).
StaticfromStaticfromCreates a quaternion from a 4x4 rotation matrix and stores it in the output parameter.
If the rotation cannot be extracted, the output quaternion is set to the
identity quaternion instead of being filled with Infinity/NaN.
Use Quaternion.tryFromMatrixTo when the caller needs to detect the failure.
The 4x4 matrix containing rotation information
The output quaternion to store the result
The output quaternion containing the extracted rotation, or the identity quaternion if the rotation cannot be extracted
StaticfromStaticfromCreates a quaternion representing the rotation from one vector to another (static version).
A normalized quaternion representing the rotation
StaticfromCreates 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
StaticfromCreates a quaternion that directly uses the given typed array (no copy).
The typed array containing quaternion components
A new quaternion using the provided array
StaticgetGets the rotation angle (0 to π) represented by a quaternion.
The quaternion to analyze (assumed to be normalized)
The rotation angle in radians
Staticidentityidentity
StaticinvertStaticinvertComputes 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
StaticlerpStaticlerpPerforms 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
StaticlookCreates a quaternion that looks in the specified forward direction using default up vector (0, 1, 0).
If the direction is degenerate (zero length), an identity quaternion is
returned instead of a quaternion filled with Infinity/NaN.
Use Quaternion.tryLookForward when the caller needs to detect the failure.
The forward direction vector
A quaternion representing the look rotation, or the identity quaternion if the direction is degenerate
StaticlookCreates a quaternion that looks in the specified forward direction with a custom up vector.
If the directions are degenerate (zero length, or forward parallel to up),
an identity quaternion is returned instead of a quaternion filled with
Infinity/NaN.
Use Quaternion.tryLookForwardAccordingToThisUp when the caller needs
to detect the failure.
A quaternion representing the look rotation with the specified up vector, or the identity quaternion if the directions are degenerate
StaticlookCreates a quaternion that rotates from one direction to another.
A quaternion representing the rotation from fromDirection to toDirection
StaticmultiplyStaticmultiplyStaticmultiplyMultiplies 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
StaticmultiplyMultiplies 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
StaticnormalizeNormalizes a quaternion to unit length.
A zero-length quaternion is normalized to the identity quaternion (an error
is logged) instead of becoming Infinity/NaN.
The quaternion to normalize
A new normalized quaternion
StaticnormalizeNormalizes 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
StaticqlerpStaticqlerpPerforms 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
StaticsubtractStaticsubtractSubtracts 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
StatictryStatictryStatictryAttempts to create a quaternion from a 4x4 rotation matrix and stores it in the output parameter. The output quaternion is left untouched when the rotation cannot be extracted.
The 4x4 matrix containing rotation information
The output quaternion to store the result
True if the quaternion could be extracted, false otherwise
StatictryAttempts to create 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, or null if the direction is degenerate
StatictryAttempts to create a quaternion that looks in the specified forward direction with a custom up vector.
Returns null when either direction has zero length or when the forward and up directions are parallel, because the rotation basis cannot be built.
A quaternion representing the look rotation, or null
Mutable quaternion with 64-bit float components.