OpenVDB  12.0.0
Public Member Functions | List of all members
Histogram Class Reference

This class computes a histogram, with a fixed interval width, of a population of floating-point values. More...

#include <openvdb/math/Stats.h>

Public Member Functions

 Histogram (double min, double max, size_t numBins=10)
 Construct with given minimum and maximum values and the given bin count. More...
 
 Histogram (const Stats &s, size_t numBins=10)
 Construct with the given bin count and with minimum and maximum values taken from a Stats object. More...
 
bool add (double val, uint64_t n=1)
 Add n samples with constant value val, provided that the val falls within this histogram's value range. More...
 
bool add (const Histogram &other)
 Add all the contributions from the other histogram, provided that it has the same configuration as this histogram. More...
 
size_t numBins () const
 Return the number of bins in this histogram. More...
 
double min () const
 Return the lower bound of this histogram's value range. More...
 
double max () const
 Return the upper bound of this histogram's value range. More...
 
double min (int n) const
 Return the minimum value in the nth bin. More...
 
double max (int n) const
 Return the maximum value in the nth bin. More...
 
uint64_t count (int n) const
 Return the number of samples in the nth bin. More...
 
uint64_t size () const
 Return the population size, i.e., the total number of samples. More...
 
void print (const std::string &name="", std::ostream &strm=std::cout) const
 Print the histogram to the specified output stream. More...
 

Detailed Description

This class computes a histogram, with a fixed interval width, of a population of floating-point values.

Constructor & Destructor Documentation

Histogram ( double  min,
double  max,
size_t  numBins = 10 
)
inline

Construct with given minimum and maximum values and the given bin count.

Histogram ( const Stats s,
size_t  numBins = 10 
)
inline

Construct with the given bin count and with minimum and maximum values taken from a Stats object.

Member Function Documentation

bool add ( double  val,
uint64_t  n = 1 
)
inline

Add n samples with constant value val, provided that the val falls within this histogram's value range.

Returns
true if the sample value falls within this histogram's value range.
bool add ( const Histogram other)
inline

Add all the contributions from the other histogram, provided that it has the same configuration as this histogram.

uint64_t count ( int  n) const
inline

Return the number of samples in the nth bin.

double max ( ) const
inline

Return the upper bound of this histogram's value range.

double max ( int  n) const
inline

Return the maximum value in the nth bin.

double min ( ) const
inline

Return the lower bound of this histogram's value range.

double min ( int  n) const
inline

Return the minimum value in the nth bin.

size_t numBins ( ) const
inline

Return the number of bins in this histogram.

void print ( const std::string &  name = "",
std::ostream &  strm = std::cout 
) const
inline

Print the histogram to the specified output stream.

uint64_t size ( ) const
inline

Return the population size, i.e., the total number of samples.