|
Defines |
#define | PI 3.14159265358979323846 |
| defines pi with 20 decimals
|
#define | verbose 1 |
| prints debugging info to stdout
|
#define | DEBUG if (verbose) printf |
#define | GLERROR |
#define | AND && |
#define | OR || |
#define | NOT ! |
#define | MAX(a, b) ((a)>(b) ? (a) : (b)) |
| MAX returns the greatest of two scalars.
|
#define | MIN(a, b) ((a)<(b) ? (a) : (b)) |
| MIN returns the smallest of two scalars.
|
#define | IMAX(a, b) ((a)>(b) ? (0) : (1)) |
| as MAX returns the greatest of two scalars, IMAX tells which one is greater
|
#define | IMIN(a, b) ((a)<(b) ? (0) : (1)) |
| as MIN returns the smallest of two scalars, IMIN tells which one is smaller
|
#define | ABS(a) ((a)>=0 ? (a) : (-(a))) |
| absolute value of scalar
|
#define | TEST_BIT(x, b) (((x) & (1<<(b))) != 0 ) |
#define | SET_BIT(x, b) ((x) |= (1 << (b))) |
#define | CLEAR_BIT(x, b) ((x) &= ~(1 << (b))) |
#define | TOGGLE_BIT(x, b) ((TEST_BIT(x,b))?(CLEAR_BIT(x,b)):(SET_BIT(x,b))) |
#define | flushout fflush(stdout) |
| flushes the stdout output stream
|
#define | flusherr fflush(stderr) |
| flushes the stderr output stream
|
#define | randf() ((float) rand() / (float)RAND_MAX ) |
#define | SIGN(x) ((x)>=0 ? 1 : -1) |
| gets the sign of a number
|
#define | DEG2RAD(x) ((x)/180.0*pi) |
| conversion from degrees to radians
|
#define | RAD2DEG(x) ((x)/pi*180.0) |
| conversion from radians to degrees
|
#define | CLAMP(x, lo, hi) {if ((x) < (lo)) {(x)=(lo);} else if((x) > (hi)){(x)=(hi);}} |
| clamps a value to some fixed interval
|