Trigonometry for Distance to the Center of the Earth
The oblate spheroid shape of the Earth is not this flattened and value e is small, placing ray Ra close to C and more closely parallel to ray Rg. The squashed look is provided here for clarity.
The true distance D is as shown. This is because the latitude that gives the position of a person or object on the Earth is the astronomical latitude, alat. This is a ray that extends outward from the Earth's surface at a right angle to that point. Because the Earth is an ellipsoid from the Equator to the pole, a ray that is perpendicular cannot pass through the exact Center of the Earth except at two latitudes (0o at the Equator and 90o at the poles). Since elevations above sea level are measured directly up from the surface, they must therefore be parallel to ray Ra.
The geocentric latitude, glat, on the other hand, defines the angle of ray Rg that extends from the Center of the Earth to the same point on the surface.
Also shown on here is an example of the variation of the geoid with respect to the ellipsoid and how this applies toward adjusting the distance D.