siconos.mechanics.quaternions module¶
Utilities to handle quaternions in the siconos.mechanics package
usage example:
>>> import siconos.mechanics.quaternions as quat
>>> phi, theta, psi = quat.euler_from_quaternion(q0, q1, q2, q3)
- siconos.mechanics.quaternions.euler_from_quaternion(q0, q1, q2, q3)[source]¶
Convert a quaternion into Euler angles (phi, theta, psi).
- Parameters:
- Returns:
tuple of ndarray – (phi, theta, psi), angles d’Euler en radians.
Example
>>> euler_from_quaternion(1, 0, 0, 0) (0.0, 0.0, 0.0)
- siconos.mechanics.quaternions.quaternion_get(orientation)[source]¶
Converts the orientation (either axis-angle or quaternion) into a quaternion representation.
If the input is already a quaternion, it is returned as-is.
- Parameters:
orientation (np array or tuple) – The orientation in either of the following formats: - Axis-angle: ([x, y, z], angle) where [x, y, z] is a 3D vector and angle is a float. - Quaternion: [w, x, y, z] where w, x, y, z are the quaternion components.