Classes | Typedefs | Functions | Variables
swri_math_util Namespace Reference

Classes

class  GenRingBuffer
class  Interpolation1D
class  RandomGenerator
class  Ransac
class  RansacBatch
class  StatBuffer

Typedefs

typedef boost::shared_ptr
< RandomGenerator
RandomGeneratorPtr

Functions

template<class RNG >
void GetUniformRandomSample (RNG &rng, int32_t min, int32_t max, int32_t count, std::vector< int32_t > &sample)
bool IsNear (double v1, double v2, double epsilon)
double Round (double value)
double ToDegrees (double radians)
double ToNearest (double value, double multiple)
double ToRadians (double degrees)
double unWrapAngle (double static_angle, double variable_angle, double threshold=_pi)
double UpToNearest (double value, double multiple)
double WrapRadians (double angle, double center)

Variables

static const long double _2pi = 6.28318530717958647692528676655900576L
static const long double _deg_2_rad = 0.01745329251994329576923690768488612L
static const double _feet_to_meters = 0.3048
static const long double _half_pi = 1.57079632679489661923132169163975144L
static const double _kph_to_mps = 0.2777777777777778
static const double _mps_to_mph = 2.2369362920544025
static const long double _pi = 3.1415926535897932384626433832795029L
static const long double _rad_2_deg = 57.2957795130823208767981548141051703L
static const double _yards_to_meters = 0.9144

Typedef Documentation

Definition at line 70 of file random.h.


Function Documentation

template<class RNG >
void swri_math_util::GetUniformRandomSample ( RNG &  rng,
int32_t  min,
int32_t  max,
int32_t  count,
std::vector< int32_t > &  sample 
)

Gets a uniform random sample of integers without repeats for a given range.

The number of samples should be much smaller than the number of possible values in the range for optimal performance.

This function depends on a random number generator (RNG) being provided, which generally aren't thread safe. It is recommended that a multi-threaded application create a seperate RNGs for each thread.

param[in] rng The random number generator. param[in] min The minimum of the range (inclusive). param[in] max The maximum of the range (inclusive). param[in] count The sample size. param[out] sample The sample.

Definition at line 89 of file random.h.

bool swri_math_util::IsNear ( double  v1,
double  v2,
double  epsilon 
)

Check if v1 is within +/- epsilon of v2

Parameters:
[in]v1The first value.
[in]v2The second value.
[in]epsilonThe tolerance.
Returns:
True if v1 is near v2.

Definition at line 61 of file math_util.cpp.

double swri_math_util::Round ( double  value)

Round the value to the nearest integer.

Parameters:
[in]valueThe number to round.
[in]multipleThe multiple.
Returns:
The rounded value.

Definition at line 36 of file math_util.cpp.

double swri_math_util::ToDegrees ( double  radians)

Convert degrees to radians.

Parameters:
[in]radiansInput angle.
Returns:
The angle in degrees.

Definition at line 57 of file trig_util.cpp.

double swri_math_util::ToNearest ( double  value,
double  multiple 
)

Round the value to the nearest provided multiple.

Parameters:
[in]valueThe number to round.
[in]multipleThe multiple.
Returns:
The rounded value.

Definition at line 41 of file math_util.cpp.

double swri_math_util::ToRadians ( double  degrees)

Convert radians to degrees.

Parameters:
[in]degreesInput angle.
Returns:
The angle in radians.

Definition at line 52 of file trig_util.cpp.

double swri_math_util::unWrapAngle ( double  static_angle,
double  variable_angle,
double  threshold = _pi 
)

Unwraps the variable_angle across 0-2pi or +/-pi boundaries to avoid large differences between the static and variable angles (when the difference may be small. For example a static angle of 2pi - epsilon and a variable angle of epsilon would result in the variable angle being unwrapped to 2pi + epsilon.

Parameters:
[in]static_angleThe reference angle
[in]variable_angleThe angle to unwrap
[in]thresholdA threshold on the angle (default is pi)
Return values:
Returnsthe resultant angle

Definition at line 66 of file math_util.cpp.

double swri_math_util::UpToNearest ( double  value,
double  multiple 
)

Round up the value to the nearest provided multiple.

Parameters:
[in]valueThe number to round.
[in]multipleThe multiple.
Returns:
The rounded value.

Definition at line 51 of file math_util.cpp.

double swri_math_util::WrapRadians ( double  angle,
double  center 
)

Normalize an angle to be within a 2pi range centered at a given value.

Parameters:
[in]angle The input angle in radians.
[in]center The center of the range in radians.
Returns:
An equivalent angle in the desired range.

Definition at line 36 of file trig_util.cpp.


Variable Documentation

const long double swri_math_util::_2pi = 6.28318530717958647692528676655900576L [static]

Definition at line 37 of file constants.h.

const long double swri_math_util::_deg_2_rad = 0.01745329251994329576923690768488612L [static]

Definition at line 41 of file constants.h.

const double swri_math_util::_feet_to_meters = 0.3048 [static]

Definition at line 49 of file constants.h.

const long double swri_math_util::_half_pi = 1.57079632679489661923132169163975144L [static]

Definition at line 39 of file constants.h.

const double swri_math_util::_kph_to_mps = 0.2777777777777778 [static]

Definition at line 45 of file constants.h.

const double swri_math_util::_mps_to_mph = 2.2369362920544025 [static]

Definition at line 47 of file constants.h.

const long double swri_math_util::_pi = 3.1415926535897932384626433832795029L [static]

Definition at line 35 of file constants.h.

const long double swri_math_util::_rad_2_deg = 57.2957795130823208767981548141051703L [static]

Definition at line 43 of file constants.h.

const double swri_math_util::_yards_to_meters = 0.9144 [static]

Definition at line 51 of file constants.h.



swri_math_util
Author(s): Marc Alban
autogenerated on Tue Oct 3 2017 03:19:18