Class providing access to various standard math functions. More...
Trigonometric Functions | |
float | cos (float x) |
Compute cosine. | |
float | sin (float x) |
Compute sine. | |
float | tan (float x) |
Compute tangent. | |
float | acos (float x) |
Compute arc cosine. | |
float | asin (float x) |
Compute arc sine. | |
float | atan (float x) |
Compute arc tangent. | |
float | atan2 (float y, float x) |
Compute arc tangent with two parameters. |
Hyperbolic Functions | |
float | cosh (float x) |
Compute hyperbolic cosine. | |
float | sinh (float x) |
Compute hyperbolic sine. | |
float | tanh (float x) |
Compute hyperbolic tangent. |
Exponential and Logarithmic Functions | |
float | exp (float x) |
Compute exponential function. | |
float | log (float x) |
Compute natural logarithm. |
Power Functions | |
float | sqrt (float x) |
Compute square root. |
Rounding, Absolute Value and Remainder Functions | |
float | abs (float x) |
Compute absolute value. | |
float | ceil (float x) |
Round up value. | |
float | floor (float x) |
Round down value. | |
float | fmod (float numerator, float denominator) |
Compute remainder of division. |
Random Number Functions | |
int | rand () |
Generate random number. | |
int | rand (int lower, int upper) |
Generate random number. |
Conversion Functions | |
float | deg2rad (float x) |
Convert value from degrees to the radian equivalent. | |
float | rad2deg (float x) |
Convert value from radians to the equivalent value in degrees. |
Class providing access to various standard math functions.
This is mainly an indirection to the standard C math functions.
float Math::cos | ( | float | x | ) |
Compute cosine.
Returns the cosine of an angle of x radians.
x | Floating point value representing an angle expressed in radians. |
float Math::sin | ( | float | x | ) |
Compute sine.
Returns the sine of an angle of x radians.
x | Floating point value representing an angle expressed in radians. |
float Math::tan | ( | float | x | ) |
Compute tangent.
Returns the tangent of an angle of x radians.
x | Floating point value representing an angle expressed in radians. |
float Math::acos | ( | float | x | ) |
Compute arc cosine.
Returns the principal value of the arc cosine of x, expressed in radians. In trigonometrics, arc cosine is the inverse operation of cosine.
x | Floating point value in the interval [-1,+1]. |
float Math::asin | ( | float | x | ) |
Compute arc sine.
Returns the principal value of the arc sine of x, expressed in radians. In trigonometrics, arc sine is the inverse operation of sine.
x | Floating point value in the interval [-1,+1]. |
float Math::atan | ( | float | x | ) |
Compute arc tangent.
Returns the principal value of the arc tangent of x, expressed in radians. In trigonometrics, arc tangent is the inverse operation of tangent. Notice that because of the sign ambiguity, a function cannot determine with certainty in which quadrant the angle falls only by its tangent value. You can use atan2() if you need to determine the quadrant.
x | Floating point value. |
float Math::atan2 | ( | float | y, |
float | x | ||
) |
Compute arc tangent with two parameters.
Returns the principal value of the arc tangent of y/x, expressed in radians. To compute the value, the function uses the sign of both arguments to determine the quadrant.
y | Floating point value representing an y-coordinate. |
x | Floating point value representing an x-coordinate. |
float Math::cosh | ( | float | x | ) |
Compute hyperbolic cosine.
Returns the hyperbolic cosine of x.
x | Floating point value. |
float Math::sinh | ( | float | x | ) |
Compute hyperbolic sine.
Returns the hyperbolic sine of x.
x | Floating point value. |
float Math::tanh | ( | float | x | ) |
Compute hyperbolic tangent.
Returns the hyperbolic tangent of x.
x | Floating point value. |
float Math::exp | ( | float | x | ) |
Compute exponential function.
Returns the base-e exponential function of x, which is the e number raised to the power x.
x | Floating point value. |
float Math::log | ( | float | x | ) |
Compute natural logarithm.
Returns the natural logarithm of x. The natural logarithm is the base-e logarithm, the inverse of the natural exponential function (exp()).
x | Floating point value. |
float Math::sqrt | ( | float | x | ) |
Compute square root.
Returns the square root of x.
x | Floating point value. |
float Math::abs | ( | float | x | ) |
Compute absolute value.
Returns the absolute value of x (|x|)
x | Floating point value. |
float Math::ceil | ( | float | x | ) |
Round up value.
Returns the smallest integral value that is not less than x.
x | Floating point value. |
float Math::floor | ( | float | x | ) |
Round down value.
Returns the largest integral value that is not greater than x.
x | Floating point value. |
float Math::fmod | ( | float | numerator, |
float | denominator | ||
) |
Compute remainder of division.
Returns the floating-point remainder of numerator/denominator. The remainder of a division operation is the result of subtracting the integral quotient multiplied by the denominator from the numerator:
remainder = numerator - quotient * denominator
numerator | Floating point value with the division numerator. |
denominator | Floating point value with the division denominator. |
int Math::rand | ( | ) |
Generate random number.
Returns a pseudo-random integral number in the range 0 to RAND_MAX. RAND_MAX is a constant defined internally. Its default value may vary between implementations but it is granted to be at least 32767.
int Math::rand | ( | int | lower, |
int | upper | ||
) |
Generate random number.
Returns a pseudo-random integral number in the range lower to upper.
lower | Lower bound ofrange. |
upper | Upper bound of range. |
float Math::deg2rad | ( | float | x | ) |
Convert value from degrees to the radian equivalent.
x | Floating point value representing an angle expressed in degrees. |
float Math::rad2deg | ( | float | x | ) |
Convert value from radians to the equivalent value in degrees.
x | Floating point value representing an angle expressed in radians. |