mirror of https://github.com/AxioDL/zeus.git
Various bug fixes
This commit is contained in:
parent
d9e88babe2
commit
b54121ed9c
|
@ -12,7 +12,7 @@ public:
|
|||
|
||||
CSphere(const CVector3f& position, float radius) : position(position), radius(radius) {}
|
||||
|
||||
inline CVector3f getSurfaceNormal(const CVector3f& coord) const { return (position - coord).normalized(); }
|
||||
inline CVector3f getSurfaceNormal(const CVector3f& coord) const { return (coord - position).normalized(); }
|
||||
|
||||
inline bool intersects(const CSphere& other)
|
||||
{
|
||||
|
|
|
@ -309,8 +309,8 @@ CQuaternion CQuaternion::shortestRotationArc(const zeus::CVector3f& v0, const ze
|
|||
}
|
||||
else
|
||||
{
|
||||
float w = (1.f + zeus::clamp(-1.f, v0N.dot(v1N), 1.f)) * 2.f;
|
||||
return CQuaternion(0.5f * w, cross * (1.f / std::sqrt(w)));
|
||||
float w = std::sqrt((1.f + zeus::clamp(-1.f, v0N.dot(v1N), 1.f)) * 2.f);
|
||||
return CQuaternion(0.5f * w, cross * (1.f / w));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -180,11 +180,12 @@ CTransform lookAt(const CVector3f& pos, const CVector3f& lookPos, const CVector3
|
|||
return CTransform(rmBasis, pos);
|
||||
}
|
||||
|
||||
CVector3f getBezierPoint(const CVector3f& a, const CVector3f& b, const CVector3f& c, const CVector3f& d, float t)
|
||||
CVector3f getBezierPoint(const CVector3f& a, const CVector3f& b,
|
||||
const CVector3f& c, const CVector3f& d, float t)
|
||||
{
|
||||
const float oneMinusTime = (1.0 - t);
|
||||
return (a * oneMinusTime * oneMinusTime) + (b * 3.f * t * oneMinusTime) + (c * 3.f * t * t * oneMinusTime) +
|
||||
(d * t * t * t);
|
||||
const float omt = 1.f - t;
|
||||
return ((a * omt + b * t) * omt + (b * omt + c * t) * t) * omt +
|
||||
((b * omt + c * t) * omt + (c * omt + d * t) * t) * t;
|
||||
}
|
||||
|
||||
int floorPowerOfTwo(int x)
|
||||
|
|
Loading…
Reference in New Issue