Beispiel #1
0
        // ///////////////////////////////////////////////////////////////////
        // Calculate the ECI coordinates of the location "geo" at time "date".
        // Assumes geo coordinates are km-based.
        // Assumes the earth is an oblate spheroid as defined in WGS '72.
        // Reference: The 1992 Astronomical Almanac, page K11
        // Reference: www.celestrak.com (Dr. TS Kelso)
        public Eci(CoordGeo geo, Julian date)
        {
            m_VecUnits = VecUnits.UNITS_KM;

             double mfactor = Globals.TWOPI * (Globals.OMEGA_E / Globals.SEC_PER_DAY);
             double lat = geo.m_Lat;
             double lon = geo.m_Lon;
             double alt = geo.Altitude.Kilometers;

             // Calculate Local Mean Sidereal Time (theta)
             double theta = date.toLMST(lon);
             double c = 1.0 / Math.Sqrt(1.0 + Globals.F * (Globals.F - 2.0) * Globals.Sqr(Math.Sin(lat)));
             double s = Globals.Sqr(1.0 - Globals.F) * c;
             double achcp = (Globals.XKMPER * c + alt) * Math.Cos(lat);

             m_date = date;

             m_pos = new Vector();

             m_pos.X = achcp * Math.Cos(theta);                    // km
             m_pos.Y = achcp * Math.Sin(theta);                    // km
             m_pos.Z = (Globals.XKMPER * s + alt) * Math.Sin(lat); // km
             m_pos.W = Math.Sqrt(Globals.Sqr(m_pos.X) +
                   Globals.Sqr(m_pos.Y) +
                   Globals.Sqr(m_pos.Z));            // range, km

             m_vel = new Vector();

             m_vel.X = -mfactor * m_pos.Y;               // km / sec
             m_vel.Y =  mfactor * m_pos.X;
             m_vel.Z = 0.0;
             m_vel.W = Math.Sqrt(Globals.Sqr(m_vel.X) +  // range rate km/sec^2
                   Globals.Sqr(m_vel.Y));
        }
		// ///////////////////////////////////////////////////////////////////////////
		// c'tor accepting:
		//    Latitude  in degress (negative south)
		//    Longitude in degress (negative west)
		//    Altitude  in km
		public Site(double degLat, double degLon, double kmAlt)
		{
			m_geo =
				new CoordGeo(Globals.Deg2Rad(degLat), Globals.Deg2Rad(degLon), kmAlt);
		}
		private CoordGeo m_geo;  // lat, lon, alt of earth site

		#region Construction

		// //////////////////////////////////////////////////////////////////////////
		public Site(CoordGeo geo)
		{
			m_geo = geo;
		}
		// ///////////////////////////////////////////////////////////////////
		// Calculate the ECI coordinates of the location "geo" at time "date".
		// Assumes geo coordinates are km-based.
		// Assumes the earth is an oblate spheroid as defined in WGS '72.
		// Reference: The 1992 Astronomical Almanac, page K11
		// Reference: www.celestrak.com (Dr. TS Kelso)
		public Eci(CoordGeo geo, Julian date)
		{
			m_VectorUnits = VectorUnits.Km;

			double mfactor = Globals.TWOPI * (Globals.OMEGA_E / Globals.SEC_PER_DAY);
			double lat = geo.Latitude;
			double lon = geo.Longitude;
			double alt = geo.Altitude;

			// Calculate Local Mean Sidereal Time (theta)
			double theta = date.toLMST(lon);
			double c = 1.0 / Math.Sqrt(1.0 + Globals.F * (Globals.F - 2.0) * Globals.Sqr(Math.Sin(lat)));
			double s = Globals.Sqr(1.0 - Globals.F) * c;
			double achcp = (Globals.XKMPER * c + alt) * Math.Cos(lat);

			m_Date = date;

			m_Position = new Vector();

			m_Position.X = achcp * Math.Cos(theta);                    // km
			m_Position.Y = achcp * Math.Sin(theta);                    // km
			m_Position.Z = (Globals.XKMPER * s + alt) * Math.Sin(lat); // km
			m_Position.W = Math.Sqrt(Globals.Sqr(m_Position.X) +
				Globals.Sqr(m_Position.Y) +
				Globals.Sqr(m_Position.Z));            // range, km

			m_Velocity = new Vector();

			m_Velocity.X = -mfactor * m_Position.Y;               // km / sec
			m_Velocity.Y =  mfactor * m_Position.X;
			m_Velocity.Z = 0.0;
			m_Velocity.W = Math.Sqrt(Globals.Sqr(m_Velocity.X) +  // range rate km/sec^2
				Globals.Sqr(m_Velocity.Y));
		}
