Ref T259, Ref T243 compare situation by vector

This commit is contained in:
Klaus Basan
2018-03-29 00:50:38 +02:00
parent 4d2a32f035
commit 9d484df5ed
2 changed files with 15 additions and 0 deletions

View File

@@ -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);

View File

@@ -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); }