diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-05-13 18:26:40 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-05-13 18:26:40 +0400 |
commit | 206155749bad2636418d662c7c35b9a556cefc75 (patch) | |
tree | 3b1ddc9d3021a88423bcb530fc6740df6fe72273 /src/SubPic/CoordGeom.h | |
parent | 19a3db6bda07973263818e251731f2b6e1706462 (diff) |
use M_PI from math.h
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@4711 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/SubPic/CoordGeom.h')
-rw-r--r-- | src/SubPic/CoordGeom.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/SubPic/CoordGeom.h b/src/SubPic/CoordGeom.h index dddef3ab3..36204b79b 100644 --- a/src/SubPic/CoordGeom.h +++ b/src/SubPic/CoordGeom.h @@ -23,13 +23,18 @@ #pragma once
-#ifndef PI
-#define PI (3.141592654f)
+#ifndef _USE_MATH_DEFINES
+#define _USE_MATH_DEFINES
#endif
+#include <math.h>
-#define DegToRad(d) ((d)*PI/180.0)
-#define RadToDeg(r) ((r)*180.0/PI)
-#define Sgn(d) (IsZero(d) ? 0 : (d) > 0 ? 1 : -1)
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+#define DegToRad(d) ((d) * M_PI / 180.0)
+#define RadToDeg(r) ((r) * 180.0 / M_PI)
+#define Sgn(d) (IsZero(d) ? 0 : (d) > 0 ? 1 : -1)
#define SgnPow(d, p) (IsZero(d) ? 0 : (pow(fabs(d), p) * Sgn(d)))
class Vector
@@ -46,7 +51,7 @@ public: Vector Normal(Vector& a, Vector& b);
float Angle(Vector& a, Vector& b);
float Angle(Vector& a);
- void Angle(float& u, float& v); // returns spherical coords in radian, -PI/2 <= u <= PI/2, -PI <= v <= PI
+ void Angle(float& u, float& v); // returns spherical coords in radian, -M_PI/2 <= u <= M_PI/2, -M_PI <= v <= M_PI
Vector Angle(); // does like prev., returns 'u' in 'ret.x', and 'v' in 'ret.y'
Vector Unit();
|