quaternion_from_matrix
- compas.geometry.quaternion_from_matrix(M)[source]
Returns the 4 quaternion coefficients from a rotation matrix.
- Parameters:
- Mlist[list[float]]
The coefficients of the rotation matrix, row per row.
- Returns:
- [float, float, float, float]
The quaternion coefficients.
Examples
>>> q1 = [0.945, -0.021, -0.125, 0.303] >>> R = matrix_from_quaternion(q1) >>> q2 = quaternion_from_matrix(R) >>> allclose(q1, q2, tol=1e-03) True