Beispiel #5
0
 public static Distance GreatCircleDistance(CoordGeo pt1, CoordGeo pt2)
 {
     double distance = Math.Acos((Math.Sin(pt1.LatRad) * Math.Sin(pt2.LatRad)) + (Math.Cos(pt1.LatRad) * Math.Cos(pt2.LatRad) * Math.Cos(pt2.LonRad - pt1.LonRad)));
     distance = distance * 3963.0;  // Statute Miles
     distance = distance * 1.609344; // to Km
     Distance d = new Distance(distance, DistanceUnits.KILOMETERS);
     return d;
 }
Beispiel #6
0
        private void MakeFootprint(DateTime atTime)
        {
            this._footPrint.Clear();

            // Constants
            double Re = 6378.137;
            double TWOPI = Math.PI * 2.0;

            double Rs = Math.Sqrt((Math.Pow(this.GetPositionECI(0).getPos().X, 2.0) + Math.Pow(this.GetPositionECI(0).getPos().Y, 2.0) + Math.Pow(this.GetPositionECI(0).getPos().Z, 2.0)));
            double srad = Math.Acos(Re / Rs);
            double latTemp = this.GetPositionGeo(atTime).m_Lat;
            double lonTemp = this.GetPositionGeo(atTime).m_Lon;
            double cla = Math.Cos(latTemp);
            double sla = Math.Sin(latTemp);
            double clo = Math.Cos(lonTemp);
            double slo = Math.Sin(lonTemp);
            double sra = Math.Sin(srad);
            double cra = Math.Cos(srad);

            double angle = 0.0;
            double X, Y, Z, x, y, z, lat, lon, lon1, lon2;
            for (int i = 0; i < 73; i++)
            {
                angle = i * (TWOPI / 72.0);
                X = cra;
                Y = sra * Math.Sin(angle);
                Z = sra * Math.Cos(angle);

                x = (X * cla) - (Z * sla);
                y = Y;
                z = (X * sla) + (Z * cla);

                X = (x * clo) - (y * slo);
                Y = (x * slo) + (y * clo);
                Z = z;

                lon = Math.Atan2(Y, X);
                lon1 = this.FN_Atan(Y, X);
                lon2 = this.FN_Atan2(Y, X);
                lat = Math.Asin(Z);
                CoordGeo cg = new CoordGeo(lat, lon, 0);
                this._footPrint.Add(cg);
                if (i == 0)
                {
                    this._footDiam = new Distance(Globals.GreatCircleDistance(this.Position, cg).Kilometers * 2.0, DistanceUnits.KILOMETERS);
                }
            }
        }
Beispiel #7
0
 public static CoordGeo CalculatePointOnRhumbLine(CoordGeo point, double azimuth, double dist)
 {
     double lat1 = point.LatRad;// (double)com.bbn.openmap.geo.Geo.radians(point.getLatitude());
     double lon1 = point.LonRad;// (double)com.bbn.openmap.geo.Geo.radians(point.getLongitude());
     double d = dist / 1855.3 * Math.PI / 10800.0;
     double lat = 0.0;
     double lon = 0.0;
     lat = lat1 + d * Math.Cos(azimuth);
     double dphi = Math.Log((1 + Math.Sin(lat)) / Math.Cos(lat)) - Math.Log((1 + Math.Sin(lat1)) / Math.Cos(lat1));
     double dlon = 0.0;
     if (Math.Abs(Math.Cos(azimuth)) > Math.Sqrt(0.00000000000001))
     {
         dlon = dphi * Math.Tan(azimuth);
     }
     else
     { // along parallel
         dlon = Math.Sin(azimuth) * d / Math.Cos(lat1);
     }
     lon = Mod(lon1 - dlon + Math.PI, 2 * Math.PI) - Math.PI;
     //System.out.println("calculatePointOnRhumbLine:  lat1 = "+lat1+"+  lon1 = "+lon1 + "    lat = "+lat+"+  lon = "+lon);
     return new CoordGeo(lat, lon, 0);// LatLonPoint((float)lat, (float)lon, true);
 }