Functions | |
float | absf (float f) |
int | absi (int i) |
float | mapValueToInterval (float minInterval, float maxInterval, float destMin, float destMax, float value) |
float | random () |
float | random (float min, float max) |
float | clampToZeroOne (float value) |
bool | isValueInTolerance (float value0, float value1, float tolerance) |
double | degreeToRadian (double degree) |
double | radianToDegree (double angle) |
|
Definition at line 19 of file MathUtils.h. Referenced by isValueInTolerance().
00019 { 00020 if(f < 0.0f) { 00021 return -f; 00022 } else { 00023 return f; 00024 } 00025 } |
|
Definition at line 31 of file MathUtils.h.
00031 { 00032 if(i < 0) { 00033 return -i; 00034 } else { 00035 return i; 00036 } 00037 } |
|
Definition at line 91 of file MathUtils.h.
00091 { 00092 if (value < 0.0f) { 00093 return 0.0f; 00094 } 00095 if (value > 1.0f) { 00096 return 1.0f; 00097 } 00098 return value; 00099 } |
|
Definition at line 116 of file MathUtils.h. References PIOVER180.
00116 { 00117 return degree * PIOVER180; 00118 } |
|
Definition at line 105 of file MathUtils.h. References absf().
00105 { 00106 if (absf(value0 - value1) <= tolerance) { 00107 return true; 00108 } 00109 return false; 00110 } |
Here is the call graph for this function:
|
Definition at line 43 of file MathUtils.h. Referenced by random().
00044 { 00045 00046 // Make sure value is inside of the interval. 00047 if (value < minInterval) { 00048 value = minInterval; 00049 } 00050 if (value > maxInterval) { 00051 value = maxInterval; 00052 } 00053 00054 // Calculate the percentage of the value in the startinterval. 00055 float percent = ((value - minInterval) / (maxInterval - minInterval)) * 100.0f; 00056 00057 // Now get the value in percent in the second interval. 00058 float result = destMin + ((percent / 100.0f) * (destMax - destMin)); 00059 00060 return result; 00061 } |
|
Definition at line 124 of file MathUtils.h. References PI.
00124 { 00125 return angle * (180.0 / PI); 00126 } |
|
Definition at line 79 of file MathUtils.h. References mapValueToInterval().
00079 { 00080 int r = rand(); 00081 float result; 00082 00083 result = mapValueToInterval(0.0f, (float)RAND_MAX, min, max, (float)r); 00084 return result; 00085 } |
Here is the call graph for this function:
|
Definition at line 67 of file MathUtils.h. References mapValueToInterval().
00067 { 00068 int r = rand(); 00069 float result; 00070 00071 result = mapValueToInterval(0.0f, (float)RAND_MAX, 0.0f, 1.0f, (float)r); 00072 return result; 00073 } |
Here is the call graph for this function: