Castor3D 0.16.0
Multiplatform 3D engine
Public Member Functions | List of all members
castor::Range< T > Class Template Reference

A range class. More...

#include <Range.hpp>

Inheritance diagram for castor::Range< T >:
Inheritance graph
[legend]

Public Member Functions

 Range (T const &min, T const &max) noexcept
 Constructor.
 
T const & clamp (T const &value) const noexcept
 Puts a value in the range.
 
bool has (T const &value) const noexcept
 
float percent (T const &value) const noexcept
 Gives the percentage matching the given value.
 
float invPercent (T const &value) const noexcept
 Gives the percentage matching the given value.
 
value (float const &percent) const noexcept
 Gives the value matching the given percentage.
 
invValue (float const &percent) const noexcept
 Gives the value matching the given percentage.
 
T const & getMin () const noexcept
 
T const & getMax () const noexcept
 

Detailed Description

template<typename T>
class castor::Range< T >

A range class.

Constructor & Destructor Documentation

◆ Range()

template<typename T >
castor::Range< T >::Range ( T const & min,
T const & max )
inlinenoexcept

Constructor.

Parameters
[in]min,maxThe range.

Member Function Documentation

◆ clamp()

template<typename T >
T const & castor::Range< T >::clamp ( T const & value) const
inlinenoexcept

Puts a value in the range.

Parameters
[in]valueThe value.
Returns
m_min if value is less than it.
m_max if value is greater than it.
value otherwise.

References castor::Range< T >::value().

Referenced by castor::Range< T >::percent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMax()

template<typename T >
T const & castor::Range< T >::getMax ( ) const
inlinenoexcept
Returns
The upper bound.

◆ getMin()

template<typename T >
T const & castor::Range< T >::getMin ( ) const
inlinenoexcept
Returns
The lower bound.

◆ has()

template<typename T >
bool castor::Range< T >::has ( T const & value) const
inlinenoexcept
Returns
true if value is inside the range.

References castor::Range< T >::value().

Here is the call graph for this function:

◆ invPercent()

template<typename T >
float castor::Range< T >::invPercent ( T const & value) const
inlinenoexcept

Gives the percentage matching the given value.

Parameters
[in]valueThe value.
Returns
1.0 if value <= m_min.
0.0 if value >= m_max.
A value from 0.0 to 1.0, depending on how close the value is from m_max or from m_min.

References castor::Range< T >::percent(), and castor::Range< T >::value().

Here is the call graph for this function:

◆ invValue()

template<typename T >
T castor::Range< T >::invValue ( float const & percent) const
inlinenoexcept

Gives the value matching the given percentage.

Parameters
[in]percentThe percentage.
Returns
m_max if percent <= 0.0.
m_min if percent >= 1.0.
A value between m_min and m_max.

References castor::Range< T >::percent().

Here is the call graph for this function:

◆ percent()

template<typename T >
float castor::Range< T >::percent ( T const & value) const
inlinenoexcept

Gives the percentage matching the given value.

Parameters
[in]valueThe value.
Returns
0.0 if value <= m_min.
1.0 if value >= m_max.
A value from 0.0 to 1.0, depending on how close the value is from m_min or from m_max.

References castor::Range< T >::clamp(), and castor::Range< T >::value().

Referenced by castor::Range< T >::invPercent(), castor::Range< T >::invValue(), and castor::Range< T >::value().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ value()

template<typename T >
T castor::Range< T >::value ( float const & percent) const
inlinenoexcept

Gives the value matching the given percentage.

Parameters
[in]percentThe percentage.
Returns
m_min if percent <= 0.0.
m_max if percent >= 1.0.
A value between m_min and m_max.

References castor::Range< T >::percent().

Referenced by castor::Range< T >::clamp(), castor::RangeSequenceT< T >::getRange(), castor::Range< T >::has(), castor::Range< T >::invPercent(), and castor::Range< T >::percent().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: