Quaternion
Overview
Quaternion is a class in Aspose.3D FOSS for Typescript.
Quaternion.constructor creates a quaternion with default component values.
This class provides 16 methods for working with Quaternion objects in Typescript programs.
Available methods include: IDENTITY, concat, conjugate, constructor, dot, equals, eulerAngles, fromAngleAxis, fromEulerAngle, fromRotation, interpolate, inverse, and 4 additional methods.
All 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) | |
constructor(w: number, x: number, y: number, z: number) | |
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 | |
fromEulerAngle(pitch: Vector3 | number, yaw: number, roll: number) → Quaternion | |
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 | Performs spherical linear interpolation between two quaternions at 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 |