#include <cstdlib>
#include <cmath>


Go to the source code of this file.
Namespaces | |
| namespace | math |
| Math related functions and classes. | |
Defines | |
| #define | COURNIA_MATHEMATICS_H 1 |
| #define | MATH_EPSILON 0.00001 |
| Precision error symbol. | |
Typedefs | |
| typedef float | real_t |
| Real number type. | |
Functions | |
| double | math::rand01 (void) |
| Returns a random number between 0.0 and 1.0. | |
| double | math::to_degrees (double x) |
| Converts radians to degrees. | |
| double | math::to_radians (double x) |
| Converts degrees to radians. | |
| bool | math::equals (double x, double y) |
| Precision aware equals. | |
| template<class T > | |
| void | math::swap (T &x, T &y) |
| Swaps x and y. | |
| double | math::sign (double x) |
| Finds the sign of x. | |
| bool | math::same_sign (double x, double y) |
| Checks if x and y share the same sign. | |
| bool | math::negative (double x) |
| Check if x is negative. | |
| bool | math::positive (double x) |
| Check if x is positive. | |
| float | math::angle_normalize_360 (float angle) |
| Returns a normalized angle [0,360). | |
| float | math::angle_normalize_180 (float angle) |
| Returns a normalized angle (-180,180]. | |
| float | math::angle_subtract (float a, float b) |
| Returns the difference of 2 angles. Result is in the range (-180,180]. | |
| template<class T > | |
| T | math::clamp (T value, T min, T max) |
| Clamp the value to the specified range. | |
Definition in file mathematics.h.
1.5.7.1