fu5ha/ultraviolet

Mat3::from_euler_angles does not do what documentation says

thenlevy opened this issue · 0 comments

According to the documentation, when building a Mat3 with Mat3::from_euler_angle, the rotations are applied in order
roll -> pitch -> yaw

However, when added to src/mat.rs, this test will fail

    #[test]
    pub fn test_euler_angle_conversion() {
        let roll = 0.4;
        let yaw = 0.3;
        let pitch = 0.2;

        let mat1 = Mat3::from_euler_angles(roll, pitch, yaw);
        let mat2 = Mat3::from_rotation_y(yaw) * Mat3::from_rotation_x(pitch) * Mat3::from_rotation_z(roll);
        assert_eq!(mat1[0], mat2[0]);
        assert_eq!(mat1[1], mat2[1]);
        assert_eq!(mat1[2], mat2[2]);
    }