An optimized method to transform the Cartesian to geodetic coordinates on a triaxial ellipsoid