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) {}
|
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)
|
inline bool intersects(const CSphere& other)
|
||||||
{
|
{
|
||||||
|
|
|
@ -309,8 +309,8 @@ CQuaternion CQuaternion::shortestRotationArc(const zeus::CVector3f& v0, const ze
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float w = (1.f + zeus::clamp(-1.f, v0N.dot(v1N), 1.f)) * 2.f;
|
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 / std::sqrt(w)));
|
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);
|
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);
|
const float omt = 1.f - t;
|
||||||
return (a * oneMinusTime * oneMinusTime) + (b * 3.f * t * oneMinusTime) + (c * 3.f * t * t * oneMinusTime) +
|
return ((a * omt + b * t) * omt + (b * omt + c * t) * t) * omt +
|
||||||
(d * t * t * t);
|
((b * omt + c * t) * omt + (c * omt + d * t) * t) * t;
|
||||||
}
|
}
|
||||||
|
|
||||||
int floorPowerOfTwo(int x)
|
int floorPowerOfTwo(int x)
|
||||||
|
|
Loading…
Reference in New Issue