From ae60233a243c5706c013e4070f22b4587bd600e4 Mon Sep 17 00:00:00 2001 From: Kristoffer Gryte Date: Thu, 30 Aug 2018 23:53:38 +0200 Subject: [PATCH 1/4] DUNE/Coordinates/WGS84: more accurate displace function --- src/DUNE/Coordinates/WGS84.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DUNE/Coordinates/WGS84.hpp b/src/DUNE/Coordinates/WGS84.hpp index 8e83dc6ab2..ccc4dfb23e 100644 --- a/src/DUNE/Coordinates/WGS84.hpp +++ b/src/DUNE/Coordinates/WGS84.hpp @@ -182,7 +182,9 @@ namespace DUNE toECEF(*lat, *lon, *hae, &x, &y, &z); // Compute Geocentric latitude - double phi = std::atan2(z, std::sqrt(x * x + y * y)); + double N = computeRn(*lat); + double p = std::sqrt(x * x + y * y); + double phi = std::atan2(z,p*(1 - c_wgs84_e2 * N / (N + *hae))); // Compute all needed sine and cosine terms for conversion. double slon = std::sin(*lon); From 0ead2aab8f6fab8e05828b11b52329fe3748c530 Mon Sep 17 00:00:00 2001 From: Kristoffer Gryte Date: Thu, 30 Aug 2018 23:54:02 +0200 Subject: [PATCH 2/4] DUNE/Coordinates/WGS84: make to/fromECEF public --- src/DUNE/Coordinates/WGS84.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DUNE/Coordinates/WGS84.hpp b/src/DUNE/Coordinates/WGS84.hpp index ccc4dfb23e..7c9d8228a7 100644 --- a/src/DUNE/Coordinates/WGS84.hpp +++ b/src/DUNE/Coordinates/WGS84.hpp @@ -287,7 +287,6 @@ namespace DUNE getNEBearingAndRange(lat1, lon1, lat2, lon2, azimuth, &tmp); } - private: //! Convert WGS-84 coordinates to ECEF (Earch Center Earth Fixed) coordinates. //! //! @param[in] lat WGS-84 latitude (rad). @@ -349,6 +348,7 @@ namespace DUNE } } + private: //! Compute the radius of curvature in the prime vertical (Rn). //! //! @param[in] lat WGS-84 latitude (rad). From b5d5121ccddc4f8891cf419d44f6afc15d596ab9 Mon Sep 17 00:00:00 2001 From: Luis Venancio Date: Wed, 17 Jul 2019 17:06:46 +0100 Subject: [PATCH 3/4] CMake: Added option to build using elliptical coordinates in the (WGS84) displace function --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 52da192b3a..390344d6f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,6 +90,7 @@ dune_option(BLUEVIEW "Enable support for the BlueView SDK") dune_option(OPENCV "Enable support for OpenCV") dune_option(NO_RTTI "Disable support for RTTI") dune_option(UEYE "Enable support for IDS uEye cameras") +dune_option(ELLIPSOIDAL "Enable ellipsoidal coordinates in (WGS84) displace") # Internationalization. include(${PROJECT_SOURCE_DIR}/cmake/I18N.cmake) @@ -231,6 +232,11 @@ endif(DUNE_SHARED) add_dependencies(dune-core dune-version) +# WGS84 Coordinate Type +if(ELLIPSOIDAL) + add_definitions(-DDUNE_ELLIPSOIDAL_DISPLACE) +endif(ELLIPSOIDAL) + ########################################################################## # Tasks # ########################################################################## From a32d06fbd0e6c689222d7b019bb34afe4c273d70 Mon Sep 17 00:00:00 2001 From: Luis Venancio Date: Wed, 17 Jul 2019 17:07:18 +0100 Subject: [PATCH 4/4] DUNE/Coordinates/WGS84: Added optional elliptical coordinates to displace function --- src/DUNE/Coordinates/WGS84.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/DUNE/Coordinates/WGS84.hpp b/src/DUNE/Coordinates/WGS84.hpp index 7c9d8228a7..2f9edfb6f7 100644 --- a/src/DUNE/Coordinates/WGS84.hpp +++ b/src/DUNE/Coordinates/WGS84.hpp @@ -182,9 +182,15 @@ namespace DUNE toECEF(*lat, *lon, *hae, &x, &y, &z); // Compute Geocentric latitude - double N = computeRn(*lat); double p = std::sqrt(x * x + y * y); +#if defined(DUNE_ELLIPSOIDAL_DISPLACE) + // Use elliptical coordinates + double N = computeRn(*lat); double phi = std::atan2(z,p*(1 - c_wgs84_e2 * N / (N + *hae))); +#else + // Use spherical coordinates + double phi = std::atan2(z,p); +#endif // Compute all needed sine and cosine terms for conversion. double slon = std::sin(*lon);