mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
Ref T261, aircraft changes class reflecting delta/average values
* math utils for standard deviation etc. * CAircraftSituationChange value class
This commit is contained in:
committed by
Roland Winklmeier
parent
d1f5635bd1
commit
784cf29af5
@@ -15,6 +15,7 @@
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#include <QtCore/qmath.h>
|
||||
#include <QPair>
|
||||
#include <cmath>
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -25,7 +26,6 @@ namespace BlackMisc
|
||||
class BLACKMISC_EXPORT CMathUtils
|
||||
{
|
||||
public:
|
||||
|
||||
//! No objects, just static
|
||||
CMathUtils() = delete;
|
||||
|
||||
@@ -108,12 +108,37 @@ namespace BlackMisc
|
||||
//! Random number between low and high
|
||||
static int randomInteger(int low, int high);
|
||||
|
||||
//! Random double 0-max
|
||||
static double randomDouble(double max = 1);
|
||||
|
||||
//! Round numToRound to the nearest multiple of divisor
|
||||
static int roundToMultipleOf(int value, int divisor);
|
||||
|
||||
//! Fractional part as integer string, e.g. 3.12 -> 12 / 3.012 -> 012
|
||||
//! \remark because of leading 0 returned as string
|
||||
static QString fractionalPartAsString(double value, int width = -1);
|
||||
|
||||
//! Calculate the sum
|
||||
static double sum(const QList<double> &values);
|
||||
|
||||
//! Calculate the mean
|
||||
static double mean(const QList<double> &values);
|
||||
|
||||
//! Calculate the standard deviation
|
||||
static double standardDeviation(const QList<double> &values);
|
||||
|
||||
//! Standard deviation (first) and mean (second)
|
||||
static QPair<double, double> standardDeviationAndMean(const QList<double> &values);
|
||||
|
||||
private:
|
||||
//! Calculate the variance
|
||||
static double variance(const QList<double> &values);
|
||||
|
||||
//! The squared differences to mean
|
||||
static QList<double> squaredDifferences(const QList<double> &values);
|
||||
|
||||
//! The squared differences to mean
|
||||
static QList<double> squaredDifferences(const QList<double> &values, double meanValue);
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user