diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-04-05 14:06:07 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-04-05 14:06:07 -0400 |
commit | b8547586aa0a9a5b330ad21de845d885f93cc10a (patch) | |
tree | 0249515558fc0d800ff2b9f3d75db54367496c99 /geoid.c | |
parent | f1d0dea4ce72f8e49eefcec94c2daf325358d809 (diff) | |
download | gpsd-b8547586aa0a9a5b330ad21de845d885f93cc10a.tar.gz |
Refactoring step. Change the signature of ecef_to_wgs84fix().
All regression tests pass.
Diffstat (limited to 'geoid.c')
-rw-r--r-- | geoid.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -86,7 +86,7 @@ double wgs84_separation(double lat, double lon) } -void ecef_to_wgs84fix(struct gps_data_t *gpsdata, +void ecef_to_wgs84fix(struct gps_fix_t *fix, double *separation, double x, double y, double z, double vx, double vy, double vz) /* fill in WGS84 position/velocity fields from ECEF coordinates */ @@ -105,20 +105,20 @@ void ecef_to_wgs84fix(struct gps_data_t *gpsdata, phi = atan2(z + e_2*b*pow(sin(theta),3),p - e2*a*pow(cos(theta),3)); n = a / sqrt(1.0 - e2*pow(sin(phi),2)); h = p / cos(phi) - n; - gpsdata->fix.latitude = phi * RAD_2_DEG; - gpsdata->fix.longitude = lambda * RAD_2_DEG; - gpsdata->separation = wgs84_separation(gpsdata->fix.latitude, gpsdata->fix.longitude); - gpsdata->fix.altitude = h - gpsdata->separation; + fix->latitude = phi * RAD_2_DEG; + fix->longitude = lambda * RAD_2_DEG; + *separation = wgs84_separation(fix->latitude, fix->longitude); + fix->altitude = h - *separation; /* velocity computation */ vnorth = -vx*sin(phi)*cos(lambda)-vy*sin(phi)*sin(lambda)+vz*cos(phi); veast = -vx*sin(lambda)+vy*cos(lambda); - gpsdata->fix.climb = vx*cos(phi)*cos(lambda)+vy*cos(phi)*sin(lambda)+vz*sin(phi); - gpsdata->fix.speed = sqrt(pow(vnorth,2) + pow(veast,2)); + fix->climb = vx*cos(phi)*cos(lambda)+vy*cos(phi)*sin(lambda)+vz*sin(phi); + fix->speed = sqrt(pow(vnorth,2) + pow(veast,2)); heading = atan2(fix_minuz(veast), fix_minuz(vnorth)); /*@ +evalorder @*/ if (heading < 0) heading += 2 * GPS_PI; - gpsdata->fix.track = heading * RAD_2_DEG; + fix->track = heading * RAD_2_DEG; } /* |