mirror of https://github.com/AxioDL/zeus.git
CEulerAngle Quaternion constructor fix
This commit is contained in:
parent
8013e19baf
commit
f370b22b3b
|
@ -74,7 +74,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
inline zeus::CVector3f rotate(const CVector3f& vec) const { return *this * vec; }
|
||||
inline zeus::CVector3f rotate(const CVector3f& vec) const { return basis * vec; }
|
||||
|
||||
static inline CTransform RotateX(float theta)
|
||||
{
|
||||
|
|
|
@ -16,25 +16,21 @@ CEulerAngles::CEulerAngles(const CQuaternion& quat)
|
|||
|
||||
double t4 = 0.0;
|
||||
if (t3 > 0.0)
|
||||
{
|
||||
double sqrtT3 = std::sqrt(t3);
|
||||
double t5 = 0.5 * sqrtT3 * -(t3 * sqrtT3 * sqrtT3 - 3.0);
|
||||
double t6 = 0.5 * t5 * -(t5 * t5 - 3.0);
|
||||
double t7 = 0.5 * t6 * -(t3 * t6 * t6 - 3.0);
|
||||
t4 = t3 * 0.5 * t7 * -(t3 * t7 * t7 - 3.0);
|
||||
}
|
||||
t4 = std::sqrt(t3);
|
||||
|
||||
double t5 = t0 * quat.z * quat.y + t0 * quat.x * quat.w;
|
||||
|
||||
if (std::abs(t4) > 0.00001)
|
||||
{
|
||||
x = -std::atan2(t0 * quat.z * quat.y + t0 * quat.x * quat.w, t4);
|
||||
x = -std::atan2(-t5, t4);
|
||||
y = -std::atan2(t0 * quat.z * quat.x - t0 * quat.y * quat.w,
|
||||
1.0 - (t0 * quat.x * quat.x + t0 * quat.y * quat.y));
|
||||
z = -std::atan2(t2, t1);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = -std::atan2(t0 * quat.z * quat.y + t0 * quat.x * quat.w, t4);
|
||||
y = -std::atan2(t0 * quat.z * quat.x + t0 * quat.y * quat.w,
|
||||
x = -std::atan2(-t5, t4);
|
||||
y = -std::atan2(-(t0 * quat.z * quat.x + t0 * quat.y * quat.w),
|
||||
1.0 - (t0 * quat.y * quat.y + t0 * quat.z * quat.z));
|
||||
z = 0.f;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue