Namespace providing mathematical constants and utility functions.
More...
|
float | ToRad (float degrees) |
| Converts degrees to radians.
|
|
float | ToDeg (float radians) |
| Converts radians to degrees.
|
|
bool | NearZero (float val, float epsilon=0.001f) |
| Checks if a float value is near zero within a small epsilon range.
|
|
template<typename T> |
T | Max (const T &a, const T &b) |
| Returns the maximum of two values.
|
|
template<typename T> |
T | Min (const T &a, const T &b) |
| Returns the minimum of two values.
|
|
template<typename T> |
T | Clamp (const T &val, const T &lower, const T &upper) |
| Clamps a value between a lower and upper bound.
|
|
float | Abs (float val) |
| Returns the absolute value of a float.
|
|
float | Cos (float angle) |
| Computes the cosine of an angle (in radians).
|
|
float | Sin (float angle) |
| Computes the sine of an angle (in radians).
|
|
float | Tan (float angle) |
| Computes the tangent of an angle (in radians).
|
|
float | ACos (float angle) |
| Computes the arccosine of a value.
|
|
float | ATan2 (float opposite, float adjacent) |
| Computes the arctangent of y/x using signs to determine the correct quadrant.
|
|
float | Cot (float angle) |
| Computes the cotangent of an angle (in radians).
|
|
float | Lerp (float a, float b, float t) |
| Performs linear interpolation between two values.
|
|
float | Sqrt (float val) |
| Computes the square root of a value.
|
|
float | Fmod (float numer, float denom) |
| Computes the floating-point remainder of division.
|
|
int | Round (float val) |
| Rounds a float to the nearest integer.
|
|
Namespace providing mathematical constants and utility functions.
◆ Abs()
float Maths::Abs |
( |
float | val | ) |
|
|
inline |
Returns the absolute value of a float.
- Parameters
-
- Returns
- Absolute value.
◆ ACos()
float Maths::ACos |
( |
float | angle | ) |
|
|
inline |
Computes the arccosine of a value.
- Parameters
-
angle | Value in range [-1, 1]. |
- Returns
- Arccosine in radians.
◆ ATan2()
float Maths::ATan2 |
( |
float | opposite, |
|
|
float | adjacent ) |
|
inline |
Computes the arctangent of y/x using signs to determine the correct quadrant.
- Parameters
-
opposite | Opposite side length (y). |
adjacent | Adjacent side length (x). |
- Returns
- Arctangent in radians.
◆ Clamp()
template<typename T>
T Maths::Clamp |
( |
const T & | val, |
|
|
const T & | lower, |
|
|
const T & | upper ) |
Clamps a value between a lower and upper bound.
- Template Parameters
-
- Parameters
-
val | The value to clamp. |
lower | Lower bound. |
upper | Upper bound. |
- Returns
- Clamped value.
◆ Cos()
float Maths::Cos |
( |
float | angle | ) |
|
|
inline |
Computes the cosine of an angle (in radians).
- Parameters
-
- Returns
- Cosine of the angle.
◆ Cot()
float Maths::Cot |
( |
float | angle | ) |
|
|
inline |
Computes the cotangent of an angle (in radians).
- Parameters
-
- Returns
- Cotangent of the angle.
◆ Fmod()
float Maths::Fmod |
( |
float | numer, |
|
|
float | denom ) |
|
inline |
Computes the floating-point remainder of division.
- Parameters
-
numer | Numerator. |
denom | Denominator. |
- Returns
- Remainder after division.
◆ Lerp()
float Maths::Lerp |
( |
float | a, |
|
|
float | b, |
|
|
float | t ) |
|
inline |
Performs linear interpolation between two values.
- Parameters
-
a | Start value. |
b | End value. |
t | Interpolation factor (typically in range [0, 1]). |
- Returns
- Interpolated value.
◆ Max()
template<typename T>
T Maths::Max |
( |
const T & | a, |
|
|
const T & | b ) |
Returns the maximum of two values.
- Template Parameters
-
T | Type of values to compare. |
- Parameters
-
a | First value. |
b | Second value. |
- Returns
- The greater of a and b.
◆ Min()
template<typename T>
T Maths::Min |
( |
const T & | a, |
|
|
const T & | b ) |
Returns the minimum of two values.
- Template Parameters
-
T | Type of values to compare. |
- Parameters
-
a | First value. |
b | Second value. |
- Returns
- The lesser of a and b.
◆ NearZero()
bool Maths::NearZero |
( |
float | val, |
|
|
float | epsilon = 0.001f ) |
|
inline |
Checks if a float value is near zero within a small epsilon range.
- Parameters
-
val | The value to check. |
epsilon | Threshold to consider zero (default: 0.001f). |
- Returns
- True if value is near zero, false otherwise.
◆ Round()
int Maths::Round |
( |
float | val | ) |
|
|
inline |
Rounds a float to the nearest integer.
- Parameters
-
- Returns
- Rounded integer.
◆ Sin()
float Maths::Sin |
( |
float | angle | ) |
|
|
inline |
Computes the sine of an angle (in radians).
- Parameters
-
- Returns
- Sine of the angle.
◆ Sqrt()
float Maths::Sqrt |
( |
float | val | ) |
|
|
inline |
Computes the square root of a value.
- Parameters
-
- Returns
- Square root of the input.
◆ Tan()
float Maths::Tan |
( |
float | angle | ) |
|
|
inline |
Computes the tangent of an angle (in radians).
- Parameters
-
- Returns
- Tangent of the angle.
◆ ToDeg()
float Maths::ToDeg |
( |
float | radians | ) |
|
|
inline |
Converts radians to degrees.
- Parameters
-
- Returns
- Angle in degrees.
◆ ToRad()
float Maths::ToRad |
( |
float | degrees | ) |
|
|
inline |
Converts degrees to radians.
- Parameters
-
- Returns
- Angle in radians.
◆ INFINITY_NEG
◆ INFINITY_POS
const float Maths::INFINITY_POS = std::numeric_limits<float>::infinity() |
◆ PI
const float Maths::PI = 3.1415926535f |
◆ PI_HALVED
const float Maths::PI_HALVED = PI / 2.0f |
◆ TWO_PI
const float Maths::TWO_PI = PI * 2.0f |