Browse Source

remove reliance on non-standard macros

David Rose 18 years ago
parent
commit
2b53c7df68
2 changed files with 5 additions and 5 deletions
  1. 1 1
      panda/src/event/Sources.pp
  2. 4 4
      panda/src/event/pointerEventList.cxx

+ 1 - 1
panda/src/event/Sources.pp

@@ -1,4 +1,4 @@
-#define LOCAL_LIBS putil express pandabase pstatclient
+#define LOCAL_LIBS putil express pandabase pstatclient linmath
 #define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
 #define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
                    dtoolutil:c dtoolbase:c dtool:m prc:c
                    dtoolutil:c dtoolbase:c dtool:m prc:c
 
 

+ 4 - 4
panda/src/event/pointerEventList.cxx

@@ -19,7 +19,7 @@
 #include "pointerEventList.h"
 #include "pointerEventList.h"
 #include "indent.h"
 #include "indent.h"
 #include "clockObject.h"
 #include "clockObject.h"
-#define _USE_MATH_DEFINES
+#include "mathNumbers.h"
 #include <math.h>
 #include <math.h>
 
 
 TypeHandle PointerEventList::_type_handle;
 TypeHandle PointerEventList::_type_handle;
@@ -82,7 +82,7 @@ add_event(bool in_win, int xpos, int ypos, int seq, double time) {
     double ddy = pe._dy;
     double ddy = pe._dy;
     pe._length = sqrt(ddx*ddx + ddy*ddy);
     pe._length = sqrt(ddx*ddx + ddy*ddy);
     if (pe._length > 0.0) {
     if (pe._length > 0.0) {
-      pe._direction = atan2(-ddy,ddx) * (180.0 / M_PI);
+      pe._direction = atan2(-ddy,ddx) * (180.0 / MathNumbers::pi);
       if (pe._direction < 0.0) pe._direction += 360.0;
       if (pe._direction < 0.0) pe._direction += 360.0;
     } else {
     } else {
       pe._direction = _events.back()._direction;
       pe._direction = _events.back()._direction;
@@ -114,7 +114,7 @@ encircles(int x, int y) const {
   }
   }
   double dx = _events[0]._xpos - x;
   double dx = _events[0]._xpos - x;
   double dy = _events[0]._ypos - y;
   double dy = _events[0]._ypos - y;
-  double lastang = atan2(dy, dx) * (180.0/M_PI);
+  double lastang = atan2(dy, dx) * (180.0/MathNumbers::pi);
   double total = 0.0;
   double total = 0.0;
   for (int i=1; (i<tot_events) && (total < 360.0) && (total > -360.0); i++) {
   for (int i=1; (i<tot_events) && (total < 360.0) && (total > -360.0); i++) {
     dx = _events[i]._xpos - x;
     dx = _events[i]._xpos - x;
@@ -122,7 +122,7 @@ encircles(int x, int y) const {
     if ((dx==0.0)&&(dy==0.0)) {
     if ((dx==0.0)&&(dy==0.0)) {
       continue;
       continue;
     }
     }
-    double angle = atan2(dy,dx) * (180.0/M_PI);
+    double angle = atan2(dy,dx) * (180.0/MathNumbers::pi);
     double deltang = angle - lastang;
     double deltang = angle - lastang;
     if (deltang < -180.0) deltang += 360.0;
     if (deltang < -180.0) deltang += 360.0;
     if (deltang >  180.0) deltang -= 360.0;
     if (deltang >  180.0) deltang -= 360.0;