location.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <inttypes.h>
  3. #include "vector2.h"
  4. #include "vector3.h"
  5. /*
  6. * LOCATION
  7. */
  8. // return horizontal distance in centimeters between two positions
  9. float get_horizontal_distance_cm(const Vector3f &origin, const Vector3f &destination);
  10. // return bearing in centi-degrees between two positions
  11. float get_bearing_cd(const Vector3f &origin, const Vector3f &destination);
  12. // Converts from WGS84 geodetic coordinates (lat, lon, height)
  13. // into WGS84 Earth Centered, Earth Fixed (ECEF) coordinates
  14. // (X, Y, Z)
  15. void wgsllh2ecef(const Vector3d &llh, Vector3d &ecef);
  16. // Converts from WGS84 Earth Centered, Earth Fixed (ECEF)
  17. // coordinates (X, Y, Z), into WHS84 geodetic
  18. // coordinates (lat, lon, height)
  19. void wgsecef2llh(const Vector3d &ecef, Vector3d &llh);
  20. // return true when lat and lng are within range
  21. bool check_lat(float lat) WARN_IF_UNUSED;
  22. bool check_lng(float lng) WARN_IF_UNUSED;
  23. bool check_lat(int32_t lat) WARN_IF_UNUSED;
  24. bool check_lng(int32_t lng) WARN_IF_UNUSED;
  25. bool check_latlng(float lat, float lng) WARN_IF_UNUSED;
  26. bool check_latlng(int32_t lat, int32_t lng) WARN_IF_UNUSED;