Simox
2.3.74.0
|
The SoftMinMax class can be used to find soft min and max of a set of floats. More...
Public Member Functions | |
SoftMinMax () | |
No initialization constructor. More... | |
SoftMinMax (float percentile, std::size_t numValues) | |
Constructs a SoftMinMax for given percentile and number of values. More... | |
void | reset (float percentile, std::size_t numValues) |
void | add (float value) |
float | getSoftMin () const |
float | getSoftMax () const |
The SoftMinMax class can be used to find soft min and max of a set of floats.
Soft means that some values are allowed to be >= soft min / <= soft max (including the soft min/max), respectively. A percentile argument in [0..0.5] specifies the percentage of values which are allowed to excess the soft min/max.
simox::math::SoftMinMax::SoftMinMax | ( | ) |
No initialization constructor.
simox::math::SoftMinMax::SoftMinMax | ( | float | percentile, |
std::size_t | numValues | ||
) |
Constructs a SoftMinMax for given percentile and number of values.
percentile | The percentage of values that may excess the soft min/max. Must be in [0..0.5]. |
numValues | the total number of values that will be added. Must be > 0. |
<tt>std::invalid_argument</tt> | If one of the parameters value does not meet the requirements |
void simox::math::SoftMinMax::add | ( | float | value | ) |
Add a value to the considered collection.
float simox::math::SoftMinMax::getSoftMax | ( | ) | const |
Get the current soft max.
<tt>std::out_of_range</tt> | If no element was added. |
float simox::math::SoftMinMax::getSoftMin | ( | ) | const |
Get the current soft min.
<tt>std::out_of_range</tt> | If no element was added. |
void simox::math::SoftMinMax::reset | ( | float | percentile, |
std::size_t | numValues | ||
) |
Reinitializes the SoftMinMax with the given arguments.
SoftMinMax()
<tt>std::invalid_argument</tt> | If one of the parameters value does not meet the requirements. |