Ejemplo n.º 1
0
        // MEarth.Distance(double, double, double, double)
        /// <summary>
        /// Liefert die geographische Entfernung zweier Orte auf der Erdoberfläche.
        /// </summary>
        /// <param name="lamdaA">Geographische Länge des Ortes A.</param>
        /// <param name="phiA">Geographische Breite des Ortes A.</param>
        /// <param name="lamdaB">Geographische Länge des Ortes B.</param>
        /// <param name="phiB">Geographische Breite des Ortes B.</param>
        /// <returns>Geographische Entfernung zweier Orte auf der Erdoberfläche.</returns>
        public static double Distance(double lamdaA, double phiA, double lamdaB, double phiB)
        {
            // Lokale Felder einrichten
            double f = (phiA + phiB) / 2.0;
            double g = (phiA - phiB) / 2.0;
            double l = (lamdaA - lamdaB) / 2.0;

            // Lokale Hilfsfelder einrichten
            double sinF = MMath.Sin(f);
            double sinG = MMath.Sin(g);
            double sinL = MMath.Sin(l);
            double cosF = MMath.Cos(f);
            double cosG = MMath.Cos(g);
            double cosL = MMath.Cos(l);

            // Koeffizienten berechnen
            double s = sinG * sinG * cosL * cosL + cosF * cosF * sinL * sinL;
            double c = cosG * cosG * cosL * cosL + sinF * sinF * sinL * sinL;

            // Kartesische Koordinaten berechnen
            double o  = MMath.ArcTan(MMath.Sqr(s / c));
            double r  = MMath.Sqr(s * c) / o;
            double d  = 2.0 * 6378.14 * o;
            double h1 = (3.0 * r - 1.0) / (2.0 * c);
            double h2 = (3.0 * r + 1.0) / (2.0 * s);

            // Entfernung berechnen
            return(d * (1.0 + 0.003352858 * (h1 * sinF * sinF * cosG * cosG - h2 * cosF * cosF * sinG * sinG)));
        }
Ejemplo n.º 2
0
        // MEarth.Direction(double, double, double, double)
        /// <summary>
        /// Liefert die geographische Richtung zweier Orte auf der Erdoberfläche.
        /// </summary>
        /// <param name="lamdaA">Geographische Länge des Ortes A.</param>
        /// <param name="phiA">Geographische Breite des Ortes A.</param>
        /// <param name="lamdaB">Geographische Länge des Ortes B.</param>
        /// <param name="phiB">Geographische Breite des Ortes B.</param>
        /// <returns>Geographische Richtung zweier Orte auf der Erdoberfläche.</returns>
        public static double Direction(double lamdaA, double phiA, double lamdaB, double phiB)
        {
            // Lokale Felder einrichten
            double d = MMath.Cos(phiA) * MMath.Tan(phiB) - MMath.Sin(phiA) * MMath.Cos(lamdaA - lamdaB);

            // Winkel berechnen und liefern
            if (d == 0.0)
            {
                return(0.0);
            }
            return(MMath.Mod(MMath.ArcTan(MMath.Sin(lamdaA - lamdaB), d), MMath.Pi2));
        }
Ejemplo n.º 3
0
        // MMoon.PhaseAngle(double)
        /// <summary>
        /// Liefert den Phasenwinkel zur julianischen Tageszahl.
        /// </summary>
        /// <param name="jd">Julianische Tageszahl.</param>
        /// <returns>Phasenwinkel zur julianischen Tageszahl.</returns>
        public static double PhaseAngle(double jd)
        {
            // Lokale Felder einrichten
            double betM = MMoon.Latitude(EPrecision.Low, jd);
            double lamM = MMoon.Longitude(EPrecision.Low, jd);
            double lamS = MSun.Longitude(EPrecision.Low, jd);

            // Geozentrische Elongation berechnen
            double cosPsi = MMath.Cos(betM) * MMath.Cos(lamM - lamS);
            double sinPsi = MMath.Sin(MMath.ArcCos(cosPsi));

            // Radii berechnen
            double delM = MMoon.Radius(EPrecision.Low, jd);
            double delS = MSun.Radius(EPrecision.Low, jd);

            // Phasenwinkel berechnen
            double i = MMath.ToDeg(MMath.ArcTan((delS * sinPsi) / (delM - delS * cosPsi)));

            if (lamM - lamS < 0.0)
            {
                i *= 1.0;
            }
            return(i);
        }