Quaternion.from_matrix

classmethod Quaternion.from_matrix(M)[source]

Create a Quaternion from a transformation matrix.

Parameters:
Mlist[list[float]]
Returns:
compas.geometry.Quaternion

The new quaternion.

Examples

>>> from compas.geometry import matrix_from_euler_angles
>>> ea = [0.2, 0.6, 0.2]
>>> M = matrix_from_euler_angles(ea)
>>> Quaternion.from_matrix(M)
Quaternion(0.949, 0.066, 0.302, 0.066)