X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvector.cpp;h=baa0422869b125aa24dca41e8d1c32ed016b58cd;hb=HEAD;hp=fe627cd329adb397f28c3447512dfcad265c6f02;hpb=7fde5a077bc9bbce28662fa2e5aa5043f3b4747f;p=ttedit diff --git a/src/vector.cpp b/src/vector.cpp old mode 100755 new mode 100644 index fe627cd..baa0422 --- a/src/vector.cpp +++ b/src/vector.cpp @@ -162,11 +162,7 @@ void vector::zero(const double epsilon/*= 1.0e-6*/) #include "vector.h" #include // 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; }