9 #ifndef _TurtleBrains_Math_h_
10 #define _TurtleBrains_Math_h_
12 #include "tb_constants.h"
29 inline bool IsEqual(
const float leftValue,
const float rightValue,
const float tolerance = tbMath::kTolerance)
31 return fabs(leftValue - rightValue) <= tolerance;
42 inline bool IsZero(
const float value,
const float tolerance = tbMath::kTolerance)
44 return (fabs(value)) <= tolerance;
55 template <
typename T> constexpr
const T&
Maximum(
const T& leftValue,
const T& rightValue) noexcept
57 return (leftValue < rightValue) ? rightValue : leftValue;
68 template <
typename T> constexpr
const T&
Minimum(
const T& leftValue,
const T& rightValue) noexcept
70 return (leftValue < rightValue) ? leftValue : rightValue;
85 template <
typename T> constexpr
const T&
Clamp(
const T& value,
const T& minimumValue,
const T& maximumValue) noexcept
87 return (value < minimumValue) ? minimumValue : (maximumValue < value) ? maximumValue : value;
Contains objects and functions for dealing with Vector and Matrix math.
Contains all functions, classes and helpers related to game/application development written by Tim "B...
Definition: tb_application_dialog.h:21
constexpr const T & Clamp(const T &value, const T &minimumValue, const T &maximumValue) noexcept
Definition: tb_math.h:85
bool IsZero(const float value, const float tolerance=tbMath::kTolerance)
Definition: tb_math.h:42
constexpr const T & Maximum(const T &leftValue, const T &rightValue) noexcept
Definition: tb_math.h:55
bool IsEqual(const float leftValue, const float rightValue, const float tolerance=tbMath::kTolerance)
Definition: tb_math.h:29
constexpr const T & Minimum(const T &leftValue, const T &rightValue) noexcept
Definition: tb_math.h:68