Guest User

Untitled

a guest
Apr 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #define PI 3.14159265
  2. #define LATBASE 51.0f
  3. #define LONBASE 0.0f
  4. #define EARTH_RAD 6378137
  5.  
  6. void calculateGPS(int32_t *lati, int32_t *loni, float x, float y)
  7. {
  8. float dn = -y;
  9. float de = -x;
  10.  
  11. double d_lat = dn/EARTH_RAD;
  12. double d_lon = de/(EARTH_RAD*cos(PI*LATBASE/180));
  13.  
  14. double latfin = LATBASE + d_lat*180/PI;
  15. double lonfin = LONBASE + d_lon*180/PI;
  16.  
  17. // Return computed values by ref
  18. (*lati) = latfin*1e7;
  19. (*loni) = lonfin*1e7;
  20. }
Add Comment
Please, Sign In to add comment