62#define BN_RAND_TABSIZE 4096
63#define BN_RAND_TABMASK 0xfff
64#define BN_RANDSEED(_i, _seed) _i = ((unsigned)_seed) % BN_RAND_TABSIZE
77#define BN_RANDOM(_i) bn_rand_table[ _i = (_i+1) % BN_RAND_TABSIZE ]
80#define BN_RANDHALF(_i) (bn_rand_table[ _i = (_i+1) % BN_RAND_TABSIZE ]-0.5)
81#define BN_RANDHALF_INIT(_p) _p = bn_rand_table
83#define BN_RANDHALFTABSIZE 16535
101#define bn_rand_half(_p) \
102 ((++(_p) >= &bn_rand_halftab[bn_randhalftabsize] || \
103 (_p) < bn_rand_halftab) ? \
104 *((_p) = bn_rand_halftab) : *(_p))
114#define bn_rand_init(_p, _seed) \
115 (_p) = &bn_rand_halftab[ \
117 (bn_rand_halftab[(_seed)%bn_randhalftabsize] + 0.5) * \
118 (bn_randhalftabsize-1)) ]
127#define bn_rand0to1(_q) (bn_rand_half(_q)+0.5)
129#define BN_SINTABSIZE 2048
131#define bn_tab_sin(_a) (((_a) > 0) ? \
132 (bn_sin_table[(int)((0.5+ (_a)*(BN_SINTABSIZE / M_2PI)))&(BN_SINTABSIZE-1)]) :\
133 (-bn_sin_table[(int)((0.5- (_a)*(BN_SINTABSIZE / M_2PI)))&(BN_SINTABSIZE-1)]))
Header file for the BRL-CAD common definitions.
void bn_mathtab_constant(void)
For benchmarking purposes, make the random number table predictable. Setting to all zeros keeps dithe...
#define BN_RANDHALFTABSIZE
float bn_rand_halftab[BN_RANDHALFTABSIZE]
const float bn_sin_table[BN_SINTABSIZE]
const float bn_rand_table[BN_RAND_TABSIZE]
void bn_rand_sph_sample(point_t sample, const point_t center, const fastf_t radius)
Generate a sample point on a sphere per Marsaglia (1972).
double fastf_t
fastest 64-bit (or larger) floating point type
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
fundamental vector, matrix, quaternion math macros