9 #ifndef _TurtleBrains_Math_h_
10 #define _TurtleBrains_Math_h_
12 #include "tb_constants.h"
28 inline bool IsEqual(
const float leftValue,
const float rightValue,
const float tolerance = tbMath::kTolerance)
30 return fabs(leftValue - rightValue) <= tolerance;
41 inline bool IsZero(
const float value,
const float tolerance = tbMath::kTolerance)
43 return (fabs(value)) <= tolerance;
54 template <
typename T>
const T&
Maximum(
const T& leftValue,
const T& rightValue)
56 return (leftValue < rightValue) ? rightValue : leftValue;
67 template <
typename T>
const T&
Minimum(
const T& leftValue,
const T& rightValue)
69 return (leftValue < rightValue) ? leftValue : rightValue;
84 template <
typename T>
const T&
Clamp(
const T& value,
const T& minimumValue,
const T& maximumValue)
86 if (value < minimumValue)
return minimumValue;
87 if (maximumValue < value)
return maximumValue;
Contains objects and functions for dealing with Vector and Matrix math.
const T & Clamp(const T &value, const T &minimumValue, const T &maximumValue)
Definition: tb_math.h:84
Contains all functions, classes and helpers related to game/application development written by Tim "B...
Definition: tb_application_dialog.h:21
const T & Maximum(const T &leftValue, const T &rightValue)
Definition: tb_math.h:54
bool IsZero(const float value, const float tolerance=tbMath::kTolerance)
Definition: tb_math.h:41
bool IsEqual(const float leftValue, const float rightValue, const float tolerance=tbMath::kTolerance)
Definition: tb_math.h:28
const T & Minimum(const T &leftValue, const T &rightValue)
Definition: tb_math.h:67