Rotation.from_quaternion
- classmethod Rotation.from_quaternion(quaternion)[source]
Construct a rotation transformation` from quaternion coefficients.
- Parameters:
- quaternion[float, float, float, float] |
compas.geometry.Quaternion
Four numbers that represents the four coefficient values of a quaternion.
- quaternion[float, float, float, float] |
- Returns:
Examples
>>> from compas.tolerance import TOL >>> q1 = [0.945, -0.021, -0.125, 0.303] >>> R = Rotation.from_quaternion(q1) >>> q2 = R.quaternion >>> TOL.is_allclose(q1, q2, atol=1e-3) True