Math functions. More...
#include "Robots/LoBot/util/range.hh"
#include <algorithm>
#include <limits>
#include <math.h>
Go to the source code of this file.
Classes | |
class | lobot::gaussian_weight< T > |
A function object to perform Gaussian weighting. More... | |
Functions | |
template<typename T > | |
int | lobot::sign (T t) |
The sign of a number. | |
template<typename T > | |
int | lobot::sign0 (T t) |
The sign of a number: -1 for -ve, 0 for zero, +1 for +ve. | |
template<typename T > | |
T | lobot::abs (T t) |
Absolute value for different numeric types. | |
template<typename T > | |
T | lobot::sqr (T t) |
Square of a number. | |
int | lobot::next_power_of_two (int n) |
Return the next power of two >= given number. | |
bool | lobot::is_zero (float t) |
Check if a floating point number is near zero. | |
bool | lobot::is_zero (double t) |
Check if a double precision floating point number is near zero. | |
int | lobot::round (float t) |
Round a floating-point number to the nearest integer. | |
template<typename T > | |
T | lobot::clamp (T value, T min, T max) |
Clamp a given value to the specified range. | |
template<typename T > | |
T | lobot::clamp (T value, const range< T > &R) |
Clamp a given value to the specified range. | |
template<typename T > | |
range< T > | lobot::clamp (const range< T > &input, const range< T > &bounds) |
Clamp the input range's min and max to the bounds range's min and max. | |
float | lobot::clamp_angle (float angle) |
Clamp an angle (specified in degrees) to lie in [0, 360]. | |
int | lobot::quadrant (float angle) |
Returns the quadrant to which the given angle belongs. | |
int | lobot::octant (float angle) |
int | lobot::random (int min, int max) |
float | lobot::randomf (float min, float max) |
float | lobot::gaussian (float x, float mu, float sigma) |
A function to evaluate the Gaussian. | |
float | lobot::sample_tri (float b) |
float | lobot::sin (float angle) |
Trig functions for degrees rather than radians. | |
double | lobot::sin (double angle) |
float | lobot::sin (int angle) |
float | lobot::cos (float angle) |
double | lobot::cos (double angle) |
float | lobot::cos (int angle) |
float | lobot::asin (float x) |
double | lobot::asin (double x) |
float | lobot::asin (int x) |
float | lobot::acos (float x) |
double | lobot::acos (double x) |
float | lobot::acos (int x) |
float | lobot::atan (float x) |
double | lobot::atan (double x) |
float | lobot::atan (int x) |
float | lobot::atan (float y, float x) |
double | lobot::atan (double y, double x) |
float | lobot::atan (int y, int x) |
float | lobot::log (float n) |
Log functions for base 10. | |
double | lobot::log (double n) |
float | lobot::ln (float n) |
Natural logarithms. | |
double | lobot::ln (double n) |
float | lobot::exp (float n) |
Exponential functions. | |
double | lobot::exp (double n) |
float | lobot::prob_to_log_odds (float p) |
float | lobot::log_odds_to_prob (float log_odds) |
Math functions.
Definition in file LoMath.H.