Namespaces | |
filters | |
Classes | |
class | Random_ |
Typedefs | |
typedef boost::detail::thread::singleton< class Random_ > | Random |
Functions | |
static uint64_t | counter_with_overflow (uint64_t full_value, uint16_t new_value) |
static int | ipow (int base, int exp) |
static bool | is_bit_mask_index_false (int64_t bit_mask, int index) |
static bool | is_bit_mask_index_true (int64_t bit_mask, int index) |
static double | linear_interpolate_ (double x, double x0, double y0, double x1, double y1) |
static int | sign (double x) |
static double | to_degrees (double rad) |
static double | to_rad (double degrees) |
Variables | |
static const double | pi = 3.14159265 |
typedef boost::detail::thread::singleton<class Random_> sr_math_utils::Random |
This is the usable singleton of the Random class.
The typical usage for this class is: -> generate double betwen 0 and 1 sr_math_utils::Random::instance().generate<double>()
-> generate integer between 0 and 10 sr_math_utils::Random::instance().generate<int>(0, 10)
-> generate double betwen 0 and 10 sr_math_utils::Random::instance().generate<double>(0, 10)
Definition at line 334 of file sr_math_utils.hpp.
|
inlinestatic |
Increment a counter given a value which can overflow.
WARNING: only works if called often enough: if new_value > last_value but overflowed between the 2 calls, then we're not able to detect the overflow.
full_value | the full value (with no overflow) |
new_value | the new value we received from the motor. |
Definition at line 111 of file sr_math_utils.hpp.
|
inlinestatic |
Definition at line 67 of file sr_math_utils.hpp.
|
inlinestatic |
Definition at line 95 of file sr_math_utils.hpp.
|
inlinestatic |
Definition at line 83 of file sr_math_utils.hpp.
|
inlinestatic |
Interpolate linearly between the 2 points, for the given value
y = y0 + (x-x0)*((y1-y0)/(x1-x0))
x | the X value to compute the interpolation for. |
x0 | the X value of our first point |
y0 | the Y value of our first point |
x1 | the X value of our second point |
y1 | the Y value of our second point |
Definition at line 139 of file sr_math_utils.hpp.
|
inlinestatic |
Checks the sign of a given number.
x | the number we want to study. |
Definition at line 278 of file sr_math_utils.hpp.
|
inlinestatic |
Convert an angle in degrees to an angle in degrees.
rad | the value in radians. |
Definition at line 62 of file sr_math_utils.hpp.
|
inlinestatic |
Convert an angle in degrees to an angle in radians.
degrees | the value in degrees |
Definition at line 50 of file sr_math_utils.hpp.
|
static |
Definition at line 41 of file sr_math_utils.hpp.