public Coordiantes eciToEcf(Coordiantes eci, double gmst) { // ccar.colorado.edu/ASEN5070/handouts/coordsys.doc // // [X] [C -S 0][X] // [Y] = [S C 0][Y] // [Z]eci [0 0 1][Z]ecf // // // Inverse: // [X] [C S 0][X] // [Y] = [-S C 0][Y] // [Z]ecf [0 0 1][Z]eci double x = (eci.x * Math.Cos(gmst)) + (eci.y * Math.Sin(gmst)); double y = (eci.x * (-Math.Sin(gmst))) + (eci.y * Math.Cos(gmst)); // double { z } = eci; double z = eci.z; //TODO: Verify this line Coordiantes ecf = new Coordiantes(); ecf.x = x; ecf.y = y; ecf.z = z; return(ecf); // return { // x, // y, // z, // }; }
public Geodetic eciToGeodetic(Coordiantes eci, double gmst) { // http://www.celestrak.com/columns/v02n03/ double a = 6378.137; double b = 6356.7523142; double R = Math.Sqrt((eci.x * eci.x) + (eci.y * eci.y)); double f = (a - b) / a; double e2 = ((2 * f) - (f * f)); double longitude = Math.Atan2(eci.y, eci.x) - gmst; while (longitude < -pi) { longitude += twoPi; } while (longitude > pi) { longitude -= twoPi; } double kmax = 20; double k = 0; double latitude = Math.Atan2( eci.z, Math.Sqrt((eci.x * eci.x) + (eci.y * eci.y)) ); double C = 0; while (k < kmax) { C = 1 / Math.Sqrt(1 - (e2 * (Math.Sin(latitude) * Math.Sin(latitude)))); latitude = Math.Atan2(eci.z + (a * C * e2 * Math.Sin(latitude)), R); k += 1; } double height = (R / Math.Cos(latitude)) - (a * C); Geodetic geodetic = new Geodetic(); geodetic.longitude = longitude; geodetic.latitude = latitude; geodetic.height = height; return(geodetic); }
public Coordiantes ecfToEci(Coordiantes ecf, double gmst) { // ccar.colorado.edu/ASEN5070/handouts/coordsys.doc // // [X] [C -S 0][X] // [Y] = [S C 0][Y] // [Z]eci [0 0 1][Z]ecf // double X = (ecf.x * Math.Cos(gmst)) - (ecf.y * Math.Sin(gmst)); double Y = (ecf.x * (Math.Sin(gmst))) + (ecf.y * Math.Cos(gmst)); double Z = ecf.z; Coordiantes eci = new Coordiantes(); eci.x = X; eci.y = Y; eci.z = Z; return(eci); }
public Coordiantes geodeticToEcf(Geodetic geodetic) { double longitude = geodetic.longitude; double latitude = geodetic.latitude; double height = geodetic.height; double a = 6378.137; double b = 6356.7523142; double f = (a - b) / a; double e2 = ((2 * f) - (f * f)); double normal = a / Math.Sqrt(1 - (e2 * (Math.Sin(latitude) * Math.Sin(latitude)))); double x = (normal + height) * Math.Cos(latitude) * Math.Cos(longitude); double y = (normal + height) * Math.Cos(latitude) * Math.Sin(longitude); double z = ((normal * (1 - e2)) + height) * Math.Sin(latitude); Coordiantes ecf = new Coordiantes(); ecf.x = x; ecf.y = y; ecf.z = z; return(ecf); }
public PositionAndVelocity() { position_ECI = new Coordiantes(); velocity_ECI = new Coordiantes(); }