#include <pg_math.h>
Static Public Member Functions | |
| template<class T > | |
| static T | abs (T x) |
| Returns the absolute value of a value. | |
| template<class T > | |
| static T | min (T a, T b) |
| Returns the minimum of two values. | |
| template<class T > | |
| static T | max (T a, T b) |
| Returns the maximum of two values. | |
| template<class T > | |
| static T | clamp (T x, T min, T max) |
| Returns the clamped value between two thresholds. | |
| static r32 | sqrt (r32 x) |
| Returns the square root of a value. | |
| static r32 | sin_r32 (r32 deg) |
| Returns the trigonometric sine of an r32 angle. | |
| static r32 | cos_r32 (r32 deg) |
| Returns the trigonometric cosine of an r32 angle. | |
| static r32 | sin_s32 (s32 deg) |
| Returns the trigonometric sine of an s32 angle. | |
| static r32 | cos_s32 (s32 deg) |
| Returns the trigonometric cosine of an s32 angle. | |
| static r32 | asin (r32 x) |
| Returns the arc sine of a value. | |
| static r32 | acos (r32 x) |
| Returns the arc cosine of a value. | |
| static r32 | atan2 (r32 y, r32 x) |
| Returns the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value. | |
| static void | srand (u32 seed) |
| Sets the seed of the random number generator. | |
| static s32 | rand (s32 from, s32 to) |
| Returns a pseudo-random number between two specified values. | |
| static r32 | rand (r32 from, r32 to, r32 interval) |
| Returns a pseudo-random number between two specified values with the specified interval. | |
| static r32 | interp (r32 from, r32 to, r32 ratio) |
| Returns the interpolated value between two values by the specified ratio. | |
Static Public Attributes | |
| static const r32 | EPSILON |
| If the difference of two numbers is less than this value, two numbers are considered equal. | |
| static const r32 | PI |
| Pi. | |
| static const r32 | DEG_TO_RAD |
| Is equal to Pi/180. | |
| static const r32 | RAD_TO_DEG |
| Is equal to 180/Pi. | |
| static T pgMath::abs | ( | T | x | ) | [inline, static] |
Returns the absolute value of a value.
| T | The type of a value. |
| [in] | x | A value. |
| static r32 pgMath::acos | ( | r32 | x | ) | [static] |
Returns the arc cosine of a value.
| [in] | x | A value. |
| static r32 pgMath::asin | ( | r32 | x | ) | [static] |
Returns the arc sine of a value.
| [in] | x | A value. |
| static r32 pgMath::atan2 | ( | r32 | y, | |
| r32 | x | |||
| ) | [static] |
Returns the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value.
| [in] | y | The y-coordinate. |
| [in] | x | The x-coordinate. |
| static T pgMath::clamp | ( | T | x, | |
| T | min, | |||
| T | max | |||
| ) | [inline, static] |
Returns the clamped value between two thresholds.
| T | The type of a value and thresholds. |
| [in] | x | A value. |
| [in] | min | The lower clamp threshold. |
| [in] | max | The upper clamp threshold. |
| static r32 pgMath::cos_r32 | ( | r32 | deg | ) | [static] |
Returns the trigonometric cosine of an r32 angle.
| [in] | deg | An r32 angle in degrees. |
| static r32 pgMath::cos_s32 | ( | s32 | deg | ) | [static] |
Returns the trigonometric cosine of an s32 angle.
This method allows only an s32 type as an angle, but is faster than its r32 version.
| [in] | deg | An s32 angle in degrees. |
| static r32 pgMath::interp | ( | r32 | from, | |
| r32 | to, | |||
| r32 | ratio | |||
| ) | [static] |
Returns the interpolated value between two values by the specified ratio.
| [in] | from | The source value. |
| [in] | to | The destination value. |
| [in] | ratio | The value which indicates how far to interpolate between two values. This value is clamped between 0.0f and 1.0f. |
| static T pgMath::max | ( | T | a, | |
| T | b | |||
| ) | [inline, static] |
Returns the maximum of two values.
| T | The type of two values. |
| [in] | a | A value. |
| [in] | b | An another value. |
| static T pgMath::min | ( | T | a, | |
| T | b | |||
| ) | [inline, static] |
Returns the minimum of two values.
| T | The type of two values. |
| [in] | a | A value. |
| [in] | b | An another value. |
| static r32 pgMath::rand | ( | r32 | from, | |
| r32 | to, | |||
| r32 | interval | |||
| ) | [static] |
Returns a pseudo-random number between two specified values with the specified interval.
| [in] | from | A range of the generated numbers. |
| [in] | to | An another range of the generated numbers. This value may be changed depending on the specified interval. |
| [in] | interval | The interval of the generated numbers. |
| static s32 pgMath::rand | ( | s32 | from, | |
| s32 | to | |||
| ) | [static] |
Returns a pseudo-random number between two specified values.
| [in] | from | A range of the generated numbers. |
| [in] | to | An another range of the generated numbers. |
| static r32 pgMath::sin_r32 | ( | r32 | deg | ) | [static] |
Returns the trigonometric sine of an r32 angle.
| [in] | deg | An r32 angle in degrees. |
| static r32 pgMath::sin_s32 | ( | s32 | deg | ) | [static] |
Returns the trigonometric sine of an s32 angle.
This method allows only an s32 type as an angle, but is faster than its r32 version.
| [in] | deg | An s32 angle in degrees. |
| static r32 pgMath::sqrt | ( | r32 | x | ) | [static] |
Returns the square root of a value.
| [in] | x | A value. This value must be greater than or equal to zero. |
| static void pgMath::srand | ( | u32 | seed | ) | [static] |
Sets the seed of the random number generator.
| [in] | seed | The initial seed. |
const r32 pgMath::DEG_TO_RAD [static] |
Is equal to Pi/180.
const r32 pgMath::EPSILON [static] |
If the difference of two numbers is less than this value, two numbers are considered equal.
const r32 pgMath::PI [static] |
Pi.
const r32 pgMath::RAD_TO_DEG [static] |
Is equal to 180/Pi.
1.5.8