Main   Class List   Namespace List   Wiki

Math
[Core]

Functions for dealing with vectors and matrices etc. More...

Modules

 Vector Math
 

Functions for working with three-dimensional vectors (VectorF/Point3F).


 Matrix Math
 

Functions for working with matrices (MatrixF, AngAxisF, MatrixRotation, MatrixPosition).


 Random Numbers
 

Functions for generating random numbers.


Functions

Point3F getBoxCenter (Box3F box)
 Get the center point of an axis-aligned box.
float getMax (float v1, float v2)
 Calculate the greater of two specified numbers.
float getMin (float v1, float v2)
 Calculate the lesser of two specified numbers.
float m2Pi ()
 Return the value of 2*PI (full-circle in radians).
float mAbs (float v)
 Calculate absolute value of specified value.
float mAcos (float v)
 Calculate the arc-cosine of v.
float mAsin (float v)
 Calculate the arc-sine of v.
float mAtan (float rise, float run)
 Calculate the arc-tangent (slope) of a line defined by rise and run.
void mathInit (...)
 Install the math library with specified extensions.
int mCeil (float v)
 Round v up to the nearest integer.
float mClamp (float v, float min, float max)
 Clamp the specified value between two bounds.
float mCos (float v)
 Calculate the cosine of v.
float mDegToRad (float degrees)
 Convert specified degrees into radians.
string mFloatLength (float v, int precision)
 Formats the specified number to the given number of decimal places.
int mFloor (float v)
 Round v down to the nearest integer.
float mFMod (float v, float d)
 Calculate the remainder of v/d.
bool mIsPow2 (int v)
 Returns whether the value is an exact power of two.
float mLerp (float v1, float v2, float time)
 Calculate linearly interpolated value between two specified numbers using specified normalized time.
float mLog (float v)
 Calculate the natural logarithm of v.
float mPi ()
 Return the value of PI (half-circle in radians).
float mPow (float v, float p)
 Calculate b raised to the p-th power.
float mRadToDeg (float radians)
 Convert specified radians into degrees.
int mRound (float v)
 Round v to the nearest integer.
float mSaturate (float v)
 Clamp the specified value between 0 and 1 (inclusive).
float mSin (float v)
 Calculate the sine of v.
string mSolveCubic (float a, float b, float c, float d)
 Solve a cubic equation (3rd degree polynomial) of form a*x^3 + b*x^2 + c*x + d = 0.
string mSolveQuadratic (float a, float b, float c)
 Solve a quadratic equation (2nd degree polynomial) of form a*x^2 + b*x + c = 0.
string mSolveQuartic (float a, float b, float c, float d, float e)
 Solve a quartic equation (4th degree polynomial) of form a*x^4 + b*x^3 + c*x^2 + d*x + e = 0.
float mSqrt (float v)
 Calculate the square-root of v.
float mTan (float v)
 Calculate the tangent of v.

Detailed Description

Functions for dealing with vectors and matrices etc.


Function Documentation

Point3F getBoxCenter ( Box3F  box  ) 

Get the center point of an axis-aligned box.

Parameters:
b A Box3F, in string format using "minExtentX minExtentY minExtentZ maxExtentX maxExtentY maxExtentZ"
Returns:
Center of the box.
float getMax ( float  v1,
float  v2 
)

Calculate the greater of two specified numbers.

Parameters:
v1 Input value.
v2 Input value.
Returns:
The greater value of the two specified values.
float getMin ( float  v1,
float  v2 
)

Calculate the lesser of two specified numbers.

Parameters:
v1 Input value.
v2 Input value.
Returns:
The lesser value of the two specified values.
float m2Pi (  ) 

Return the value of 2*PI (full-circle in radians).

Returns:
The value of 2*PI.
float mAbs ( float  v  ) 

Calculate absolute value of specified value.

Parameters:
v Input Value.
Returns:
Absolute value of specified value.
float mAcos ( float  v  ) 

Calculate the arc-cosine of v.

Parameters:
v Input Value (in radians).
Returns:
The arc-cosine of the input value.
float mAsin ( float  v  ) 

Calculate the arc-sine of v.

Parameters:
v Input Value (in radians).
Returns:
The arc-sine of the input value.
float mAtan ( float  rise,
float  run 
)

Calculate the arc-tangent (slope) of a line defined by rise and run.

Parameters:
rise of line.
run of line.
Returns:
The arc-tangent (slope) of a line defined by rise and run.
void mathInit (   ...  ) 

Install the math library with specified extensions.

Possible parameters are:

  • 'DETECT' Autodetect math lib settings.
  • 'C' Enable the C math routines. C routines are always enabled.
  • 'FPU' Enable floating point unit routines.
  • 'MMX' Enable MMX math routines.
  • '3DNOW' Enable 3dNow! math routines.
  • 'SSE' Enable SSE math routines.
