summaryrefslogtreecommitdiffstats
path: root/src/math/Vector2D.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/math/Vector2D.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/math/Vector2D.h b/src/math/Vector2D.h
index e6b04c14..c8835ec0 100644
--- a/src/math/Vector2D.h
+++ b/src/math/Vector2D.h
@@ -7,13 +7,14 @@ public:
CVector2D(void) {}
CVector2D(float x, float y) : x(x), y(y) {}
CVector2D(const CVector &v) : x(v.x), y(v.y) {}
+ float Heading(void) const { return Atan2(-x, y); }
float Magnitude(void) const { return Sqrt(x*x + y*y); }
float MagnitudeSqr(void) const { return x*x + y*y; }
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