Exemplo n.º 1
0
        // Time not used in current calculation, but might be need in future refinements
        public static EquatorialCoordinate From(EclipticCoordinate eclipticCoordinate, Time time)
        {
            // Calculate right ascension and declination
            Angle angleEpsilon = Angle.FromDegrees(23.4392911); // obliquity of the ecliptic -- see Meeus, pg. 92

            Angle angleRightAscension = Angle.ArcTangent(eclipticCoordinate.Longitude.Sine * angleEpsilon.Cosine - eclipticCoordinate.Latitude.Tangent * angleEpsilon.Sine, eclipticCoordinate.Longitude.Cosine);

            angleRightAscension.NormalizePositive();

            Angle angleDeclination = Angle.Zero;

            angleDeclination.Sine = eclipticCoordinate.Latitude.Sine * angleEpsilon.Cosine + eclipticCoordinate.Latitude.Cosine * angleEpsilon.Sine * eclipticCoordinate.Longitude.Sine;

            angleDeclination.NormalizeAroundZero();

            return(new EquatorialCoordinate(angleRightAscension, angleDeclination));
        }
Exemplo n.º 2
0
        public static HorizontalCoordinate From(EquatorialCoordinate equatorialCoordinate, GeographicCoordinate geographicCoordinate, Time time)
        {
            // Calculate hour angle
            Angle localHourAngle = time.GreenwichSiderealTime - geographicCoordinate.Longitude - equatorialCoordinate.RightAscension;

            // Calculate azimuth
            Angle azimuth = Angle.ArcTangent(localHourAngle.Sine, localHourAngle.Cosine * geographicCoordinate.Latitude.Sine - equatorialCoordinate.Declination.Tangent * geographicCoordinate.Latitude.Cosine);

            // Adjustment for azimuth eastward from north
            azimuth += Angle.Straight;

            azimuth.NormalizeAroundZero();

            // Calculate altitude
            Angle altitude = Angle.Zero;

            altitude.Sine = geographicCoordinate.Latitude.Sine * equatorialCoordinate.Declination.Sine + geographicCoordinate.Latitude.Cosine * equatorialCoordinate.Declination.Cosine * localHourAngle.Cosine;
            altitude.NormalizeAroundZero();

            return(new HorizontalCoordinate(azimuth, altitude));
        }