MathPlot
Public Member Functions | Public Attributes | List of all members
mpRange Struct Reference

Represents a numeric range with minimum and maximum values. More...

#include <mathplot.h>

Public Member Functions

 mpRange ()
 Default constructor.
 
 mpRange (double value1, double value2)
 Create range with the 2 values.
 
void Set (double _min, double _max)
 Set min, max function.
 
void Assign (double value1, double value2)
 Assign values to min and max.
 
bool IsSet ()
 Check if this mpRange has been assigned any values.
 
void Update (double value)
 Update range according new value: Expand the range to include the value. More...
 
void Update (double _min, double _max)
 Update range with new min and max values if this expand the range If _min < min then min = _min and if _max > max then max = _max.
 
void Update (mpRange range)
 Update range with new range values if this expand the range.
 
void Check (void)
 Check to always have a range. If min = max then introduce the 0 to make a range.
 
double Length (void) const
 Length of the range.
 
double GetCenter (void) const
 Center of the range.
 
double GetMaxAbs (void) const
 Returns max absolute value of the range.
 
void ToLog (void)
 Convert to log range.
 
bool PointIsInside (double point) const
 Return true if the point is inside the range (min and max included)
 
bool operator== (const mpRange &other) const
 
bool operator!= (const mpRange &other) const
 

Public Attributes

double min = 0.0f
 
double max = 0.0f
 

Detailed Description

Represents a numeric range with minimum and maximum values.

This struct holds a range defined by min and max values. It supports equality comparison using the default operator==.

Member Function Documentation

◆ Update()

void mpRange::Update ( double  value)
inline

Update range according new value: Expand the range to include the value.

If value < min then min = value and if value > max then max = value