mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Ref T259, Ref T243 compare situation by vector
This commit is contained in:
@@ -69,6 +69,18 @@ namespace BlackMisc
|
||||
return (coordinate1.normalVector() - coordinate2.normalVector()).lengthSquared();
|
||||
}
|
||||
|
||||
bool ICoordinateGeodetic::equalNormalVectorDouble(const std::array<double, 3> &otherVector) const
|
||||
{
|
||||
static const double epsilon = std::numeric_limits<double>::epsilon();
|
||||
const std::array<double, 3> thisVector = this->normalVectorDouble();
|
||||
for (unsigned int i = 0; i < otherVector.size(); i++)
|
||||
{
|
||||
const double d = thisVector[i] - otherVector[i];
|
||||
if (qAbs(d) > epsilon) { return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
CLength ICoordinateGeodetic::calculateGreatCircleDistance(const ICoordinateGeodetic &otherCoordinate) const
|
||||
{
|
||||
return Geo::calculateGreatCircleDistance((*this), otherCoordinate);
|
||||
|
||||
@@ -83,6 +83,9 @@ namespace BlackMisc
|
||||
//! Normal vector with double precision
|
||||
virtual std::array<double, 3> normalVectorDouble() const = 0;
|
||||
|
||||
//! Is equal, epsilon considered
|
||||
bool equalNormalVectorDouble(const std::array<double, 3> &otherVector) const;
|
||||
|
||||
//! Latitude as string
|
||||
QString latitudeAsString() const { return this->latitude().toQString(true); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user