1
0
mirror of https://github.com/td512/re3.git synced 2026-02-06 15:34:39 +00:00

Move a bunch of math to cpp files + small fixes

This commit is contained in:
Sergeanur
2020-09-14 20:48:49 +03:00
parent 93d77f340d
commit 38ec1bd50d
14 changed files with 857 additions and 529 deletions

View File

@@ -11,7 +11,13 @@ public:
float Magnitude(void) const { return Sqrt(x*x + y*y); }
float MagnitudeSqr(void) const { return x*x + y*y; }
void Normalise(void);
void Normalise(void) {
float sq = MagnitudeSqr();
// assert(sq != 0.0f); // just be safe here
float invsqrt = RecipSqrt(sq);
x *= invsqrt;
y *= invsqrt;
}
void NormaliseSafe(void) {
float sq = MagnitudeSqr();
@@ -20,7 +26,7 @@ public:
x *= invsqrt;
y *= invsqrt;
}else
y = 1.0f;
x = 1.0f;
}
const CVector2D &operator+=(CVector2D const &right) {