Quaternion
Overview
Quaternion is a class in Aspose.3D FOSS for TypeScript.
Quaternion.slerp(t, v1, v2) returns a new Quaternion representing spherical linear interpolation between two orientations at interpolation factor t.
This class declares 20 methods for Quaternion objects in TypeScript programs.
Available methods include: IDENTITY, concat, conjugate, constructor, dot, equals, eulerAngles, fromAngleAxis, fromEulerAngle, fromRotation, interpolate, inverse, and 4 additional methods.
Public members are accessible to any TypeScript application after installing the Aspose.3D FOSS for TypeScript package.
Properties: length, w, x, y, z.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
w | number | Read/Write | Gets the w. |
x | number | Read/Write | Gets the x. |
y | number | Read/Write | Gets the y. |
z | number | Read/Write | Gets the z. |
length | number | Read | Gets the length. |
Methods
| Signature | Description |
|---|---|
constructor() | Initializes a quaternion with the given w, x, y, and z components |
constructor(w: number, x: number, y: number, z: number) | Calls constructor(w, x, y, z) on this Quaternion instance. |
constructor(w: number, x: number, y: number, z: number) | Calls constructor(w, x, y, z) on this Quaternion instance. |
IDENTITY() → Quaternion | Returns the identity quaternion representing no rotation |
normalize() → Quaternion | Returns a unit‑length version of this quaternion |
conjugate() → Quaternion | Returns the conjugate of the quaternion |
inverse() → Quaternion | Returns the multiplicative inverse of the quaternion |
dot(q: Quaternion) → number | Computes the dot product with another quaternion |
concat(rhs: Quaternion) → Quaternion | Returns the concatenation (multiplication) of this quaternion with another |
eulerAngles() → Vector3 | Returns a Vector3 of Euler angles representing the rotation |
fromEulerAngle(pitch: number, yaw: number, roll: number) → Quaternion | Overload accepts a Vector3 or numeric pitch with yaw and roll |
fromEulerAngle(vec: Vector3) → Quaternion | Calls fromEulerAngle(vec) on this Quaternion instance. |
fromEulerAngle(pitch: Vector3 | number, yaw: number, roll: number) → Quaternion | Calls fromEulerAngle(pitch, yaw, roll) on this Quaternion instance. |
fromAngleAxis(a: number, axis: Vector3) → Quaternion | Creates a quaternion from a rotation angle and axis vector |
fromRotation(orig: Vector3, dest: Vector3) → Quaternion | Builds a quaternion that rotates from one direction vector to another |
interpolate(t: number, fromQ: Quaternion, toQ: Quaternion) → Quaternion | Linearly interpolates between two quaternions using parameter t |
slerp(t: number, v1: Quaternion, v2: Quaternion) → Quaternion | Returns a new Quaternion representing spherical linear interpolation between two orientations at interpolation factor t |
toString() → string | Returns a string representation of the quaternion components |
equals(other: Quaternion) → boolean | Checks whether another quaternion has identical component values |
toMatrix() → Matrix4 | Converts the quaternion into a 4×4 rotation matrix |