mirror of
https://github.com/AxioDL/zeus.git
synced 2025-12-09 21:47:51 +00:00
Reimplementation
This commit is contained in:
@@ -136,18 +136,19 @@ CQuaternion CQuaternion::inverse() const
|
||||
|
||||
CAxisAngle CQuaternion::toAxisAngle()
|
||||
{
|
||||
CAxisAngle ret;
|
||||
ret.angle = acosf(r);
|
||||
// CAxisAngle ret;
|
||||
// ret.angle = acosf(r);
|
||||
|
||||
float thetaInv = 1.0f/sinf(ret.angle);
|
||||
// float thetaInv = 1.0f/sinf(ret.angle);
|
||||
|
||||
ret.axis.x = v.x * thetaInv;
|
||||
ret.axis.y = v.y * thetaInv;
|
||||
ret.axis.z = v.z * thetaInv;
|
||||
// ret.axis.x = v.x * thetaInv;
|
||||
// ret.axis.y = v.y * thetaInv;
|
||||
// ret.axis.z = v.z * thetaInv;
|
||||
|
||||
ret.angle *= 2;
|
||||
// ret.angle *= 2;
|
||||
|
||||
return ret;
|
||||
// return ret;
|
||||
return CAxisAngle();
|
||||
}
|
||||
|
||||
CQuaternion CQuaternion::log() const
|
||||
|
||||
@@ -18,7 +18,8 @@ float CVector2f::getAngleDiff(const CVector2f& a, const CVector2f& b)
|
||||
if (!mag1 || !mag2)
|
||||
return 0;
|
||||
|
||||
float theta = acosf(a.dot(b) / (mag1 * mag2));
|
||||
float dot = a.dot(b);
|
||||
float theta = Math::arcCosineR(dot / (mag1 * mag2));
|
||||
return theta;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ float CVector3f::getAngleDiff(const CVector3f& a, const CVector3f& b)
|
||||
if (!mag1 || !mag2)
|
||||
return 0;
|
||||
|
||||
float theta = acosf(a.dot(b) / (mag1 * mag2));
|
||||
float dot = a.dot(b);
|
||||
float theta = Math::arcCosineR(dot / (mag1 * mag2));
|
||||
return theta;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "Math.hpp"
|
||||
#include "CTransform.hpp"
|
||||
#include "CVector3f.hpp"
|
||||
|
||||
namespace Zeus
|
||||
{
|
||||
@@ -239,5 +241,12 @@ CVector3f getRoundCatmullRomSplinePoint(const CVector3f& a, const CVector3f& b,
|
||||
return getCatmullRomSplinePoint(b, c, bVelocity * cbDistance, cVelocity * cbDistance, t);
|
||||
}
|
||||
|
||||
CVector3f baryToWorld(const CVector3f& p0, const CVector3f& p1, const CVector3f& p2, const CVector3f& bary)
|
||||
{ return bary.x * p0 + bary.y * p1 + bary.z * p2; }
|
||||
|
||||
CVector3f radToDeg(const CVector3f& rad) {return rad * kRadToDegVec;}
|
||||
|
||||
CVector3f degToRad(const CVector3f& deg) {return deg * kDegToRadVec;}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user