( 1.0 - WGS84_E2 ) int tsmLatLongToGeocentric ( double lat, double lon, double altitude, double *x, double *y, double *z ) Convert from Lat/Long to Geocentric coordinates
Convert from Lat/Long to Geocentric coordinates.This function will take a (latitude, longitude, altitude) coordinate and transform it into a geocentric coordinate. The values for latitude and longitude are assumed to be in degrees, relative to the WGS84 datum and in the range -90..+90, and -180..+180 respectively. (N.B. you can also specify longitude in the range 0..360, where 0 is still Greenwich Meridian, but 180..360 maps to -180..0. It is not obvious that a 0..180 mapping makes sense for latitude so we do not support this.)
The value for altitude is assumed to be in meters above sea level (i.e. height above the geoid). If your altitude is in terms of height above the WGS84 spheroid then you should compensate for this by subtracting the geoid separation value for the region before calling this function, i.e.
altitude -= (double) tspCalcGeoidSeparation( lat, lon );
The origin of the geocentric system is the center of the spheroid. The equator is in the x-y plane and 0 degrees of longitude lies along the x-z plane.