33#include <NDEVR/BaseValues.h>
34#include <NDEVR/LibAssert.h>
66 template <
typename t_type>
67 constexpr t_type
getMin(
const t_type& left,
const t_type& right) {
return left < right ? left : right; }
68 template <
typename t_type>
69 constexpr t_type
getMin(
const t_type& left,
const t_type& middle,
const t_type& right) {
return getMin(
getMin(left, middle), right); }
115 template <
typename t_type>
116 constexpr t_type
getMax(
const t_type& left,
const t_type& right) {
return left > right ? left : right; }
117 template <
typename t_type>
118 constexpr t_type
getMax(
const t_type& left,
const t_type& middle,
const t_type& right) {
return getMax(
getMax(left, middle), right); }
158 template <
typename t_type>
178 template <
typename t_type>
179 constexpr t_type
sign(t_type value)
199 template<
class t_type>
200 constexpr bool isNaN(
const t_type& value)
208 return value != value;
214 return value != value;
239 template <
typename t_type>
240 constexpr t_type
clip(
const t_type& value,
const t_type& lower_bound,
const t_type& upper_bound)
242 lib_assert(
isNaN(lower_bound) ||
isNaN(upper_bound) || (lower_bound <= upper_bound),
"Invalid clip: upper bound is less than lower bound");
#define lib_assert(expression, message)
Asserts some logic in the code. Disabled in non debug mode by default. Can be re-enabled in release u...
Definition LibAssert.h:70
int32_t sint04
-Defines an alias representing a 4 byte, signed integer. -Can represent exact integer values -2147483...
Definition BaseValues.hpp:76
constexpr t_type getMax(const t_type &left, const t_type &right)
Finds the max of the given arguments using the > operator.
Definition BaseFunctions.hpp:116
int64_t sint08
-Defines an alias representing an 8 byte, signed integer -Can represent exact integer values -9223372...
Definition BaseValues.hpp:86
constexpr t_type clip(const t_type &value, const t_type &lower_bound, const t_type &upper_bound)
Clips the value given so that that the returned value falls between upper and lower bound.
Definition BaseFunctions.hpp:240
float fltp04
Defines an alias representing a 4 byte floating-point number.
Definition BaseValues.hpp:157
constexpr Vector< t_dims, Angle< t_angle_type > > quantize(const Vector< t_dims, Angle< t_angle_type > > &value, Angle< t_angle_type > d=Angle< t_angle_type >(DEGREES, 1.0))
Definition AngleFunctions.h:955
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
int8_t sint01
-Defines an alias representing a 1 byte, signed integer. -Can represent exact integer values -127 thr...
Definition BaseValues.hpp:56
int16_t sint02
-Defines an alias representing a 2 byte, signed integer. -Can represent exact integer values -32767 t...
Definition BaseValues.hpp:66
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer -Can represent exact integer values 0 thro...
Definition BaseValues.hpp:132
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:514
uint16_t uint02
-Defines an alias representing a 2 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:109
constexpr bool isNaN(const t_type &value)
Query if 'value' is valid or invalid.
Definition BaseFunctions.hpp:200
constexpr t_type sign(t_type value)
A simple function that returns 1 for all values greater than or equal to 0 and -1 for all values less...
Definition BaseFunctions.hpp:179
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181
constexpr t_type getMin(const t_type &left, const t_type &right)
Finds the minimum of the given arguments based on the < operator.
Definition BaseFunctions.hpp:67
Definition BaseValues.hpp:272