Rotation.from_quaternion
- classmethod Rotation.from_quaternion(quaternion)
Calculates a
Rotation
from quaternion coefficients.- Parameters
quaternion (compas.geometry.Quaternion or list) – Four numbers that represents the four coefficient values of a quaternion.
Examples
>>> from compas.geometry import allclose >>> q1 = [0.945, -0.021, -0.125, 0.303] >>> R = Rotation.from_quaternion(q1) >>> q2 = R.quaternion >>> allclose(q1, q2, tol=1e-3) True