Loading...
Searching...
No Matches
func.h File Reference

Common math functions. More...

`#include "math/const.h"`
`#include <cmath>`
`#include <cstdlib>`
Include dependency graph for func.h:

## Namespaces

namespace | Math
| Namespace for (new) math code.

## Functions

bool | Math::IsEqual (float a, float b, float tolerance=Math::TOLERANCE)
| Compares a and b within tolerance.
bool | Math::IsZero (float a, float tolerance=Math::TOLERANCE)
| Compares a to zero within tolerance.
float | Math::Min (float a, float b)
| Minimum.
float | Math::Min (float a, float b, float c)
float | Math::Min (float a, float b, float c, float d)
float | Math::Min (float a, float b, float c, float d, float e)
float | Math::Max (float a, float b)
| Maximum.
float | Math::Max (float a, float b, float c)
float | Math::Max (float a, float b, float c, float d)
float | Math::Max (float a, float b, float c, float d, float e)
template<typename T>
T | Math::Clamp (T value, T min, T max)
| Clamps the value to a range specified by min and max.
float | Math::Norm (float a)
| Returns the normalized value (0 .. 1).
void | Math::Swap (int &a, int &b)
| Swaps two integers.
void | Math::Swap (float &a, float &b)
| Swaps two real numbers.
float | Math::Mod (float a, float m)
| Returns the modulo of a floating point number.
float | Math::Rand ()
| Returns a random value between 0 and 1.
bool | Math::IsPowerOfTwo (unsigned int x)
| Returns whether x is an even power of 2.
int | Math::NextPowerOfTwo (int x)
| Returns the next nearest power of two to x.
float | Math::NormAngle (float angle)
| Returns a normalized angle, that is in other words between 0 and 2 * PI.
bool | Math::TestAngle (float angle, float min, float max)
| Test if a angle is between two terminals.
float | Math::PropAngle (float a, float b, float p)
| Calculates a value (radians) proportional between a and b (degrees).
float | Math::Direction (float a, float g)
| Calculates the angle to rotate the angle a to the angle g.
float | Math::Neutral (float value, float dead)
| Managing the dead zone of a joystick.
float | Math::Smooth (float actual, float hope, float time)
| Gently advances a desired value from its current value.
float | Math::Bounce (float progress, float middle=0.3f, float bounce=0.4f)
| Bounces any movement.

## Detailed Description

Common math functions.