I'm trying to convert raw quaternion values to Euler angles in order zyx. I'm trying to use nalgebra
rotations to convert, but the in-built conversion only gives angles in order xyz. Is there a way to convert from quat to zyx or from xyz to zyx? Or an alternative library that can do the same conversion?
Here's the function I'm currently using for conversion:
pub fn raw_quaternion_to_euler(w: f32, x: f32, y: f32, z: f32) -> (f32, f32, f32) {
let unit_quat = UnitQuaternion::from_quaternion(nalgebra::Quaternion::from_vector([w, x, y, z]));
unit_quat.euler_angles()
}
I managed to work out a way of doing this using a different library from nalgebra called quaternion-core. It was really simple to use and did exactly what I was asking for in this question.