Provides commonly used floating point functions and constants.
More...
#include <MathUtil.h>
|
| static float | Lerp (float start, float end, float value) |
| | Linearly interpolate between two values. More...
|
| |
| static int | GetRandomInt (const int min=0, const int max=RAND_MAX) |
| | Get a random integer. More...
|
| |
| static float | GetRandomFloat () |
| | Get a random number between zero and one. More...
|
| |
| static float | Min (const float value1, const float value2) |
| | Get the lessor of two numbers. More...
|
| |
| static float | Max (const float value1, const float value2) |
| | Get the greator of two numbers. More...
|
| |
| static float | Abs (const float value) |
| | Get the absolute value of a number. More...
|
| |
| static float | Clamp (const float min, const float max, const float value) |
| | Restricts a value to be within a specified range. More...
|
| |
| static float | ToRadians (const float degrees) |
| | Converts degrees to radians. More...
|
| |
| static float | ToDegrees (const float radians) |
| | Converts radians to degrees. More...
|
| |
|
|
static const float | PI = 3.14159265359f |
| | Represents the value of pi.
|
| |
|
static const float | PI_OVER2 = Math::PI / 2 |
| | Represents the value of pi divided by two.
|
| |
|
static const float | PI_OVER4 = Math::PI / 4 |
| | Represents the value of pi divided by four.
|
| |
|
static const float | INVERSE_PI = 1.0f / Math::PI |
| | Represents the value of one divided by pi.
|
| |
|
static const float | NORMALIZE_PI_OVER4 = 0.70710678119f |
| | Represents the value of each component in a pi/4 unit vector.
|
| |
|
static const float | INVERSE_180 = 1.0f / 180 |
| | Represents the value of one divided by 180.
|
| |
Provides commonly used floating point functions and constants.
◆ Abs()
| float KatanaEngine::Math::Abs |
( |
const float |
value | ) |
|
|
static |
Get the absolute value of a number.
- Parameters
-
| value | The positive or negative value. |
- Returns
- Returns the absolute value.
◆ Clamp()
| float KatanaEngine::Math::Clamp |
( |
const float |
min, |
|
|
const float |
max, |
|
|
const float |
value |
|
) |
| |
|
static |
Restricts a value to be within a specified range.
- Parameters
-
| min | The minimum value. If value is less than min, min will be returned. |
| max | The maximum value. If value is greater than max, max will be returned. |
| value | The value to clamp. |
- Returns
- Returns the clamped value between min and max.
◆ GetRandomFloat()
| static float KatanaEngine::Math::GetRandomFloat |
( |
| ) |
|
|
inlinestatic |
Get a random number between zero and one.
- Returns
- Returns a random floating point number between zero and one.
◆ GetRandomInt()
| int KatanaEngine::Math::GetRandomInt |
( |
const int |
min = 0, |
|
|
const int |
max = RAND_MAX |
|
) |
| |
|
static |
Get a random integer.
- Parameters
-
| min | The inclusive minimum number. |
| max | The inclusive maximum number. |
- Returns
- Returns a random integer between min and max.
◆ Lerp()
| float KatanaEngine::Math::Lerp |
( |
float |
start, |
|
|
float |
end, |
|
|
float |
value |
|
) |
| |
|
static |
Linearly interpolate between two values.
- Parameters
-
| start | The result when the value is zero. |
| end | The result when the value is one. |
| value | A value between 0 and 1 that will indicate the resulting weight between start and end. |
- Returns
- Returns the interpolated value between start and end.
◆ Max()
| float KatanaEngine::Math::Max |
( |
const float |
value1, |
|
|
const float |
value2 |
|
) |
| |
|
static |
Get the greator of two numbers.
- Parameters
-
| value1 | The first value. |
| value2 | The second value. |
- Returns
- Returns the greator number between two values.
◆ Min()
| float KatanaEngine::Math::Min |
( |
const float |
value1, |
|
|
const float |
value2 |
|
) |
| |
|
static |
Get the lessor of two numbers.
- Parameters
-
| value1 | The first value. |
| value2 | The second value. |
- Returns
- Returns the lessor number between two values.
◆ ToDegrees()
| static float KatanaEngine::Math::ToDegrees |
( |
const float |
radians | ) |
|
|
inlinestatic |
Converts radians to degrees.
- Parameters
-
| radians | The angle in radians. |
- Returns
- Returns the angle in degrees.
◆ ToRadians()
| static float KatanaEngine::Math::ToRadians |
( |
const float |
degrees | ) |
|
|
inlinestatic |
Converts degrees to radians.
- Parameters
-
| degrees | The angle in degrees. |
- Returns
- Returns the angle in radians.
The documentation for this class was generated from the following files: