diff options
author | aap <aap@papnet.eu> | 2020-04-15 22:36:21 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2020-04-15 22:36:21 +0200 |
commit | afce2e1bb3212a01efe0205313cf5d632eee8a20 (patch) | |
tree | e9602e11ba49ad3cd35c0af4355eec330d73aa8b /src/math | |
parent | implemented most of librw wrapper (diff) | |
parent | Merge pull request #440 from Fire-Head/master (diff) | |
download | re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.tar re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.tar.gz re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.tar.bz2 re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.tar.lz re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.tar.xz re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.tar.zst re3-afce2e1bb3212a01efe0205313cf5d632eee8a20.zip |
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/Vector.h | 7 | ||||
-rw-r--r-- | src/math/Vector2D.h | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/math/Vector.h b/src/math/Vector.h index 1274a4b2..269ffc88 100644 --- a/src/math/Vector.h +++ b/src/math/Vector.h @@ -46,6 +46,13 @@ public: y *= invsqrt; z *= invsqrt; } + + void Normalise2D(void) { + float sq = MagnitudeSqr2D(); + float invsqrt = RecipSqrt(sq); + x *= invsqrt; + y *= invsqrt; + } const CVector &operator+=(CVector const &right) { x += right.x; diff --git a/src/math/Vector2D.h b/src/math/Vector2D.h index 1e4d698f..705ad763 100644 --- a/src/math/Vector2D.h +++ b/src/math/Vector2D.h @@ -13,13 +13,14 @@ public: void Normalise(void){ float sq = MagnitudeSqr(); - if(sq > 0.0f){ + //if(sq > 0.0f){ float invsqrt = RecipSqrt(sq); x *= invsqrt; y *= invsqrt; - }else - x = 1.0f; + //}else + // x = 1.0f; } + const CVector2D &operator+=(CVector2D const &right) { x += right.x; y += right.y; |