Defines a range of values.
More...
#include <Lerp.h>
|
| template<typename U > |
| Range< U > | cast () const |
| | Cast this range to another one. More...
|
| |
| T | clamp (T iValue) const |
| | Clamp the value to this range. More...
|
| |
| bool | contains (T iValue) const |
| | This method assumes that fFrom and fTo are part of the range or another way to put it: More...
|
| |
| bool | isSingleValue () const |
| |
| template<typename U , typename TLerp = DPLerpXY<T, U>> |
| Range< U > | mapRange (Range< U > const &iRange) const |
| | Map this range to the other range. More...
|
| |
| template<typename U , typename TLerp = DPLerpXY<T, U>> |
| Range< U > | mapSubRange (Range< T > const &iSubRange, Range< U > const &iRange, bool iClampToRange=true) const |
| | Map a sub range of this range to the other range. More...
|
| |
| template<typename U , typename TLerp = DPLerpXY<T, U>> |
| U | mapValue (T iValue, Range< U > const &iRange, bool iClampToRange=true) const |
| | Map the value from this range into the provide range. More...
|
| |
| bool | operator!= (const Range &rhs) const |
| |
| bool | operator== (const Range &rhs) const |
| |
| | Range ()=default |
| |
| | Range (T iValue) noexcept |
| |
| | Range (T iFrom, T iTo) |
| |
template<typename T>
struct pongasoft::Utils::Range< T >
Defines a range of values.
◆ value_type
Gives access to the type of elements in the range.
◆ Range() [1/3]
◆ Range() [2/3]
◆ Range() [3/3]
◆ cast()
Cast this range to another one.
◆ clamp()
| T clamp |
( |
T |
iValue | ) |
const |
|
inline |
Clamp the value to this range.
- Returns
- a value between
fFrom and fTo
◆ contains()
| bool contains |
( |
T |
iValue | ) |
const |
|
inline |
This method assumes that fFrom and fTo are part of the range or another way to put it:
range.contains(range.fFrom)
range.contains(range.fTo)
- Returns
true if the range contains the value
◆ isSingleValue()
| bool isSingleValue |
( |
| ) |
const |
|
inline |
◆ mapRange()
| Range<U> mapRange |
( |
Range< U > const & |
iRange | ) |
const |
|
inline |
Map this range to the other range.
- Parameters
-
| iRange | the range to map this range into |
- Returns
- the new range
◆ mapSubRange()
| Range<U> mapSubRange |
( |
Range< T > const & |
iSubRange, |
|
|
Range< U > const & |
iRange, |
|
|
bool |
iClampToRange = true |
|
) |
| const |
|
inline |
Map a sub range of this range to the other range.
- Parameters
-
| iSubRange | the sub-range of this range to use as source |
| iRange | the range to map iSubRange into |
| iClampToRange | determines whether iSubRange should first be clamped to this range |
- Returns
- the new range
- Todo:
- optimize by computing
TLerp only once
◆ mapValue()
| U mapValue |
( |
T |
iValue, |
|
|
Range< U > const & |
iRange, |
|
|
bool |
iClampToRange = true |
|
) |
| const |
|
inline |
Map the value from this range into the provide range.
- Parameters
-
| iValue | the value from this range [fFrom, fTo] |
| iRange | the range to map the iValue into |
| iClampToRange | determines whether iValue should first be clamped to this range |
- Returns
- the new value
◆ operator!=()
| bool operator!= |
( |
const Range< T > & |
rhs | ) |
const |
|
inline |
◆ operator==()
| bool operator== |
( |
const Range< T > & |
rhs | ) |
const |
|
inline |
◆ fFrom
◆ fTo
The documentation for this struct was generated from the following file: