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.
class
QuaterniondDouble quaternion
Static methods
- def from_matrix(matrix: Matrix3x3d) -> Quaterniond
- Create a quaternion from rotation matrix
- def identity_init() -> Quaterniond
- Construct an identity quaternion
- def reflection(normal: Vector3d) -> Quaterniond
- Reflection quaternion
- def rotation(angle: Rad, normalized_axis: Vector3d) -> Quaterniond
- Rotation quaternion
- def rotation(normalized_from: Vector3d, normalized_to: Vector3d) -> Quaterniond
- Quaternion rotating from a vector to another
- def zero_init() -> Quaterniond
- Construct a zero-initialized quaternion
Methods
- def angle(self, /) -> Rad
- Rotation angle of a unit quaternion
- def axis(self, /) -> Vector3d
- Rotation axis of a unit quaternion
- def conjugated(self, /) -> Quaterniond
- Conjugated quaternion
- def dot(self, /) -> float
- Dot product of the quaternion
- def inverted(self, /) -> Quaterniond
- Inverted quaternion
- def inverted_normalized(self, /) -> Quaterniond
- Inverted normalized quaternion
- def is_normalized(self, /) -> bool
- Whether the quaternion is normalized
- def length(self, /) -> float
- Quaternion length
- def normalized(self, /) -> Quaterniond
- Normalized quaternion (of unit length)
- def reflect_vector(self, vector: Vector3d) -> Vector3d
- Reflect a vector with a reflection quaternion
- def to_matrix(self, /) -> Matrix3x3d
- Convert to a rotation matrix
- def transform_vector(self, vector: Vector3d) -> Vector3d
- Rotate a vector with a quaternion
- def transform_vector_normalized(self, vector: Vector3d) -> Vector3d
- Rotate a vector with a normalized quaternion
Special methods
- def __add__(self, arg0: Quaterniond, /) -> Quaterniond
- Add a quaternion
- def __eq__(self, arg0: Quaterniond, /) -> bool
- Equality comparison
- def __getstate__(self, /) -> bytes
- Dumps the in-memory representation of quaternion components
- def __iadd__(self, arg0: Quaterniond, /) -> Quaterniond
- Add and assign a quaternion
- def __imul__(self, arg0: float, /) -> Quaterniond
- Multiply with a scalar and assign
- def __init__(self, /) -> None
- Default constructor
- def __init__(self, arg0: Vector3d, arg1: float, /) -> None
- Construct from a vector and a scalar
- def __init__(self, arg0: tuple[tuple[float, float, float], float], /) -> None
- Construct from a tuple
- def __init__(self, arg0: Vector3d, /) -> None
- Construct from a vector
- def __init__(self, arg0: Quaternion, /) -> None
- Construct from different underlying type
- def __isub__(self, arg0: Quaterniond, /) -> Quaterniond
- Subtract and assign a quaternion
- def __itruediv__(self, arg0: float, /) -> Quaterniond
- Divide with a scalar and assign
- def __mul__(self, arg0: float, /) -> Quaterniond
- Multiply with a scalar
- def __mul__(self, arg0: Quaterniond, /) -> Quaterniond
- Multiply with a quaternion
- def __ne__(self, arg0: Quaterniond, /) -> bool
- Non-equality comparison
- def __neg__(self, /) -> Quaterniond
- Negated quaternion
- def __repr__(self, /) -> str
- Object representation
- def __rmul__(self, arg0: float, /) -> Quaterniond
- Multiply a scalar with a quaternion
- def __rtruediv__(self, arg0: float, /) -> Quaterniond
- Divide a quaternion with a scalar and invert
- def __setstate__(self, arg0: bytes, /) -> None
- Treats the data as the in-memory representation of quaternion components
- def __sub__(self, arg0: Quaterniond, /) -> Quaterniond
- Subtract a quaternion
- def __truediv__(self, arg0: float, /) -> Quaterniond
- Divide with a scalar
Properties
Method documentation
def magnum. Quaterniond. from_matrix(matrix: Matrix3x3d) -> Quaterniond staticmethod
Create a quaternion from rotation matrix
Exceptions | |
---|---|
ValueError | If matrix is not a rotation |
def magnum. Quaterniond. reflection(normal: Vector3d) -> Quaterniond staticmethod
Reflection quaternion
Exceptions | |
---|---|
ValueError | If normal is not normalized |
def magnum. Quaterniond. rotation(angle: Rad,
normalized_axis: Vector3d) -> Quaterniond staticmethod
Rotation quaternion
Exceptions | |
---|---|
ValueError | If normalized_axis is not normalized |
def magnum. Quaterniond. angle(self, /) -> Rad
Rotation angle of a unit quaternion
Exceptions | |
---|---|
ValueError | If the quaternion is not normalized |
def magnum. Quaterniond. axis(self, /) -> Vector3d
Rotation axis of a unit quaternion
Exceptions | |
---|---|
ValueError | If the quaternion is not normalized |
def magnum. Quaterniond. inverted_normalized(self, /) -> Quaterniond
Inverted normalized quaternion
Exceptions | |
---|---|
ValueError | If the quaternion is not normalized |
def magnum. Quaterniond. transform_vector_normalized(self,
vector: Vector3d) -> Vector3d
Rotate a vector with a normalized quaternion
Exceptions | |
---|---|
ValueError | If the quaternion is not normalized |
def magnum. Quaterniond. __setstate__(self,
arg0: bytes, /) -> None
Treats the data as the in-memory representation of quaternion components
Exceptions | |
---|---|
ValueError | If the data size doesn’t match type size |