int mCeil ( float  v  ) 

Round v up to the nearest integer.

Parameters:
v Number to convert to integer.
Returns:
Number converted to integer.
float mClamp ( float  v,
float  min,
float  max 
)

Clamp the specified value between two bounds.

Parameters:
v Input value.
min Minimum Bound.
max Maximum Bound.
Returns:
The specified value clamped to the specified bounds.
float mCos ( float  v  ) 

Calculate the cosine of v.

Parameters:
v Input Value (in radians).
Returns:
The cosine of the input value.
float mDegToRad ( float  degrees  ) 

Convert specified degrees into radians.

Parameters:
degrees Input Value (in degrees).
Returns:
The specified degrees value converted to radians.
string mFloatLength ( float  v,
int  precision 
)

Formats the specified number to the given number of decimal places.

Parameters:
v Number to format.
precision Number of decimal places to format to (1-9).
Returns:
Number formatted to the specified number of decimal places.
int mFloor ( float  v  ) 

Round v down to the nearest integer.

Parameters:
v Number to convert to integer.
Returns:
Number converted to integer.
float mFMod ( float  v,
float  d 
)

Calculate the remainder of v/d.

Parameters:
v Input Value.
d Divisor Value.
Returns:
The remainder of v/d.
bool mIsPow2 ( int  v  ) 

Returns whether the value is an exact power of two.

Parameters:
v Input value.
Returns:
Whether the specified value is an exact power of two.
float mLerp ( float  v1,
float  v2,
float  time 
)

Calculate linearly interpolated value between two specified numbers using specified normalized time.

Parameters:
v1 Interpolate From Input value.
v2 Interpolate To Input value.
time Normalized time used to interpolate values (0-1).
Returns:
The interpolated value between the two specified values at normalized time t.
float mLog ( float  v  ) 

Calculate the natural logarithm of v.

Parameters:
v Input Value.
Returns:
The natural logarithm of the input value.
float mPi (  ) 

Return the value of PI (half-circle in radians).

Returns:
The value of PI.
float mPow ( float  v,
float  p 
)

Calculate b raised to the p-th power.

Parameters:
v Input Value.
p Power to raise value by.
Returns:
v raised to the p-th power.
float mRadToDeg ( float  radians  ) 

Convert specified radians into degrees.

Parameters:
radians Input Value (in radians).
Returns:
The specified radians value converted to degrees.
int mRound ( float  v  ) 

Round v to the nearest integer.

Parameters:
v Number to convert to integer.
Returns:
Number converted to integer.
float mSaturate ( float  v  ) 

Clamp the specified value between 0 and 1 (inclusive).

Parameters:
v Input value.
Returns:
The specified value clamped between 0 and 1 (inclusive).
float mSin ( float  v  ) 

Calculate the sine of v.

Parameters:
v Input Value (in radians).
Returns:
The sine of the input value.
string mSolveCubic ( float  a,
float  b,
float  c,
float  d 
)

Solve a cubic equation (3rd degree polynomial) of form a*x^3 + b*x^2 + c*x + d = 0.

Parameters:
a First Coefficient.
b Second Coefficient.
c Third Coefficient.
d Fourth Coefficient.
Returns:
A 4-tuple, containing: (sol x0 x1 x2). (sol) is the number of solutions(being 0, 1, 2 or 3), and (x0), (x1) and (x2) are the solutions, if any.
string mSolveQuadratic ( float  a,
float  b,
float  c 
)

Solve a quadratic equation (2nd degree polynomial) of form a*x^2 + b*x + c = 0.

Parameters:
a First Coefficient.
b Second Coefficient.
c Third Coefficient.
Returns:
A triple, containing: (sol x0 x1). (sol) is the number of solutions(being 0, 1, or 2), and (x0) and (x1) are the solutions, if any.
string mSolveQuartic ( float  a,
float  b,
float  c,
float  d,
float  e 
)

Solve a quartic equation (4th degree polynomial) of form a*x^4 + b*x^3 + c*x^2 + d*x + e = 0.

Parameters:
a First Coefficient.
b Second Coefficient.
c Third Coefficient.
d Fourth Coefficient.
e Fifth Coefficient.
Returns:
A 5-tuple, containing: (sol x0 x1 x2 c3). (sol) is the number of solutions(being 0, 1, 2, 3 or 4), and (x0), (x1), (x2) and (x3) are the solutions, if any.
float mSqrt ( float  v  ) 

Calculate the square-root of v.

Parameters:
v Input Value.
Returns:
The square-root of the input value.
float mTan ( float  v  ) 

Calculate the tangent of v.

Parameters:
v Input Value (in radians).
Returns:
The tangent of the input value.


Copyright © GarageGames, LLC. All Rights Reserved.