nml::vec3 nml::quatToEulerAngles(const nml::quat& qua)

Return a vec3 representing euler angles in radians from a quaternion.

The conversion from quaternion to euler angles is calculated by converting the quaternion to a rotation matrix and converting this rotation matrix to euler angles.

Example

#include "include/vec3.h"
#include "include/quat.h"
#include <iostream>

int main() {
        nml::quat q(1.0f, 1.0f, 1.0f, 1.0f);
        q = nml::normalize(q);
        nml::vec3 v = nml::quatToEulerAngles(q);
        std::cout << nml::to_string(v) << std::endl;

        return 0;
}

Result:

[1.570796, 0.000000, 1.570796]