Separate implementation
All checks were successful
Build Docs With Doxygen / Explore-Gitea-Actions (push) Successful in 1m4s
All checks were successful
Build Docs With Doxygen / Explore-Gitea-Actions (push) Successful in 1m4s
This commit is contained in:
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user