Separate implementation
All checks were successful
Build Docs With Doxygen / Explore-Gitea-Actions (push) Successful in 1m4s

This commit is contained in:
2024-04-26 11:52:11 -04:00
parent ac46c259aa
commit 35e1309d6f
2 changed files with 5 additions and 15 deletions

View File

@@ -61,21 +61,7 @@ namespace J3ML::LinearAlgebra
float GetAngle() const;
EulerAngle ToEulerAngle() const
{
// roll (x-axis rotation)
double sinr_cosp = 2 * (w * x + y * z);
double cosr_cosp = 1 - 2 * (x * x + y * y);
// pitch (y-axis rotation)
double sinp = std::sqrt(1 + 2 * (w * y - x * z));
double
return {
.roll = std::atan2(sinr_cosp, cosr_cosp),
.pitch =
};
}
EulerAngle ToEulerAngle() const;
Matrix3x3 ToMatrix3x3() const;

View File

@@ -232,4 +232,8 @@ namespace J3ML::LinearAlgebra {
z = angle.axis.z * s;
w = std::cos(angle.angle / 2);
}
EulerAngle Quaternion::ToEulerAngle() const {
return EulerAngle(*this);
}
}