|
swift
|
Math utils. More...
#include <mathutils.h>
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. | |
| 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 |
Degrees to radians.
Definition at line 55 of file mathutils.cpp.
|
static |
Epsilon safe equal.
Definition at line 53 of file mathutils.cpp.
|
static |
Epsilon safe equal.
Definition at line 51 of file mathutils.cpp.
|
inlinestatic |
Epsilon safe equal.
Definition at line 38 of file mathutils.h.
|
inlinestatic |
Epsilon safe zero.
Definition at line 47 of file mathutils.h.
|
inlinestatic |
Epsilon safe zero.
Definition at line 46 of file mathutils.h.
|
inlinestatic |
Epsilon safe zero.
Definition at line 48 of file mathutils.h.
|
inlinestatic |
Fractional part of value.
Definition at line 58 of file mathutils.h.
|
static |
Fractional part as integer string, e.g. 3.12 -> 12 / 3.012 -> 012.
Definition at line 111 of file mathutils.cpp.
|
static |
Calculate the mean.
Definition at line 156 of file mathutils.cpp.
|
static |
Normalize: -180< degrees ≤180.
Definition at line 59 of file mathutils.cpp.
|
static |
Normalize: 0≤ degrees <360.
Definition at line 65 of file mathutils.cpp.
|
static |
Radians to degrees.
Definition at line 57 of file mathutils.cpp.
|
static |
Random boolean.
Definition at line 90 of file mathutils.cpp.
|
static |
Random double 0-max.
Definition at line 83 of file mathutils.cpp.
Thread-local random generator.
Definition at line 71 of file mathutils.cpp.
|
static |
Random number between low and high.
Definition at line 77 of file mathutils.cpp.
|
static |
Utility round method.
Definition at line 18 of file mathutils.cpp.
|
static |
Round by given epsilon.
Definition at line 33 of file mathutils.cpp.
|
static |
Round numToRound to the nearest multiple of divisor.
Definition at line 92 of file mathutils.cpp.
|
static |
Calculate the standard deviation.
Definition at line 168 of file mathutils.cpp.
|
static |
Standard deviation (first) and mean (second).
Definition at line 174 of file mathutils.cpp.
|
static |
Calculate the sum.
Definition at line 129 of file mathutils.cpp.
|
inlinestatic |
Nearest integer not greater in magnitude than value, correcting for epsilon.
Definition at line 52 of file mathutils.h.