A range of numeric values.
More...
#include <Range.h>
|
|
| Range () noexcept |
| Construct a range over all values of T. More...
|
|
| Range (const T _min, const T _max) noexcept |
|
| Range (const std::pair< T, T > &_bounds) noexcept |
|
|
T | Length () const noexcept |
| Compute the length of this range. More...
|
|
T | Center () const noexcept |
|
template<typename U > |
bool | Contains (const U &_val, const double _tolerance=1e-8) const noexcept |
|
template<typename U > |
T | Clearance (const U &_val) const noexcept |
|
template<typename U > |
T | ClearancePoint (const U &_val) const noexcept |
|
T | Sample () const noexcept |
| Sample the range for a random contained value with uniform probability. More...
|
|
bool | operator== (const Range< T > &_other) const |
| Checks for equality with another Range. More...
|
|
bool | operator< (const Range< T > &_other) const |
| This only for placing in sets. More...
|
|
|
void | Resize (const T _min, const T _max) noexcept |
|
void | Translate (const T _t) noexcept |
|
void | SetCenter (const T _t) noexcept |
|
void | ExpandToInclude (const T _t) noexcept |
|
template<typename T>
struct Range< T >
A range of numeric values.
◆ Range() [1/3]
Construct a range over all values of T.
◆ Range() [2/3]
Construct a bounded range.
- Parameters
-
_min | The lower bound. |
_max | The upper bound. |
◆ Range() [3/3]
template<typename T >
Range< T >::Range |
( |
const std::pair< T, T > & |
_bounds | ) |
|
|
inlinenoexcept |
Construct a bounded range.
- Parameters
-
_bounds | A pair of min, max values. |
◆ Center()
Compute the center of this range.
- Warning
- This will not be exact for integral types.
◆ Clearance()
template<typename T >
template<typename U >
T Range< T >::Clearance |
( |
const U & |
_val | ) |
const |
|
inlinenoexcept |
Test the clearance of a value. Clearance is defined as the minimum distance to a boundary value, and will be negative if the test value falls outside the range.
- Parameters
-
- Returns
- The distance of _val from the nearest endpoint.
◆ ClearancePoint()
template<typename T >
template<typename U >
T Range< T >::ClearancePoint |
( |
const U & |
_val | ) |
const |
|
inlinenoexcept |
Find the range endpoint that is closest to a target value.
- Parameters
-
- Returns
- The endpoint of this that is closest to _val.
◆ Contains()
template<typename T >
template<typename U >
bool Range< T >::Contains |
( |
const U & |
_val, |
|
|
const double |
_tolerance = 1e-8 |
|
) |
| const |
|
inlinenoexcept |
Test if a value is inside this range.
- Parameters
-
_val | The value to test. |
_tolerance | Tolerance to accommodate floating-point error, as a fraction of the min/max. |
- Returns
- True if the test value lies inside the range (or on the boundary for inclusive test).
◆ ExpandToInclude()
template<typename T >
void Range< T >::ExpandToInclude |
( |
const T |
_t | ) |
|
|
inlinenoexcept |
Expand the range to include a value.
- Parameters
-
_t | The new value to include. |
◆ Length()
Compute the length of this range.
◆ operator<()
template<typename T >
bool Range< T >::operator< |
( |
const Range< T > & |
_other | ) |
const |
|
inline |
This only for placing in sets.
◆ operator==()
template<typename T >
bool Range< T >::operator== |
( |
const Range< T > & |
_other | ) |
const |
|
inline |
Checks for equality with another Range.
◆ Resize()
template<typename T >
void Range< T >::Resize |
( |
const T |
_min, |
|
|
const T |
_max |
|
) |
| |
|
inlinenoexcept |
Resize the range.
- Parameters
-
_min | The new lower bound. |
_max | The new upper bound. |
◆ Sample()
Sample the range for a random contained value with uniform probability.
◆ SetCenter()
template<typename T >
void Range< T >::SetCenter |
( |
const T |
_t | ) |
|
|
inlinenoexcept |
Translate the range to a new center.
- Parameters
-
◆ Translate()
template<typename T >
void Range< T >::Translate |
( |
const T |
_t | ) |
|
|
inlinenoexcept |
Translate the range.
- Parameters
-
_t | The translation magnitude. |
◆ max
The upper bound on this range.
◆ min
The lower bound on this range.
The documentation for this struct was generated from the following file:
- /opt/actions-runner/_work/open-ppl/open-ppl/src/Geometry/Boundaries/Range.h