Add docs for the math package.

This commit is contained in:
Kyle Isom 2019-08-04 22:58:41 -07:00
parent 1224a57d06
commit e157ee61e6
2 changed files with 41 additions and 6 deletions

View File

@ -12,22 +12,53 @@ namespace math {
/** /**
* Convert radians to degrees. * Convert radians to degrees.
* @param rads the angle in radians * @param rads the angle in radians
* @return the angle in degrees, * @return the angle in degrees.
*/ */
float RadiansToDegreesF(float rads); float RadiansToDegreesF(float rads);
/**
* Convert radians to degrees.
* @param rads the angle in radians
* @return the angle in degrees.
*/
double RadiansToDegreesD(double rads); double RadiansToDegreesD(double rads);
/**
* Convert degrees to radians.
* @param degrees the angle in degrees
* @return the angle in radians.
*/
float DegreesToRadiansF(float degrees); float DegreesToRadiansF(float degrees);
/**
* Convert degrees to radians.
* @param degrees the angle in degrees
* @return the angle in radians.
*/
double DegreesToRadiansD(double degrees); double DegreesToRadiansD(double degrees);
/**
const double Epsilon_double = 0.0001; * Get the default epsilon value.
const float Epsilon_float = 0.0001; * @param epsilon The variable to store the epsilon value in.
*/
void DefaultEpsilon(double &epsilon); void DefaultEpsilon(double &epsilon);
/**
* Get the default epsilon value.
* @param epsilon The variable to store the epsilon value in.
*/
void DefaultEpsilon(float &epsilon); void DefaultEpsilon(float &epsilon);
/**
* Return whether the two values of type T are equal to within some tolerance.
* @tparam T The type of value
* @param a A value of type T used as the left-hand side of an equality check.
* @param b A value of type T used as the right-hand side of an equality check.
* @param epsilon The tolerance value.
* @return Whether the two values are "close enough" to be considered equal.
*/
template <typename T> template <typename T>
static T static T
WithinTolerance(T a, T b, T epsilon) WithinTolerance(T a, T b, T epsilon)

View File

@ -33,6 +33,10 @@ DegreesToRadiansD(double degrees)
} }
const double Epsilon_double = 0.0001;
const float Epsilon_float = 0.0001;
void void
DefaultEpsilon(double &epsilon) DefaultEpsilon(double &epsilon)
{ {