Skip to content

Commit

Permalink
remove PI macros
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrauch committed Jan 21, 2024
1 parent 6295796 commit 68fc857
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions common/math_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ either expressed or implied, of the Regents of The University of Michigan.
extern "C" {
#endif

#ifndef M_TWOPI
# define M_TWOPI 6.2831853071795862319959 /* 2*pi */
#endif

#ifndef M_PI
# define M_PI 3.141592653589793238462643383279502884196
#endif

#define to_radians(x) ( (x) * (M_PI / 180.0 ))
#define to_degrees(x) ( (x) * (180.0 / M_PI ))

Expand Down Expand Up @@ -108,7 +100,7 @@ static inline int irand(int bound)
/** Map vin to [0, 2*PI) **/
static inline double mod2pi_positive(double vin)
{
return vin - M_TWOPI * floor(vin / M_TWOPI);
return vin - M_2_PI * floor(vin / M_2_PI);
}

/** Map vin to [-PI, PI) **/
Expand Down Expand Up @@ -142,7 +134,7 @@ static inline int mod_positive(int vin, int mod) {
static inline int theta_to_int(double theta, int max)
{
theta = mod2pi_ref(M_PI, theta);
int v = (int) (theta / M_TWOPI * max);
int v = (int) (theta / M_2_PI * max);

if (v == max)
v = 0;
Expand Down

0 comments on commit 68fc857

Please sign in to comment.