Quaternion
Overview
Quaternion is a class in Aspose.3D FOSS for Python.
Quaternion.get_IDENTITY returns the identity quaternion (no rotation).
This class provides 17 methods for working with Quaternion objects in Python programs.
Available methods include: __init__, concat, conjugate, dot, euler_angles, from_angle_axis, from_euler_angle, from_rotation, get_IDENTITY, get_bind_point, get_keyframe_sequence, interpolate, and 5 additional methods.
All exported members are accessible to any Python application after installing the Aspose.3D FOSS for Python package.
Properties: length, w, x, y, z.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
w | float | Read | Gets the w. |
x | float | Read | Gets the x. |
y | float | Read | Gets the y. |
z | float | Read | Gets the z. |
length | float | Read | Gets the length. |
Methods
| Signature | Description |
|---|---|
__init__(w, x, y, z) | |
get_IDENTITY() → 'Quaternion' | Returns the identity. |
normalize() → 'Quaternion' | Returns a unit‑length quaternion representing the same rotation |
conjugate() → 'Quaternion' | Returns the conjugate of the quaternion (negates the vector part) |
inverse() → 'Quaternion' | Returns the inverse rotation quaternion |
dot(q: 'Quaternion') → float | Computes the dot product with another quaternion |
concat(rhs: 'Quaternion') → 'Quaternion' | Returns the concatenation (multiplication) of this quaternion with another |
euler_angles() → 'Vector3' | Returns the rotation expressed as Euler angles as a Vector3 |
to_matrix(translation) → 'Matrix4' | Converts the quaternion (and optional translation) to a 4x4 matrix |
to_angle_axis(angle, axis) | Converts the quaternion to angle‑axis representation, outputting angle and axis |
from_euler_angle(pitch, yaw, roll) → 'Quaternion' | Creates a quaternion from pitch, yaw and roll angles |
from_angle_axis(a: float, axis) → 'Quaternion' | Creates a quaternion from an angle and an axis vector |
from_rotation(orig, dest) → 'Quaternion' | Creates a quaternion representing rotation from orig to dest vectors |
interpolate(t: float, from_q: 'Quaternion', to_q: 'Quaternion') → 'Quaternion' | Returns a linearly interpolated quaternion between two quaternions at t |
slerp(t: float, v1: 'Quaternion', v2: 'Quaternion') → 'Quaternion' | Returns a spherical linear interpolation between two quaternions at t |
get_keyframe_sequence(anim, create) | Not implemented in the FOSS edition — throws at runtime. Retrieves or creates a keyframe sequence for an animation |
get_bind_point(anim, create) | Not implemented in the FOSS edition — throws at runtime. Retrieves or creates a bind point for an animation |