Quaternion.from_frame

classmethod Quaternion.from_frame(frame)

Creates a quaternion object from a frame.

Parameters

frame (compas.geometry.Frame)

Returns

compas.geometry.Quaternion – The new quaternion.

Examples

>>> from compas.geometry import allclose
>>> from compas.geometry import Frame
>>> q = [1., -2., 3., -4.]
>>> F = Frame.from_quaternion(q)
>>> Q = Quaternion.from_frame(F)
>>> allclose(Q.canonized(), quaternion_canonize(quaternion_unitize(q)))
True