Utilities
Utilities header only library
utils::Interval Class Reference

Holds float interval and performs operations on it. More...

Public Member Functions

 Interval ()
 Creates a default interval <0,1>.
 
 Interval (const float a, const float b, const float epsilon)
 Creates an interval <a,b> with custom numerical precision (epsilon).
 
 Interval (const float left, const float right)
 Creates an interval <a,b>.
 
bool operator== (const Interval &o) const
 Compares if two intervals are identical.
 
bool operator!= (const Interval &o) const
 Compares if two intervals are different.
 
float GetClamped (const float val) const
 Clamps a value to the interval endpoints.
 
float NormToValue (const float t) const
 Returns real value from the normalized interval parameter.
 
float ValueToNorm (const float val) const
 Returns normalized interval parameter from the real value.
 
float GetRange () const
 Returns a distance between interval endpoints.
 
bool IsEmpty () const
 Check whether the range of interval is zero.
 
float GetMin () const
 Returns value of a minimal endpoint of the interval.
 
float GetMax () const
 Returns value of a maximal endpoint of the interval.
 
float GetEpsilon () const
 Returns numerical precision of the interval.
 

Protected Attributes

float min_
 
float max_
 
float epsilon_
 

Detailed Description

Holds float interval and performs operations on it.