Rotation.from_quaternion
- classmethod Rotation.from_quaternion(quaternion)
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.- Returns
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