Frame.from_quaternion

classmethod Frame.from_quaternion(quaternion, point=[0, 0, 0])[source]

Construct a frame from a rotation represented by quaternion coefficients.

Parameters:
quaternion[float, float, float, float] | compas.geometry.Quaternion

Four numbers that represent the four coefficient values of a quaternion.

point[float, float, float] | compas.geometry.Point, optional

The point of the frame.

Returns:
compas.geometry.Frame

The constructed frame.

Examples

>>> from compas.tolerance import TOL
>>> q1 = [0.945, -0.021, -0.125, 0.303]
>>> f = Frame.from_quaternion(q1, point=[1.0, 1.0, 1.0])
>>> q2 = f.quaternion
>>> TOL.is_allclose(q1, q2, atol=1e-3)
True