59#define BU_HIST_NULL ((struct bu_hist *)0)
64#define BU_CK_HIST(_p) BU_CKMAG(_p, BU_HIST_MAGIC, "struct bu_hist")
69#define BU_HIST_INIT(_hp) { \
70 (_hp)->magic = BU_HIST_MAGIC; \
71 (_hp)->hg_min = (_hp)->hg_max = (_hp)->hg_clumpsize = 0.0; \
72 (_hp)->hg_nsamples = (_hp)->hg_nbins = 0; \
73 (_hp)->hg_bins = NULL; \
80#define BU_HIST_INIT_ZERO {BU_HIST_MAGIC, 0.0, 0.0, 0.0, 0, 0, NULL}
86#define BU_HIST_IS_INITIALIZED(_hp) (((struct bu_hist *)(_hp) != BU_HIST_NULL) && LIKELY((_hp)->magic == BU_HIST_MAGIC))
88#define BU_HIST_TALLY(_hp, _val) { \
89 if ((_val) <= (_hp)->hg_min) { \
90 (_hp)->hg_bins[0]++; \
91 } else if ((_val) >= (_hp)->hg_max) { \
92 (_hp)->hg_bins[(_hp)->hg_nbins]++; \
94 (_hp)->hg_bins[(int)(((_val)-(_hp)->hg_min)/(_hp)->hg_clumpsize)]++; \
96 (_hp)->hg_nsamples++; }
98#define BU_HIST_TALLY_MULTIPLE(_hp, _val, _count) { \
99 int __count = (_count); \
100 if ((_val) <= (_hp)->hg_min) { \
101 (_hp)->hg_bins[0] += __count; \
102 } else if ((_val) >= (_hp)->hg_max) { \
103 (_hp)->hg_bins[(_hp)->hg_nbins] += __count; \
105 (_hp)->hg_bins[(int)(((_val)-(_hp)->hg_min)/(_hp)->hg_clumpsize)] += __count; \
107 (_hp)->hg_nsamples += __count; }
Header file for the BRL-CAD common definitions.
void bu_hist_range(struct bu_hist *hp, fastf_t low, fastf_t high)
void bu_hist_pr(const struct bu_hist *histp, const char *title)
void bu_hist_free(struct bu_hist *histp)
void bu_hist_init(struct bu_hist *histp, fastf_t min, fastf_t max, size_t nbins)
void int char int int double * min
double fastf_t
fastest 64-bit (or larger) floating point type
Global registry of recognized magic numbers.
fundamental vector, matrix, quaternion math macros