Quaternion.from_matrix

classmethod Quaternion.from_matrix(M)

Create a Quaternion from a transformation matrix.

Parameters

M (list of list of float)

Returns

compas.geometry.Quaternion – The new quaternion.

Example

>>> 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)