|
| int | addBitToMask (mask, bit) |
| |
| string | bit () |
| |
| string | bitInverse () |
| |
| string | bits () |
| |
| float | mAbs (val) |
| |
| float | mAcos (val) |
| |
| float | mAsin (val) |
| |
| float | mAtan (val) |
| |
| int | mCeil (val) |
| |
| float | mClamp (float number, float min, float max) |
| |
| float | mCos (val) |
| |
| float | mDegToRad (val) |
| |
| string | mFloatLength (val, numDecimals) |
| |
| int | mFloor (val) |
| |
| float | mGetMax (a, b) |
| |
| float | mGetMin (a, b) |
| |
| float | mLog (val) |
| |
| float | mPow (val, power) |
| |
| float | mRadToDeg (val) |
| |
| float | mRound (float v) |
| |
| float | mSin (val) |
| |
| string | mSolveCubic (float a, float b, float c, float d) |
| |
| string | mSolveQuadratic (float a, float b, float c) |
| |
| string | mSolveQuartic (float a, float b, float c, float d, float e) |
| |
| float | mSqrt (val) |
| |
| float | mTan (val) |
| |
| int | removeBitFromMask (mask, bit) |
| |
General math functions. Use these whenever possible, as they'll run much faster than script equivalents.
| int addBitToMask |
( |
mask |
, |
|
|
bit |
|
|
) |
| |
- Returns the mask with a bit added to it
Converts a bit-position into a value.
Returns the ones complement of a bit.
Converts a list of bit-positions into a value.
Use the mAbs function to get the magnitude of val.
- Parameters
-
| val | An integer or a floating-point value. |
- Returns
- Returns the magnitude of val
Use the mAcos function to get the inverse cosine of val in radians.
- Parameters
-
| val | A value between -1.0 and 1.0 equal to the cosine of some angle theta. |
- Returns
- Returns the inverse cosine of val in radians. This value will be in the range [ 0 , 3.14159 ].
- See Also
- mCos
Use the mAsin function to get the inverse sine of val in radians.
- Parameters
-
| val | A value between -1.0 and 1.0 equal to the sine of some angle theta. |
- Returns
- Returns the inverse sine of val in radians. This value will be in the range [ - 3.14159/2 , 3.14159/2 ].
- See Also
- mSin
Use the mAtan function to get the inverse tangent of rise/run in radians.
- Parameters
-
| rise | Vertical component of a line. |
| run | Horizontal component of a line. |
- Returns
- Returns the slope in radians (the arc-tangent) of a line with the given rise and run.
- See Also
- mTan
Use the mCeil function to calculate the next highest integer value from val.
- Parameters
-
| val | A floating-point value. |
- Returns
- Returns an integer representing the next highest integer from val.
- See Also
- mFloor
| float mClamp |
( |
float |
number, |
|
|
float |
min, |
|
|
float |
max |
|
) |
| |
Clamp a value between two other values.
- Parameters
-
| number | A float value representing the number to clamp |
| min | The lower bound |
| max | The upper bound |
- Returns
- A float value the is within the given range
Use the mCos function to get the cosine of the radian angle val.
- Parameters
-
| val | A value between -3.14159 and 3.14159. |
- Returns
- Returns the cosine of val. This value will be in the range [ -1.0 , 1.0 ].
- See Also
- mAcos
Use the mDegToRad function to convert degrees to radians.
- Parameters
-
| val | A floating-point number representing some number of degrees. |
- Returns
- Returns the equivalent of the degree value val in radians.
- See Also
- mRadToDeg
| string mFloatLength |
( |
val |
, |
|
|
numDecimals |
|
|
) |
| |
Use the mFloatLength function to limit the number of decimal places in val to numDecimals.
- Parameters
-
| val | A floating-point value. |
| numDecimals | An integer between 0 and inf representing the number of decimal places to allow val to have. |
- Returns
- Returns a floating-point value equivalent to a truncated version of val, where the new version has numDecimals decimal places
Use the mFloor function to calculate the next lowest integer value from val.
- Parameters
-
| val | A floating-point value. |
- Returns
- Returns an integer representing the next lowest integer from val.
- See Also
- mCeil
- Returns the Maximum of two values.
- Returns the Minimum of two values.
Use the mLog function to calculate the natural logarithm of val.
- Parameters
-
- Returns
- Returns the natural logarithm of val
| float mPow |
( |
val |
, |
|
|
power |
|
|
) |
| |
Use the mPow function to calculated val raised to the power of power.
- Parameters
-
| val | A numeric (integer or floating-point) value to be raised to a power. |
| power | A numeric (integer or floating-point) power to raise val to. |
- Returns
- Returns val^power
Use the mRadToDeg function to convert radians to degrees.
- Parameters
-
| val | A floating-point number representing some number of radians. |
- Returns
- Returns the equivalent of the radian value val in degrees.
- See Also
- mDegToRad
Rounds a number. 0.5 is rounded up.
- Parameters
-
| val | A floating-point value |
- Returns
- Returns the integer value closest to the given float
Use the mSin function to get the sine of the radian angle val.
- Parameters
-
| val | A value between -3.14159 and 3.14159. |
- Returns
- Returns the sine of val. This value will be in the range [ -1.0 , 1.0 ].
- See Also
- mAsin
| string mSolveCubic |
( |
float |
a, |
|
|
float |
b, |
|
|
float |
c, |
|
|
float |
d |
|
) |
| |
Solve a cubic equation of form a*x^3 + b*x^2 + c*x + d = 0.
- Returns
- A 4-tuple, contanining: sol x0 x1 x2. sol is the number of solutions (being 0, 1, 2, or 3), and x0, x1, x2 are the solutions, if any. Unused x's are undefined.
| string mSolveQuadratic |
( |
float |
a, |
|
|
float |
b, |
|
|
float |
c |
|
) |
| |
Solve a quadratic equation of form a*x^2 + b*x + c = 0.
- Returns
- A triple, contanining: sol x0 x1. sol is the number of solutions (being 0, 1, or 2), and x0 and x1 are the solutions, if any. Unused x's are undefined.
| string mSolveQuartic |
( |
float |
a, |
|
|
float |
b, |
|
|
float |
c, |
|
|
float |
d, |
|
|
float |
e |
|
) |
| |
Solve a quartic equation of form a*x^4 + b*x^3 + c*x^2 + d*x + e = 0.
- Returns
- A 5-tuple, contanining: sol x0 x1 x2 x3. sol is the number of solutions (ranging from 0-4), and x0, x1, x2 and x3 are the solutions, if any. Unused x's are undefined.
Use the mSqrt function to calculated the square root of val.
- Parameters
-
- Returns
- Returns the the squareroot of val
Use the mTan function to get the tangent of the radian angle val.
- Parameters
-
| val | A value between -3.14159/2 and 3.14159/2. |
- Returns
- Returns the tangent of val. This value will be in the range [ -inf.0 , inf.0 ].
- See Also
- mAtan
| int removeBitFromMask |
( |
mask |
, |
|
|
bit |
|
|
) |
| |
- Returns the mask with a bit removed from it