Quaternion.from_frame

classmethod Quaternion.from_frame(frame)[source]

Creates a quaternion object from a frame.

Parameters:
framecompas.geometry.Frame
Returns:
compas.geometry.Quaternion

The new quaternion.

Examples

>>> from compas.tolerance import TOL
>>> from compas.geometry import Frame
>>> q = [1.0, -2.0, 3.0, -4.0]
>>> F = Frame.from_quaternion(q)
>>> Q = Quaternion.from_frame(F)
>>> TOL.is_allclose(Q.canonized(), quaternion_canonize(quaternion_unitize(q)))
True