Welcome to Python-flavored Magnum! Please note that, while already being rather stable, this functionality is still considered experimental and some APIs might get changed without preserving full backwards compatibility.

magnum.Quaternion class

Float quaternion

Static methods

def from_matrix(arg0: Matrix3x3, /) -> Quaternion
Create a quaternion from rotation matrix
def identity_init() -> Quaternion
Construct an identity quaternion
def rotation(arg0: Rad, arg1: Vector3, /) -> Quaternion
Rotation quaternion
def zero_init() -> Quaternion
Construct a zero-initialized quaternion

Methods

def angle(self, /) -> Rad
Rotation angle of a unit quaternion
def axis(self, /) -> Vector3
Rotation axis of a unit quaternion
def conjugated(self, /) -> Quaternion
Conjugated quaternion
def dot(self, /) -> float
Dot product of the quaternion
def inverted(self, /) -> Quaternion
Inverted quaternion
def inverted_normalized(self, /) -> Quaternion
Inverted normalized quaternion
def is_normalized(self, /) -> bool
Whether the quaternion is normalized
def length(self, /) -> float
Quaternion length
def normalized(self, /) -> Quaternion
Normalized quaternion (of unit length)
def to_matrix(self, /) -> Matrix3x3
Convert to a rotation matrix
def transform_vector(self, arg0: Vector3, /) -> Vector3
Rotate a vector with a quaternion
def transform_vector_normalized(self, arg0: Vector3, /) -> Vector3
Rotate a vector with a normalized quaternion

Special methods

def __add__(self, arg0: Quaternion, /) -> Quaternion
Add a quaternion
def __eq__(self, arg0: Quaternion, /) -> bool
Equality comparison
def __iadd__(self, arg0: Quaternion, /) -> Quaternion
Add and assign a quaternion
def __imul__(self, arg0: float, /) -> Quaternion
Multiply with a scalar and assign
def __init__(self, /) -> None
Default constructor
def __init__(self, arg0: Vector3, arg1: float, /) -> None
Construct from a vector and a scalar
def __init__(self, arg0: typing.Tuple[typing.Tuple[float, float, float], float], /) -> None
Construct from a tuple
def __init__(self, arg0: Vector3, /) -> None
Construct from a vector
def __init__(self, arg0: Quaterniond, /) -> None
Construct from different underlying type
def __isub__(self, arg0: Quaternion, /) -> Quaternion
Subtract and assign a quaternion
def __itruediv__(self, arg0: float, /) -> Quaternion
Divide with a scalar and assign
def __mul__(self, arg0: float, /) -> Quaternion
Multiply with a scalar
def __mul__(self, arg0: Quaternion, /) -> Quaternion
Multiply with a quaternion
def __ne__(self, arg0: Quaternion, /) -> bool
Non-equality comparison
def __neg__(self, /) -> Quaternion
Negated quaternion
def __repr__(self, /) -> str
Object representation
def __rmul__(self, arg0: float, /) -> Quaternion
Multiply a scalar with a quaternion
def __rtruediv__(self, arg0: float, /) -> Quaternion
Divide a quaternion with a scalar and invert
def __sub__(self, arg0: Quaternion, /) -> Quaternion
Subtract a quaternion
def __truediv__(self, arg0: float, /) -> Quaternion
Divide with a scalar

Properties

scalar: float get set
Scalar part
vector: Vector3 get set
Vector part