Quaternion

Overview

Quaternion is a class in Aspose.3d for Typescript. Inherits from: Quaternion.

Quaternion.constructor creates a quaternion with default components (0,0,0,0).

Properties

NameTypeAccessDescription
wnumberReadIs the scalar component of the quaternion
xnumberReadIs the first vector component of the quaternion
ynumberReadIs the second vector component of the quaternion
znumberReadIs the third vector component of the quaternion
lengthnumberReadReturns the magnitude of the quaternion

Methods

SignatureDescription
constructor()Initializes a quaternion with the given w, x, y, and z components
constructor(w: number, x: number, y: number, z: number)
constructor(w: number, x: number, y: number, z: number)
IDENTITY()QuaternionReturns a quaternion representing no rotation (identity quaternion)
normalize()QuaternionReturns a unit-length quaternion equivalent to the original
conjugate()QuaternionReturns the conjugate of the quaternion, negating the vector part
inverse()QuaternionReturns the multiplicative inverse of the quaternion
dot(q: Quaternion)numberComputes the dot product between this quaternion and another
concat(rhs: Quaternion)QuaternionMultiplies this quaternion by another (rhs) and returns the result
eulerAngles()Vector3Converts the quaternion to Euler angles and returns them as a Vector3
fromEulerAngle(pitch: number, yaw: number, roll: number)QuaternionOverload creates a quaternion from either a Vector3 or separate pitch, yaw, roll numbers
fromEulerAngle(vec: Vector3)Quaternion
fromEulerAngle(pitch: Vector3 | number, yaw: number, roll: number)Quaternion
fromAngleAxis(a: number, axis: Vector3)QuaternionBuilds a quaternion representing rotation of angle a around the given axis
fromRotation(orig: Vector3, dest: Vector3)QuaternionCreates a quaternion that rotates vector orig to align with dest
interpolate(t: number, fromQ: Quaternion, toQ: Quaternion)QuaternionLinearly interpolates between fromQ and toQ by factor t
slerp(t: number, v1: Quaternion, v2: Quaternion)QuaternionPerforms spherical linear interpolation between v1 and v2 by factor t
toString()stringReturns a string representation of the quaternion components
equals(other: Quaternion)booleanChecks whether another quaternion has the same component values
toMatrix()Matrix4Converts the quaternion into a 4x4 rotation matrix