Powertek.PtMath Struct Reference
Mathematical Calculations and Helper.
More...
List of all members.
|
Static Public Member Functions |
static float | DegToRad (float value) |
static float | RadToDeg (float value) |
static double | DegToRad (double value) |
static double | RadToDeg (double value) |
static Byte | ClampToByte (int value) |
static Byte | ClampToByte (double value) |
static float | Clamp (float value, float min, float max) |
static double | Clamp (double value, double min, double max) |
static int | Clamp (int value, int min, int max) |
static int | Clamp (double value, int min, int max) |
static int | Clamp (float value, int min, int max) |
static double | Maximum (double value1, double value2, double value3) |
static Byte | Maximum (Byte value1, Byte value2, Byte value3) |
static double | Minimum (double value1, double value2, double value3) |
static Byte | Minimum (Byte value1, Byte value2, Byte value3) |
static float | RoundToRange (float value, float roundToRange) |
static float | CutDecimals (float value, int decNumbers) |
static float | RoundDecimals (float value, int decNumbers) |
static float | Random (float maxVal) |
static float | RandomAround (float maxVal) |
static String | SecondToTime (int seconds) |
static float | CompoundInterest (float value, float interest, float years) |
static double | CompoundInterest (double value, double interest, double years) |
static float | CompoundInterestInv (float value, float interest, float years) |
static double | CompoundInterestInv (double value, double interest, double years) |
static float | InvSqrt (float x) |
static double | Pow (double a, double b) |
static void | ShellSort< T > (List< T > list) |
Detailed Description
Member Function Documentation
static int Powertek.PtMath.Clamp |
( |
float |
value, |
|
|
int |
min, |
|
|
int |
max | |
|
) |
| | [static] |
Clamps a value into the range min..max (including min, max), Input will be rounded to int.
- Parameters:
-
| value | Value to clamp |
| min | Min Value (lowest value) |
| max | Max Value (highest value) |
- Returns:
static int Powertek.PtMath.Clamp |
( |
double |
value, |
|
|
int |
min, |
|
|
int |
max | |
|
) |
| | [static] |
Clamps a value into the range min..max (including min, max), Input will be rounded to int.
- Parameters:
-
| value | Value to clamp |
| min | Min Value (lowest value) |
| max | Max Value (highest value) |
- Returns:
static int Powertek.PtMath.Clamp |
( |
int |
value, |
|
|
int |
min, |
|
|
int |
max | |
|
) |
| | [static] |
Clamps a value into the range min..max (including min, max).
- Parameters:
-
| value | Value to clamp |
| min | Min Value (lowest value) |
| max | Max Value (highest value) |
- Returns:
static double Powertek.PtMath.Clamp |
( |
double |
value, |
|
|
double |
min, |
|
|
double |
max | |
|
) |
| | [static] |
Clamps a value into the range min..max (including min, max).
- Parameters:
-
| value | Value to clamp |
| min | Min Value (lowest value) |
| max | Max Value (highest value) |
- Returns:
static float Powertek.PtMath.Clamp |
( |
float |
value, |
|
|
float |
min, |
|
|
float |
max | |
|
) |
| | [static] |
Clamps a value into the range min..max (including min, max).
- Parameters:
-
| value | Value to clamp |
| min | Min Value (lowest value) |
| max | Max Value (highest value) |
- Returns:
static Byte Powertek.PtMath.ClampToByte |
( |
double |
value |
) |
[static] |
Clamps a value into the range 0..255.
- Parameters:
-
- Returns:
- Byte Range 0..255
static Byte Powertek.PtMath.ClampToByte |
( |
int |
value |
) |
[static] |
Clamps a value into the range 0..255.
- Parameters:
-
- Returns:
- Byte Range 0..255
static double Powertek.PtMath.CompoundInterest |
( |
double |
value, |
|
|
double |
interest, |
|
|
double |
years | |
|
) |
| | [static] |
Calculates the CompoundInterest with the given interest rate (in percent) over the years.
- Parameters:
-
- Returns:
static float Powertek.PtMath.CompoundInterest |
( |
float |
value, |
|
|
float |
interest, |
|
|
float |
years | |
|
) |
| | [static] |
Calculates the CompoundInterest with the given interest rate (in percent) over the years.
- Parameters:
-
| value | in percent |
| interest | |
| years | |
- Returns:
static double Powertek.PtMath.CompoundInterestInv |
( |
double |
value, |
|
|
double |
interest, |
|
|
double |
years | |
|
) |
| | [static] |
Calculates the CompoundInterest from the given year back to the start year the result is start value in the year.
- Parameters:
-
- Returns:
static float Powertek.PtMath.CompoundInterestInv |
( |
float |
value, |
|
|
float |
interest, |
|
|
float |
years | |
|
) |
| | [static] |
Calculates the CompoundInterest from the given year back to the start year the result is start value in the year.
- Parameters:
-
| value | in percent |
| interest | in percent |
| years | |
- Returns:
static float Powertek.PtMath.CutDecimals |
( |
float |
value, |
|
|
int |
decNumbers | |
|
) |
| | [static] |
Cuts the decimal values to the desired number, works like the string format "0.00" but with the float values, "0.0" decNumbers = 1, "0.00" decNumbers = 2, "0.000" decNumbers = 3 etc.
- Parameters:
-
| value | The value to process |
| decNumbers | The number of decimals |
- Returns:
static double Powertek.PtMath.DegToRad |
( |
double |
value |
) |
[static] |
Degrees to RadiansConversion.
- Parameters:
-
- Returns:
static float Powertek.PtMath.DegToRad |
( |
float |
value |
) |
[static] |
Degrees to Radians Conversion.
- Parameters:
-
- Returns:
static float Powertek.PtMath.InvSqrt |
( |
float |
x |
) |
[static] |
Fast Inverse Sqrt using Lomont Optimization (used in Quake 3) Note: The Precision is limited to around 3 decimals.
- Parameters:
-
- Returns:
static Byte Powertek.PtMath.Maximum |
( |
Byte |
value1, |
|
|
Byte |
value2, |
|
|
Byte |
value3 | |
|
) |
| | [static] |
Maximum of 3 values.
- Parameters:
-
| value1 | value 1 |
| value2 | value 2 |
| value3 | value 3 |
- Returns:
- The Maximum of the input values
static double Powertek.PtMath.Maximum |
( |
double |
value1, |
|
|
double |
value2, |
|
|
double |
value3 | |
|
) |
| | [static] |
Maximum of 3 values.
- Parameters:
-
| value1 | value 1 |
| value2 | value 2 |
| value3 | value 3 |
- Returns:
- The Maximum of the input values
static Byte Powertek.PtMath.Minimum |
( |
Byte |
value1, |
|
|
Byte |
value2, |
|
|
Byte |
value3 | |
|
) |
| | [static] |
Minimum of 3 values.
- Parameters:
-
| value1 | value 1 |
| value2 | value 2 |
| value3 | value 3 |
- Returns:
- The Minimum of the input values
static double Powertek.PtMath.Minimum |
( |
double |
value1, |
|
|
double |
value2, |
|
|
double |
value3 | |
|
) |
| | [static] |
Minimum of 3 values.
- Parameters:
-
| value1 | value 1 |
| value2 | value 2 |
| value3 | value 3 |
- Returns:
- The Minimum of the input values
static double Powertek.PtMath.Pow |
( |
double |
a, |
|
|
double |
b | |
|
) |
| | [static] |
Faster Pow Note: 3x faster then Math.Pow with an avg error of 5% (2.5-25%).
- Parameters:
-
- Returns:
static double Powertek.PtMath.RadToDeg |
( |
double |
value |
) |
[static] |
Radians To Degrees Conversion.
- Parameters:
-
- Returns:
static float Powertek.PtMath.RadToDeg |
( |
float |
value |
) |
[static] |
Radians to Degrees Conversion.
- Parameters:
-
- Returns:
static float Powertek.PtMath.Random |
( |
float |
maxVal |
) |
[static] |
Random value.
- Parameters:
-
- Returns:
static float Powertek.PtMath.RandomAround |
( |
float |
maxVal |
) |
[static] |
Returns a Random value within the range of maxVal around 0, random +/-, maxVal = 10f, Result will be in the range -10.0f..10.0f.
- Parameters:
-
- Returns:
static float Powertek.PtMath.RoundDecimals |
( |
float |
value, |
|
|
int |
decNumbers | |
|
) |
| | [static] |
Rounds a value to specific decimal count, works like the string format "0.00" but with the float values, "0.0" decNumbers = 1, "0.00" decNumbers = 2, "0.000" decNumbers = 3 etc.
- Parameters:
-
| value | The value to process |
| decNumbers | The number of decimals |
- Returns:
static float Powertek.PtMath.RoundToRange |
( |
float |
value, |
|
|
float |
roundToRange | |
|
) |
| | [static] |
Rounds a value to a decimal range > round to 1.0, 0.1, 0.01.
- Parameters:
-
| value | Input value |
| roundToRange | The decimal range to round to |
- Returns:
static String Powertek.PtMath.SecondToTime |
( |
int |
seconds |
) |
[static] |
Converts int seconds into the format "min:sec".
- Parameters:
-
- Returns:
static void Powertek.PtMath.ShellSort< T > |
( |
List< T > |
list |
) |
[static] |
Shell Sort for List T On small lists and nearly sorted list, this is faster then the List.Sort(Quicksort).
- Template Parameters:
-
| T | List T with Members containing IComparable Interface, CompareTo() |
- Parameters:
-
The documentation for this struct was generated from the following file: