Rotate gizmo transform functionality implemented

This commit is contained in:
parax0
2015-08-23 21:02:14 -04:00
parent 04b4f36da9
commit 614f73487e
12 changed files with 460 additions and 103 deletions

View File

@@ -28,6 +28,26 @@ void CVector2f::Write(COutputStream &Output)
Output.WriteFloat(y);
}
float CVector2f::Magnitude() const
{
return sqrtf(SquaredMagnitude());
}
float CVector2f::SquaredMagnitude() const
{
return Dot(*this);
}
CVector2f CVector2f::Normalized() const
{
return *this / Magnitude();
}
float CVector2f::Dot(const CVector2f& other) const
{
return ((x * other.x) + (y * other.y));
}
CVector2f CVector2f::operator+(const CVector2f& src) const
{
CVector2f out;
@@ -142,11 +162,21 @@ bool CVector2f::operator!=(const CVector2f& other) const
return (!(*this == other));
}
CVector2f CVector2f::operator-() const
{
return CVector2f(-x, -y);
}
float& CVector2f::operator[](long index)
{
return (&x)[index];
}
const float& CVector2f::operator[](long index) const
{
return (&x)[index];
}
// ************ STATIC MEMBER INITIALIZATION ************
const CVector2f CVector2f::skZero = CVector2f(0, 0);
const CVector2f CVector2f::skOne = CVector2f(1, 1);