diff options
author | aap <aap@papnet.eu> | 2019-07-28 13:14:08 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2019-07-28 13:14:08 +0200 |
commit | 6ff921c160e802c12ad40b06f17a93f72eea6bdf (patch) | |
tree | 62ba0586a63538340c0f8ebfa99c65c0fc6ed76d /src/math | |
parent | renamed flag to R* name (diff) | |
download | re3-6ff921c160e802c12ad40b06f17a93f72eea6bdf.tar re3-6ff921c160e802c12ad40b06f17a93f72eea6bdf.tar.gz re3-6ff921c160e802c12ad40b06f17a93f72eea6bdf.tar.bz2 re3-6ff921c160e802c12ad40b06f17a93f72eea6bdf.tar.lz re3-6ff921c160e802c12ad40b06f17a93f72eea6bdf.tar.xz re3-6ff921c160e802c12ad40b06f17a93f72eea6bdf.tar.zst re3-6ff921c160e802c12ad40b06f17a93f72eea6bdf.zip |
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/Vector.h | 6 | ||||
-rw-r--r-- | src/math/Vector2D.h | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/math/Vector.h b/src/math/Vector.h index f794a57f..42087339 100644 --- a/src/math/Vector.h +++ b/src/math/Vector.h @@ -31,7 +31,7 @@ public: void Normalise(void) { float sq = MagnitudeSqr(); if(sq > 0.0f){ - float invsqrt = 1.0f/Sqrt(sq); // CMaths::RecipSqrt + float invsqrt = RecipSqrt(sq); x *= invsqrt; y *= invsqrt; z *= invsqrt; @@ -71,6 +71,10 @@ public: return CVector(-x, -y, -z); } + const bool operator==(CVector const &right) { + return x == right.x && y == right.y && z == right.z; + } + bool IsZero(void) { return x == 0.0f && y == 0.0f && z == 0.0f; } }; diff --git a/src/math/Vector2D.h b/src/math/Vector2D.h index caba9146..c8835ec0 100644 --- a/src/math/Vector2D.h +++ b/src/math/Vector2D.h @@ -14,7 +14,7 @@ public: void Normalise(void){ float sq = MagnitudeSqr(); if(sq > 0.0f){ - float invsqrt = 1.0f/Sqrt(sq); + float invsqrt = RecipSqrt(sq); x *= invsqrt; y *= invsqrt; }else |