9 #ifndef TurtleBrains_Math_hpp
10 #define TurtleBrains_Math_hpp
12 #include <turtle_brains/core/tb_configuration.hpp>
13 #include <turtle_brains/math/tb_constants.hpp>
30 template<
typename Type>
bool IsEqual(
const Type& leftValue,
const Type& rightValue)
32 return leftValue == rightValue;
35 inline bool IsEqual(
const float leftValue,
const float rightValue,
const float tolerance = tbMath::kTolerance)
37 return fabsf(leftValue - rightValue) <= tolerance;
40 inline bool IsEqual(
const double leftValue,
const double rightValue,
const double tolerance = tbMath::kTolerance)
42 return fabs(leftValue - rightValue) <= tolerance;
53 template<
typename Type>
bool IsZero(
const Type& value)
58 inline bool IsZero(
const float value,
const float tolerance = tbMath::kTolerance)
60 return (fabsf(value)) <= tolerance;
63 inline bool IsZero(
const double value,
const double tolerance = tbMath::kTolerance)
65 return (fabs(value)) <= tolerance;
76 template <
typename T> constexpr
const T&
Maximum(
const T& leftValue,
const T& rightValue) noexcept
78 return (leftValue < rightValue) ? rightValue : leftValue;
89 template <
typename T> constexpr
const T&
Minimum(
const T& leftValue,
const T& rightValue) noexcept
91 return (leftValue < rightValue) ? leftValue : rightValue;
106 template <
typename T> constexpr
const T&
Clamp(
const T& value,
const T& minimumValue,
const T& maximumValue) noexcept
108 return (value < minimumValue) ? minimumValue : (maximumValue < value) ? maximumValue : value;
Contains objects and functions for dealing with Vector and Matrix math.
bool IsZero(const Type &value)
Definition: tb_math.hpp:53
Here is some information about the primary namespace.
Definition: tb_application_dialog.hpp:21
constexpr const T & Clamp(const T &value, const T &minimumValue, const T &maximumValue) noexcept
Definition: tb_math.hpp:106
bool IsEqual(const Type &leftValue, const Type &rightValue)
Definition: tb_math.hpp:30
constexpr const T & Maximum(const T &leftValue, const T &rightValue) noexcept
Definition: tb_math.hpp:76
constexpr const T & Minimum(const T &leftValue, const T &rightValue) noexcept
Definition: tb_math.hpp:89