#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
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;
}