Optionalx: numberOptionaly: numberOptionalz: numberOptionalw: numberProtected_wProtected_xProtected_yProtected_zStatic ReadonlyidentityQuaternion representing no rotation.
Static ReadonlyzeroQuaternion with all zero elements.
Returns a copy of this Quaternion added by the given one.
Copies all properties defined by the prototype of Quaternion from other to this instance.
Clones this instance and returns a new Quaternion with identical values.
Returns a copy of the current Quaternion divided by the factor.
Add the given Quaternion to this one and returns it.
Clears all elements of the Quaternion to zero.
Divides this Quaternion by the given factor and returns it.
Calculates the inverse of the quaternion. Inverse quaternion has the opposite rotation of the original.
Multiplies this Quaternion and returns it.
Multiply this Quaternion by the given factor and returns it.
Returns the negation of the given quaternion.
Subtract this Quaternion with the given one and returns it.
Calculates a dot product between two quaternions.
Second quaternion.
Dot product between the two quaternions.
Evaluates the expression and assigns it to the quaternion.
The expression to evaluate.
A reference to this vector
MathEx.eval for detailed documentation, limitations and considerations.
Returns a copy of the inverse of the quaternion. Quaternion must be non-zero. Inverse quaternion has the opposite rotation of the original.
Returns whether the provided quaternion, given a error margin, contains the same values as this one.
The other quaternion to compare
Optionalepsilon: numberOptional. Error margin within which the numbers should be considered equal.
True if equal, false otherwise.
Returns whether this quaternion is equal to given one.
Returns a copy of the current Quaternion multiplied by the given Quaternion.
Returns a copy of the current Quaternion multiplied by the factor.
Returns a normalized copy of the quaternion.
Returns a copy of this Quaternion subtracted by the given one.
StaticaddAdds two Quaternions together.
StaticangleCalculates an angle between two rotations.
First rotation.
Second rotation.
Angle between the rotations, in degrees.
StaticdivideDivides the Quaternion with the given factor.
StaticdotCalculates a dot product between two quaternions.
First quaternion.
Second quaternion.
Dot product between the two quaternions.
StaticfromInitializes the quaternion from orthonormal set of axes.
Quaternion that represents a rotation from base axes to the specified set of axes.
StaticfromCreates a quaternion from axis/angle rotation.
Quaternion that rotates an object around the specified axis for the specified amount.
StaticfromCreates a quaternion from the provided euler angle (pitch/yaw/roll) rotation.
Quaternion that can rotate an object to the specified angles.
StaticfromCreates a quaternion from the provided euler angle (pitch/yaw/roll) rotation.
Euler angles in degrees.
Optionalorder: EnumValue<EulerAngleOrder, number>The order in which rotations will be applied. Different rotations can be created depending on the order.
Quaternion that can rotate an object to the specified angles.
StaticfromCreates a quaternion from a rotation matrix.
Newly created quaternion that has equivalent rotation as the provided rotation matrix.
StaticfromCreates a quaternion with rotation that rotates from one direction to another.
Quaternion that rotates an object from fromDirection to
toDirection
StaticinvertReturns the inverse of the quaternion. Inverse quaternion has the opposite rotation of the original.
Quaternion to calculate the inverse for.
Inverse of the provided quaternion.
StaticisDetermines whether both Quaternions are equal within an error margin.
First quaternion to compare.
Second quaternion to compare.
Optionalepsilon: numberOptional. Error margin within which the numbers should be considered equal.
True if equal, false otherwise.
StaticisDetermines whether both Quaternions are equal.
StaticlookCreates a quaternion that orients an object so it faces in the provided direction.
StaticmultiplyMultiply one quaternion by another.
StaticmultiplyMultiplies the Quaternion with the given factor.
StaticnegateReturns the negation of the given quaternion.
StaticslerpPerforms a spherical interpolation between two quaternions.
Start quaternion.
End quaternion.
Interpolation factor in range [0...1] that determines how much to interpolate between from and to.
OptionalshortestPath: booleantrue to take the shortest or longest path. Default: true.
Interpolated quaternion representing a rotation between from and to.
StaticslerpPerforms a spherical interpolation between two quaternions using a maximumAngle constraint.
Start quaternion.
End quaternion.
The maximum permitted angle between the two quaternions.
Interpolated quaternion representing a rotation between from and to.
StaticsubtractSubtract both Quaternions.
StaticwithCreates a quaternion with rotation that rotates from one direction to another.
Quaternion that rotates an object from fromDirection to toDirection
StaticwithCreates a quaternion that orients an object so it faces in the provided direction.
The Quaternion is used to represent orientations and rotations. The class follows the 'copy-on-write' pattern, which means that every operation returns a copy of the quaternion with updated values. It also implies that the values of the quaternion cannot be directly modified.
The concept of immutability improves sharing of objects as all types in TypeScript are assigned by identity, instead of by-value (e.g. a copy) as in other programming languages like C.