mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 02:05:43 +08:00
Ref T773, use closest positions for average height/elevation values
Testing with XPlane: * even in EDDF the field elevations vary from 353-368ft, which means a difference of 15ft or 4m * that means it is important to use the closest values
This commit is contained in:
committed by
Mat Sutcliffe
parent
57153d45d7
commit
ec92b6dc46
@@ -27,23 +27,23 @@ namespace BlackMisc
|
||||
CSequence<CCoordinateGeodetic>(other)
|
||||
{ }
|
||||
|
||||
CElevationPlane CCoordinateGeodeticList::averageGeodeticHeight(const CCoordinateGeodetic &reference, const CLength &range, const CLength &maxDeviation, int minValues) const
|
||||
CElevationPlane CCoordinateGeodeticList::averageGeodeticHeight(const CCoordinateGeodetic &reference, const CLength &range, const CLength &maxDeviation, int minValues, int sufficentValues) const
|
||||
{
|
||||
if (this->size() < minValues) { return CElevationPlane::null(); } // no change to succeed
|
||||
|
||||
QList<double> valuesInFt;
|
||||
int count = 0;
|
||||
for (const CCoordinateGeodetic &coordinate : *this)
|
||||
const CCoordinateGeodeticList sorted = this->findWithGeodeticMSLHeight().findWithinRange(reference, range).sortedByEuclideanDistanceSquared(reference);
|
||||
if (sorted.size() < minValues) { return CElevationPlane::null(); }
|
||||
|
||||
// we know all values have MSL and are within range
|
||||
for (const CCoordinateGeodetic &coordinate : sorted)
|
||||
{
|
||||
if (!coordinate.hasMSLGeodeticHeight()) { continue; }
|
||||
if (!coordinate.isWithinRange(reference, range)) { continue; }
|
||||
const double elvFt = coordinate.geodeticHeight().value(CLengthUnit::ft());
|
||||
valuesInFt.push_back(elvFt);
|
||||
count++;
|
||||
if (count > 5 && valuesInFt.size() > 3 * minValues) { break; }
|
||||
if (valuesInFt.size() >= sufficentValues) { break; }
|
||||
}
|
||||
|
||||
if (count < minValues) { return CElevationPlane::null(); }
|
||||
if (valuesInFt.size() < minValues) { return CElevationPlane::null(); }
|
||||
|
||||
const double MaxDevFt = maxDeviation.value(CLengthUnit::ft());
|
||||
const QPair<double, double> elvStdDevMean = CMathUtils::standardDeviationAndMean(valuesInFt);
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace BlackMisc
|
||||
CCoordinateGeodeticList(const CSequence<CCoordinateGeodetic> &other);
|
||||
|
||||
//! Average height within range and having an height
|
||||
CElevationPlane averageGeodeticHeight(const CCoordinateGeodetic &reference, const PhysicalQuantities::CLength &range, const PhysicalQuantities::CLength &maxDeviation = PhysicalQuantities::CLength(1.0, PhysicalQuantities::CLengthUnit::m()), int minValues = 3) const;
|
||||
CElevationPlane averageGeodeticHeight(const CCoordinateGeodetic &reference, const PhysicalQuantities::CLength &range, const PhysicalQuantities::CLength &maxDeviation = PhysicalQuantities::CLength(1.0, PhysicalQuantities::CLengthUnit::m()), int minValues = 3, int sufficentValues = 5) const;
|
||||
};
|
||||
} //namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user