axis_angle_from_quaternion
- compas.geometry.axis_angle_from_quaternion(q)[source]
Returns an axis and an angle of rotation from the given quaternion.
- Parameters
q (list) – Quaternion as a list of four real values
[qw, qx, qy, qz]
.- Returns
axis (list) – Coordinates
[x, y, z]
of the rotation axis vector.angle (float) – Angle of rotation in radians.
Examples
>>> q = [1., 1., 0., 0.] >>> axis, angle = axis_angle_from_quaternion(q) >>> allclose(axis, [1., 0., 0.]) True >>> allclose([angle], [math.pi/2], 1e-6) True