Gel2D - The free/open source game creation suite

Static Public Member Functions
gel::GelMath Class Reference

Some useful mathematical functions. More...

#include <gelMath.h>

List of all members.

Static Public Member Functions

static int randomi (int min, int max)
 Generates a random integer.
static float random (float min, float max)
 Generates a random float.
static int absolute (int num)
 Returns a given number's absolute value.
static float absolute (float num)
 Returns a given number's absolute value.
static int mini (int a, int b)
 Returns the minimum of two numbers.
static int maxi (int a, int b)
 Returns the maximum of two numbers.
static float minf (float a, float b)
 Returns the minimum of two numbers.
static float maxf (float a, float b)
 Returns the maximum of two numbers.
static bool inRange (int num, int start, int end)
 Determines whether or not a given integer is in between two other numbers.
static bool inRange (float num, float start, float end)
 Determines whether or not a given float is in between two other numbers.
static float degToRad (float deg)
 Converts degrees to radians.
static float radToDeg (float rad)
 Converts radians to degrees.
static float clampDeg (float deg)
 Clamps a float to a degree in the 0-360 range.
static float sqr (float num)
 Squares a float.
static int nearestPower (int num, int power)

Detailed Description

Some useful mathematical functions.


Member Function Documentation

static int gel::GelMath::randomi ( int  min,
int  max 
) [static]

Generates a random integer.

Parameters:
min: Lower limit.
max: Upper limit.
Returns:
A random integer within the limits defined.
static float gel::GelMath::random ( float  min,
float  max 
) [static]

Generates a random float.

Parameters:
min: Lower limit.
max: Upper limit.
Returns:
A random float within the limits defined.
static int gel::GelMath::absolute ( int  num) [static]

Returns a given number's absolute value.

Parameters:
num: The number to perform the operation on.
Returns:
The absolute value of the integer num.
static float gel::GelMath::absolute ( float  num) [static]

Returns a given number's absolute value.

Parameters:
num: The number to perform the operation on.
Returns:
The absolute value of the float num.
static int gel::GelMath::mini ( int  a,
int  b 
) [static]

Returns the minimum of two numbers.

static int gel::GelMath::maxi ( int  a,
int  b 
) [static]

Returns the maximum of two numbers.

static float gel::GelMath::minf ( float  a,
float  b 
) [static]

Returns the minimum of two numbers.

static float gel::GelMath::maxf ( float  a,
float  b 
) [static]

Returns the maximum of two numbers.

static bool gel::GelMath::inRange ( int  num,
int  start,
int  end 
) [static]

Determines whether or not a given integer is in between two other numbers.

Parameters:
num: The number to be tested.
start: Lower limit.
end: Upper limit.
Returns:
True if the number is within range, else false.
static bool gel::GelMath::inRange ( float  num,
float  start,
float  end 
) [static]

Determines whether or not a given float is in between two other numbers.

Parameters:
num: The number to be tested.
start: Lower limit.
end: Upper limit.
Returns:
True if the number is within range, else false.
static float gel::GelMath::degToRad ( float  deg) [static]

Converts degrees to radians.

Parameters:
deg: The degree to perform the operation on.
Returns:
The equivalent of deg in radians.
static float gel::GelMath::radToDeg ( float  rad) [static]

Converts radians to degrees.

Parameters:
rad: The radian to perform the operation on.
Returns:
The equivalent of rad in degrees.
static float gel::GelMath::clampDeg ( float  deg) [static]

Clamps a float to a degree in the 0-360 range.

Parameters:
deg: The float to perform the operation on.
Returns:
The float's equivalent in degrees.
static float gel::GelMath::sqr ( float  num) [static]

Squares a float.

Parameters:
num: The number to perform the operation on.
Returns:
The float num squared.
static int gel::GelMath::nearestPower ( int  num,
int  power 
) [static]

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