header file for math utilities
More...
#include <math.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
Go to the source code of this file.
#define | PI 3.14159265358979323846264338 |
|
#define | to_radians(x) ( (x) * (PI / 180.0 )) |
|
#define | to_degrees(x) ( (x) * (180.0 / M_PI )) |
|
#define | TWOPI_INV (0.5/PI) |
|
#define | TWOPI (2*PI) |
|
static double | sq (double v) |
|
static double | sgn (double v) |
|
static float | randf () |
|
static float | signed_randf () |
|
static int | irand (int bound) |
|
static double | mod2pi_positive (double vin) |
|
static double | mod2pi (double vin) |
|
static double | mod2pi_ref (double ref, double vin) |
|
static int | theta_to_int (double theta, int max) |
|
static int | imin (int a, int b) |
|
static int | imax (int a, int b) |
|
static int64_t | imin64 (int64_t a, int64_t b) |
|
static int64_t | imax64 (int64_t a, int64_t b) |
|
static int | iclamp (int v, int minv, int maxv) |
|
static double | fclamp (double v, double minv, double maxv) |
|
header file for math utilities
Definition in file math_util.h.
#define PI 3.14159265358979323846264338 |
#define to_degrees |
( |
|
x | ) |
( (x) * (180.0 / M_PI )) |
#define to_radians |
( |
|
x | ) |
( (x) * (PI / 180.0 )) |
#define TWOPI_INV (0.5/PI) |
static double fclamp |
( |
double |
v, |
|
|
double |
minv, |
|
|
double |
maxv |
|
) |
| |
|
inlinestatic |
static int iclamp |
( |
int |
v, |
|
|
int |
minv, |
|
|
int |
maxv |
|
) |
| |
|
inlinestatic |
static int imax |
( |
int |
a, |
|
|
int |
b |
|
) |
| |
|
inlinestatic |
static int64_t imax64 |
( |
int64_t |
a, |
|
|
int64_t |
b |
|
) |
| |
|
inlinestatic |
static int imin |
( |
int |
a, |
|
|
int |
b |
|
) |
| |
|
inlinestatic |
static int64_t imin64 |
( |
int64_t |
a, |
|
|
int64_t |
b |
|
) |
| |
|
inlinestatic |
static int irand |
( |
int |
bound | ) |
|
|
inlinestatic |
static double mod2pi |
( |
double |
vin | ) |
|
|
inlinestatic |
static double mod2pi_positive |
( |
double |
vin | ) |
|
|
inlinestatic |
static double mod2pi_ref |
( |
double |
ref, |
|
|
double |
vin |
|
) |
| |
|
inlinestatic |
Return vin such that it is within PI degrees of ref
Definition at line 100 of file math_util.h.
static double sgn |
( |
double |
v | ) |
|
|
inlinestatic |
static float signed_randf |
( |
| ) |
|
|
inlinestatic |
static double sq |
( |
double |
v | ) |
|
|
inlinestatic |
static int theta_to_int |
( |
double |
theta, |
|
|
int |
max |
|
) |
| |
|
inlinestatic |