diff --git a/matrix/Euler.hpp b/matrix/Euler.hpp index bcaa85753c..0e062ed24a 100644 --- a/matrix/Euler.hpp +++ b/matrix/Euler.hpp @@ -91,23 +91,20 @@ public: */ Euler(const Dcm &dcm) { - Type phi_val = Type(atan2(dcm(2, 1), dcm(2, 2))); - Type theta_val = Type(asin(-dcm(2, 0))); - Type psi_val = Type(atan2(dcm(1, 0), dcm(0, 0))); - Type pi = Type(M_PI); + theta() = asin(-dcm(2, 0)); - if (Type(fabs(theta_val - pi / Type(2))) < Type(1.0e-3)) { - phi_val = Type(0); - psi_val = Type(atan2(dcm(1, 2), dcm(0, 2))); + if ((fabs(theta() - Type(M_PI / 2))) < Type(1.0e-3)) { + phi() = 0; + psi() = atan2(dcm(1, 2), dcm(0, 2)); - } else if (Type(fabs(theta_val + pi / Type(2))) < Type(1.0e-3)) { - phi_val = Type(0); - psi_val = Type(atan2(-dcm(1, 2), -dcm(0, 2))); + } else if ((fabs(theta() + Type(M_PI / 2))) < Type(1.0e-3)) { + phi() = 0; + psi() = atan2(-dcm(1, 2), -dcm(0, 2)); + + } else { + phi() = atan2(dcm(2, 1), dcm(2, 2)); + psi() = atan2(dcm(1, 0), dcm(0, 0)); } - - phi() = phi_val; - theta() = theta_val; - psi() = psi_val; } /**