Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

mathutils.h File Reference

#include <cmath>
#include <stdexcept>
#include <algorithm>
Include dependency graph for mathutils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  mathutils
 

a variety of handy mathematical functions, many of which are templated


Functions

float mathutils::distance (float x1, float y1, float x2, float y2)
 euclidean distance of two points, see squareDistance()
double mathutils::distance (double x1, double y1, double x2, double y2)
 euclidean distance of two points, see squareDistance()
template<class num >
num mathutils::limitRange (num n, num low, num high)
 Clips n to a minimum of low or maximum of high.
template<class num >
num mathutils::log2t (num x)
 Returns the log base 2 of a number.
template<>
float mathutils::log2t (float x)
 returns the log base 2 for a 'float' value
template<>
double mathutils::log2t (double x)
 returns the log base 2 for a 'double' value
double mathutils::deg2rad (double x)
 converts from degrees to radians
double mathutils::rad2deg (double x)
 converts from radians to degrees
float mathutils::deg2rad (float x)
 converts from degrees to radians
float mathutils::rad2deg (float x)
 converts from radians to degrees
template<class num >
num mathutils::normalizeAngle (num value)
 Will set a to be between (-pi,pi) (inclusive), just like atan2().
float mathutils::sampleRange (float min, float max)
 Chooses a number in the range [min,max) (exclusive upper bound).
double mathutils::sampleRange (double min, double max)
 Chooses a number in the range [min,max) (exclusive upper bound).
template<class num >
num mathutils::sampleInteger (num min, num max)
 Chooses a number in the range [min,max) (exclusive upper bound).
template<class C >
C::value_type::first_type mathutils::weightedPick (const C &c)
 Pass a collection of std::pair<value,weight> (map, vector, etc.), returns a value based on a weighted sample.

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:59 2016 by Doxygen 1.6.3