rustgd / cgmath

A linear algebra and mathematics library for computer graphics.
https://docs.rs/cgmath
Apache License 2.0
1.13k stars 155 forks source link

'Quaternion' to 'Euler' conversion is missing #466

Closed lulugo19 closed 3 years ago

lulugo19 commented 6 years ago

I can't find a conversion form 'Euler' to 'Quaternion'. I version 0.9.1 there is a 'to_euler' method but not in the later versions. see here: https://docs.rs/cgmath/0.9.1/cgmath/struct.Quaternion.html#method.to_euler

kanerogers commented 3 years ago

Hey there! I know it's been a long time since you asked this question, but for anyone else looking for the answer to this, you can use the from method on Euler, eg:

let quaternion = Quaternion::from(Euler::new(Deg(90.0), Deg(0.0), Deg(0.0)));
let euler = Euler::from(quaternion);

I've found the tests directory to be a good source of "how do I do x with cgmath?" answers, especially this one. 😉