#include <math.h>
#include <float.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <string.h>
Go to the source code of this file.
|
#define | M_PI 3.141592653589793238462643383279502884196 |
|
#define | M_TWOPI 6.2831853071795862319959 /* 2*pi */ |
|
#define | max(A, B) (A < B ? B : A) |
|
#define | min(A, B) (A < B ? A : B) |
|
#define | to_degrees(x) ( (x) * (180.0 / M_PI )) |
|
#define | to_radians(x) ( (x) * (M_PI / 180.0 )) |
|
|
static int | dblcmp (double d1, double d2) |
|
static double | dclamp (double a, double min, double max) |
|
static int | dequals_mag (double a, double b, double thresh) |
|
static int | fltcmp (float f1, float f2) |
|
static float | fsq (float v) |
|
static int | iclamp (int v, int minv, int maxv) |
|
static int | imax (int a, int b) |
|
static int64_t | imax64 (int64_t a, int64_t b) |
|
static int | imin (int a, int b) |
|
static int64_t | imin64 (int64_t a, int64_t b) |
|
static int | irand (int bound) |
|
static int | isq (int v) |
|
static double | mod2pi (double vin) |
|
static double | mod2pi_positive (double vin) |
|
static double | mod2pi_ref (double ref, double vin) |
|
static double | mod360 (double vin) |
|
static double | mod360_positive (double vin) |
|
static int | mod_positive (int vin, int mod) |
|
static float | randf () |
|
static double | sgn (double v) |
|
static float | signed_randf () |
|
static double | sq (double v) |
|
static int | theta_to_int (double theta, int max) |
|
◆ M_PI
#define M_PI 3.141592653589793238462643383279502884196 |
◆ M_TWOPI
#define M_TWOPI 6.2831853071795862319959 /* 2*pi */ |
◆ max
#define max |
( |
|
A, |
|
|
|
B |
|
) |
| (A < B ? B : A) |
◆ min
#define min |
( |
|
A, |
|
|
|
B |
|
) |
| (A < B ? A : B) |
◆ to_degrees
#define to_degrees |
( |
|
x | ) |
( (x) * (180.0 / M_PI )) |
◆ to_radians
#define to_radians |
( |
|
x | ) |
( (x) * (M_PI / 180.0 )) |
◆ dblcmp()
static int dblcmp |
( |
double |
d1, |
|
|
double |
d2 |
|
) |
| |
|
inlinestatic |
◆ dclamp()
static double dclamp |
( |
double |
a, |
|
|
double |
min, |
|
|
double |
max |
|
) |
| |
|
inlinestatic |
◆ dequals_mag()
static int dequals_mag |
( |
double |
a, |
|
|
double |
b, |
|
|
double |
thresh |
|
) |
| |
|
inlinestatic |
◆ fltcmp()
static int fltcmp |
( |
float |
f1, |
|
|
float |
f2 |
|
) |
| |
|
inlinestatic |
◆ fsq()
static float fsq |
( |
float |
v | ) |
|
|
inlinestatic |
◆ iclamp()
static int iclamp |
( |
int |
v, |
|
|
int |
minv, |
|
|
int |
maxv |
|
) |
| |
|
inlinestatic |
◆ imax()
static int imax |
( |
int |
a, |
|
|
int |
b |
|
) |
| |
|
inlinestatic |
◆ imax64()
static int64_t imax64 |
( |
int64_t |
a, |
|
|
int64_t |
b |
|
) |
| |
|
inlinestatic |
◆ imin()
static int imin |
( |
int |
a, |
|
|
int |
b |
|
) |
| |
|
inlinestatic |
◆ imin64()
static int64_t imin64 |
( |
int64_t |
a, |
|
|
int64_t |
b |
|
) |
| |
|
inlinestatic |
◆ irand()
static int irand |
( |
int |
bound | ) |
|
|
inlinestatic |
◆ isq()
◆ mod2pi()
static double mod2pi |
( |
double |
vin | ) |
|
|
inlinestatic |
◆ mod2pi_positive()
static double mod2pi_positive |
( |
double |
vin | ) |
|
|
inlinestatic |
◆ mod2pi_ref()
static double mod2pi_ref |
( |
double |
ref, |
|
|
double |
vin |
|
) |
| |
|
inlinestatic |
Return vin such that it is within PI degrees of ref
Definition at line 124 of file math_util.h.
◆ mod360()
static double mod360 |
( |
double |
vin | ) |
|
|
inlinestatic |
◆ mod360_positive()
static double mod360_positive |
( |
double |
vin | ) |
|
|
inlinestatic |
◆ mod_positive()
static int mod_positive |
( |
int |
vin, |
|
|
int |
mod |
|
) |
| |
|
inlinestatic |
◆ randf()
◆ sgn()
static double sgn |
( |
double |
v | ) |
|
|
inlinestatic |
◆ signed_randf()
static float signed_randf |
( |
| ) |
|
|
inlinestatic |
◆ sq()
static double sq |
( |
double |
v | ) |
|
|
inlinestatic |
◆ theta_to_int()
static int theta_to_int |
( |
double |
theta, |
|
|
int |
max |
|
) |
| |
|
inlinestatic |