Guest User

Untitled

a guest
Jun 25th, 2019
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <math.h>
  2. #define EARTH_RADIUS (6378137.0)
  3. void function(double lat_in, lon_in, double offset_mtr, double *lat_out, double *lon_out)
  4. {
  5. double dLat = 0.0;
  6. double dLon = 0.0;
  7. if( (lat_out != NULL) && (lon_out != NULL) )
  8. {
  9. dLat = (offset_mtr/EARTH_RADIUS);
  10. dLon = (offset_mtr/(EARTH_RADIUS * cos(M_PI*lat_in/180)));
  11.  
  12. (*lat_out) = lat_in + dLat * 180/M_PI;
  13. (*lon_out) = lon_in + dLon * 180/M_PI;
  14. }
  15. }
RAW Paste Data