mirror of https://github.com/AxioDL/zeus.git
Implement CQuaternion::angleFrom()
This commit is contained in:
parent
0e792b213a
commit
3d377124c1
|
@ -274,6 +274,8 @@ public:
|
||||||
zeus::CVector3f getImaginary() const { return {x, y, z}; }
|
zeus::CVector3f getImaginary() const { return {x, y, z}; }
|
||||||
void setImaginary(const zeus::CVector3f& i) { x = i.x; y = i.y; z = i.z; }
|
void setImaginary(const zeus::CVector3f& i) { x = i.x; y = i.y; z = i.z; }
|
||||||
|
|
||||||
|
CRelAngle angleFrom(const zeus::CQuaternion& other);
|
||||||
|
|
||||||
inline float& operator[](size_t idx) { return (&w)[idx]; }
|
inline float& operator[](size_t idx) { return (&w)[idx]; }
|
||||||
inline const float& operator[](size_t idx) const { return (&w)[idx]; }
|
inline const float& operator[](size_t idx) const { return (&w)[idx]; }
|
||||||
|
|
||||||
|
|
|
@ -271,4 +271,10 @@ CQuaternion CQuaternion::buildEquivalent() const
|
||||||
else
|
else
|
||||||
return CQuaternion::fromAxisAngle(CUnitVector3f(x, y, z), tmp + 2.0 * M_PI);
|
return CQuaternion::fromAxisAngle(CUnitVector3f(x, y, z), tmp + 2.0 * M_PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CRelAngle CQuaternion::angleFrom(const zeus::CQuaternion& other)
|
||||||
|
{
|
||||||
|
return std::acos(zeus::clamp(-1.f, dot(other), 1.f));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue