示例#1
0
        public static GeodeticCoord GeocentricToGeodetic(GeocentricCoord geoc)
        {
            var eps     = e_sq / (1.0 - e_sq);
            var p       = Sqrt(geoc.X * geoc.X + geoc.Y * geoc.Y);
            var q       = Atan2((geoc.Z * a), (p * b));
            var sin_q   = Sin(q);
            var cos_q   = Cos(q);
            var sin_q_3 = sin_q * sin_q * sin_q;
            var cos_q_3 = cos_q * cos_q * cos_q;
            var phi     = Atan2((geoc.Z + eps * b * sin_q_3), (p - e_sq * a * cos_q_3));
            var lambda  = Atan2(geoc.Y, geoc.X);
            var v       = a / Sqrt(1.0 - e_sq * Sin(phi) * Sin(phi));

            return(new GeodeticCoord(
                       RadiansToDegrees(phi),
                       RadiansToDegrees(lambda),
                       (p / Cos(phi)) - v
                       ));
        }
示例#2
0
        public static Vector3Double GeocentricToDatabase(GeocentricCoord geoc)
        {
            var geod = GeocentricToGeodetic(geoc);

            return(GeodeticToDatabase(geod));
        }