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[float, float, float, float]
Quaternion as a list of four real values
[qw, qx, qy, qz]
.
- Returns:
- axis[float, float, float]
XYZ coordinates of the rotation axis vector.
- anglefloat
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