|
swift
|
Math utils. More...
Public Member Functions | |
| CMathUtils ()=delete | |
| No objects, just static. | |
Static Public Member Functions | |
| static double | round (double value, int digits) |
| Utility round method. | |
| static double | roundEpsilon (double value, double epsilon) |
| Round by given epsilon. | |
| static double | trunc (double value, double epsilon=1e-10) |
| Nearest integer not greater in magnitude than value, correcting for epsilon. | |
| static double | fract (double value) |
| Fractional part of value. | |
| static double | deg2rad (double degree) |
| Degrees to radians. | |
| static double | rad2deg (double radians) |
| Radians to degrees. | |
| static double | normalizeDegrees180 (double degrees) |
| Normalize: -180< degrees ≤180. | |
| static double | normalizeDegrees360 (double degrees) |
| Normalize: 0≤ degrees <360. | |
| static QRandomGenerator & | randomGenerator () |
| Thread-local random generator. | |
| static int | randomInteger (int low, int high) |
| Random number between low and high. | |
| static double | randomDouble (double max=1) |
| Random double 0-max. | |
| static bool | randomBool () |
| Random boolean. | |
| static int | roundToMultipleOf (int value, int divisor) |
| Round numToRound to the nearest multiple of divisor. | |
| static QString | fractionalPartAsString (double value, int width=-1) |
| Fractional part as integer string, e.g. 3.12 -> 12 / 3.012 -> 012. More... | |
| static double | sum (const QList< double > &values) |
| Calculate the sum. | |
| static double | mean (const QList< double > &values) |
| Calculate the mean. | |
| static double | standardDeviation (const QList< double > &values) |
| Calculate the standard deviation. | |
| static QPair< double, double > | standardDeviationAndMean (const QList< double > &values) |
| Standard deviation (first) and mean (second) | |
| static bool | epsilonEqual (float v1, float v2, float epsilon=1E-06f) |
| Epsilon safe equal. | |
| static bool | epsilonEqual (double v1, double v2, double epsilon=1E-06) |
| Epsilon safe equal. | |
| static bool | epsilonEqualLimits (double v1, double v2) |
| Epsilon safe equal. | |
| static bool | epsilonZero (double v, double epsilon) |
| Epsilon safe zero. | |
| static bool | epsilonZero (double v) |
| Epsilon safe zero. | |
| static bool | epsilonZeroLimits (double v) |
| Epsilon safe zero. | |
Math utils.
Definition at line 22 of file mathutils.h.
|
static |
Fractional part as integer string, e.g. 3.12 -> 12 / 3.012 -> 012.
Definition at line 99 of file mathutils.cpp.