Esempio n. 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));
        }
		// ///////////////////////////////////////////////////////////////////
		// 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));
		}