Origin.from_quaternion

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

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

>>> q1 = [0.945, -0.021, -0.125, 0.303]
>>> f = Frame.from_quaternion(q1, point=[1., 1., 1.])
>>> q2 = f.quaternion
>>> allclose(q1, q2, tol=1e-03)
True