Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define PI 3.14159265
- #define LATBASE 51.0f
- #define LONBASE 0.0f
- #define EARTH_RAD 6378137
- void calculateGPS(int32_t *lati, int32_t *loni, float x, float y)
- {
- float dn = -y;
- float de = -x;
- double d_lat = dn/EARTH_RAD;
- double d_lon = de/(EARTH_RAD*cos(PI*LATBASE/180));
- double latfin = LATBASE + d_lat*180/PI;
- double lonfin = LONBASE + d_lon*180/PI;
- // Return computed values by ref
- (*lati) = latfin*1e7;
- (*loni) = lonfin*1e7;
- }
Add Comment
Please, Sign In to add comment