- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Namespace List
- Namespace Members

# FMath Namespace Reference
[Mathematics Classes.]

A namespace for common math functions. More...

## Enumerations
enum | AXIS { X = 0, Y, Z, W, TRANS = W }
| Numerical values for the different axis of the standard axis system. More...
## Functions
double | RadToDeg (double val)
| Convert radians to degrees.
float | RadToDeg (float val)
| Convert radians to degrees.
double | DegToRad (double val)
| Convert degrees to radians.
float | DegToRad (float val)
| Convert degrees to radians.
int | IsNotANumber (float f)
| Determines if given float is encoding for not a number (NAN).
template<class T>
T | Sign (const T &val)
| Retrieves the sign of a number.
template<class T, class T2, class T3>
T | Clamp (T val, T2 mn, T3 mx)
| Clamps the specified object within a range specified by two other objects of the same class.
template<class T, class T2, class T3>
T | Wrap (T val, T2 mn, T3 mx)
| Wraps the specified object within a range specified by two other objects of the same class.
template<>
float | Wrap (float val, float mn, float mx)
| Template specializations of the Wrap method.
template<>
double | Wrap (double val, double mn, double mx)
| See above.
template<>
int | Wrap (int val, int mn, int mx)
| See above.
template<>
uint32 | Wrap (uint32 val, uint32 mn, uint32 mx)
| See above.
## Variables
const double | Pi = 3.14159265358979323846264338327950288419716939937510
| Mathematical value of pi to 50 decimals.
const float | Pif = 3.14159265358979323846264338327950288419716939937510f
| See above.

## Detailed Description

A namespace for common math functions.

## Enumeration Type Documentation

enum FMath::AXIS

  | Numerical values for the different axis of the standard axis system. You can use these enumerated types with the FMatrix44::GetAxis function. Enumerator:
  X | The X-axis.
  Y | The Y-axis.
  Z | The Z-axis.
  W | The W-axis.
  TRANS | The 3D translation value.

## Function Documentation

template<class T, class T2, class T3>
T FMath::Clamp | ( | T | val,
|  | T2 | mn,
|  | T3 | mx
| ) | `[inline]`

  | Clamps the specified object within a range specified by two other objects of the same class. Clamping refers to setting a value within a given range. If the value is lower than the minimum of the range, it is set to the minimum; same for the maximum. Parameters:
  | val | The object to clamp.
  | mx | The highest object of the range.
  | mn | The lowest object of the range.
Returns: The clamped value.

float FMath::DegToRad | ( | float | val | ) | `[inline]`

  | Convert degrees to radians. Parameters:
  | val | The value in degrees.
Returns: The value in radians.

double FMath::DegToRad | ( | double | val | ) | `[inline]`

  | Convert degrees to radians. Parameters:
  | val | The value in degrees.
Returns: The value in radians.

int FMath::IsNotANumber | ( | float | f | ) | `[inline]`

  | Determines if given float is encoding for not a number (NAN). Parameters:
  | f | The float to check.
Returns: 0 if it is a number, something else if is NAN.

float FMath::RadToDeg | ( | float | val | ) | `[inline]`

  | Convert radians to degrees. Parameters:
  | val | The value in radians.
Returns: The value in degrees.

double FMath::RadToDeg | ( | double | val | ) | `[inline]`

  | Convert radians to degrees. Parameters:
  | val | The value in radians.
Returns: The value in degrees.

template<class T>
T FMath::Sign | ( | const T & | val | ) | `[inline]`

  | Retrieves the sign of a number. Parameters:
  | val | The number to check.
Returns: 1 if positive, -1 if negative.

template<>
float FMath::Wrap | ( | float | val,
|  | float | mn,
|  | float | mx
| ) | `[inline]`

| Template specializations of the Wrap method. Optimizing for known primitives. Feel free to add more supported primitives when needed.

template<class T, class T2, class T3>
T FMath::Wrap | ( | T | val,
|  | T2 | mn,
|  | T3 | mx
| ) | `[inline]`

  | Wraps the specified object within a range specified by two other objects of the same class. Wrapping refers to looping around maximum and minimum values until we're within that range. e.g. Provided that mn = 0.0f, mx = 1.0f and val = 1.01f, then the Wrap result will be 0.01f. Parameters:
  | val | The value to wrap.
  | mn | The minimum value.
  | mx | The maximum value (no sanity checks are made).
Returns: The wrapped value.