]> Shamusworld >> Repos - ttedit/blobdiff - src/vector.cpp
Minor fixes to polygon adding, added Tau constants to math package.
[ttedit] / src / vector.cpp
index fe627cd329adb397f28c3447512dfcad265c6f02..baa0422869b125aa24dca41e8d1c32ed016b58cd 100644 (file)
@@ -162,11 +162,7 @@ void vector::zero(const double epsilon/*= 1.0e-6*/)
 #include "vector.h"
 
 #include <math.h>                                                              // For sqrt()
-//#include "mathconstants.h"
-
-#define PI 3.14159265358979323846264338327
-#define RADIANS_TO_DEGREES (180.0 / PI)
-#define DEGREES_TO_RADIANS (PI / 180.0)
+#include "mathconstants.h"
 
 
 // Vector implementation
@@ -354,11 +350,11 @@ double Vector::Magnitude(void)
 
 double Vector::Angle(void)
 {
-       // acos returns a value between zero and PI, which means we don't know which
-       // quadrant the angle is in... Though, if the y-coordinate of the vector is
-       // negative, that means that the angle is in quadrants III - IV.
+       // acos returns a value between zero and PI, which means we don't know
+       // which quadrant the angle is in... Though, if the y-coordinate of the
+       // vector is negative, that means that the angle is in quadrants III - IV.
        double rawAngle = acos(Unit().x);
-       double correctedAngle = (y < 0 ? (2.0 * PI) - rawAngle : rawAngle);
+       double correctedAngle = (y < 0 ? TAU - rawAngle : rawAngle);
 
        return correctedAngle;
 }