diff --git a/src/blackmisc/geo/coordinategeodetic.cpp b/src/blackmisc/geo/coordinategeodetic.cpp index 62a553068..cc4f5fdd6 100644 --- a/src/blackmisc/geo/coordinategeodetic.cpp +++ b/src/blackmisc/geo/coordinategeodetic.cpp @@ -69,6 +69,18 @@ namespace BlackMisc return (coordinate1.normalVector() - coordinate2.normalVector()).lengthSquared(); } + bool ICoordinateGeodetic::equalNormalVectorDouble(const std::array &otherVector) const + { + static const double epsilon = std::numeric_limits::epsilon(); + const std::array 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); diff --git a/src/blackmisc/geo/coordinategeodetic.h b/src/blackmisc/geo/coordinategeodetic.h index 14755ba64..11a097ae2 100644 --- a/src/blackmisc/geo/coordinategeodetic.h +++ b/src/blackmisc/geo/coordinategeodetic.h @@ -83,6 +83,9 @@ namespace BlackMisc //! Normal vector with double precision virtual std::array normalVectorDouble() const = 0; + //! Is equal, epsilon considered + bool equalNormalVectorDouble(const std::array &otherVector) const; + //! Latitude as string QString latitudeAsString() const { return this->latitude().toQString(true); }