Phyzix
Loading...
Searching...
No Matches
Static Public Member Functions | Static Public Attributes | List of all members
Math Class Reference

A class that provides light-weight mathematical functions. More...

#include <Math.h>

Static Public Member Functions

static float pow (float base, int exponent)
 exponentiation
 
static float min (float a, float b)
 get minimum float value
 
static int min (int a, int b)
 get minimum integer value
 
static float max (float a, float b)
 get maximum float value
 
static int max (int a, int b)
 get maximum integer value
 
static float fabs (float n)
 get the floating-point absolute value
 
static int abs (int n)
 get integer absolute value
 
static float sqrt (float n)
 get the square root of the number
 
static float cos (float angle)
 get the cosine of the angle
 
static int sign (float x)
 get the sign of number
 
static float sin (float angle)
 get the sine of the angle
 
static float atan (float m)
 get the arc tangent of a ratio if slope approaches infinity
 
static float atan (float y, float x)
 get the arc tangent of the ratio constructed by the y amount and the x amount if x is zero, the result is exactly pi/2, if x will never be zero, use atan(float m)
 

Static Public Attributes

static constexpr float PI = 3.141592653589793
 

Detailed Description

A class that provides light-weight mathematical functions.

Note
This class is not intended to be used for heavy mathematical calculations, it only approximates the values.

Member Function Documentation

◆ abs()

static int Math::abs ( int n)
inlinestatic

get integer absolute value

Parameters
n
Returns
absolute value

◆ atan() [1/2]

static float Math::atan ( float m)
inlinestatic

get the arc tangent of a ratio if slope approaches infinity

See also
atan(float y, float x)
Parameters
mthe ratio or slope
Returns
approximated angle value in radians, between pi/2 and -pi/2 inclusive.

◆ atan() [2/2]

static float Math::atan ( float y,
float x )
inlinestatic

get the arc tangent of the ratio constructed by the y amount and the x amount if x is zero, the result is exactly pi/2, if x will never be zero, use atan(float m)

Parameters
y
x
Returns
approximated angle value in radians, between pi/2 and -pi/2 inclusive.

◆ cos()

static float Math::cos ( float angle)
inlinestatic

get the cosine of the angle

Parameters
anglethe angle in radians
Returns
approximated value between 1 and -1

◆ fabs()

static float Math::fabs ( float n)
inlinestatic

get the floating-point absolute value

Parameters
n
Returns
absolute value

◆ max() [1/2]

static float Math::max ( float a,
float b )
inlinestatic

get maximum float value

Parameters
a
b
Returns
the maximum value

◆ max() [2/2]

static int Math::max ( int a,
int b )
inlinestatic

get maximum integer value

Parameters
a
b
Returns
the maximum value

◆ min() [1/2]

static float Math::min ( float a,
float b )
inlinestatic

get minimum float value

Parameters
a
b
Returns
the minimum value

◆ min() [2/2]

static int Math::min ( int a,
int b )
inlinestatic

get minimum integer value

Parameters
a
b
Returns
the minimum value

◆ pow()

static float Math::pow ( float base,
int exponent )
inlinestatic

exponentiation

Parameters
base
exponent
Returns
the base raised to the exponent

◆ sign()

static int Math::sign ( float x)
inlinestatic

get the sign of number

Parameters
x
Returns
1 or -1

◆ sin()

static float Math::sin ( float angle)
inlinestatic

get the sine of the angle

Parameters
anglethe angle in radians
Returns
approximated value between 1 and -1

◆ sqrt()

static float Math::sqrt ( float n)
inlinestatic

get the square root of the number

Parameters
n
Returns
the approximated square root

Member Data Documentation

◆ PI

constexpr float Math::PI = 3.141592653589793
staticconstexpr

The approximated value of PI


The documentation for this class was generated from the following file: