public static COR Equatorial2Topocentric(double Alpha, double Delta, double Distance, double Longitude, double Latitude, double Height, double JD)
    {
        double RhoSinThetaPrime = CAAGlobe.RhoSinThetaPrime(Latitude, Height);
        double RhoCosThetaPrime = CAAGlobe.RhoCosThetaPrime(Latitude, Height);

        //Calculate the Sidereal time
        double theta = CAASidereal.ApparentGreenwichSiderealTime(JD);

        //Convert to radians
        Delta = CT.D2R(Delta);
        double cosDelta = Math.Cos(Delta);

        //Calculate the Parallax
        double pi    = Math.Asin(GFX.g_AAParallax_C1 / Distance);
        double sinpi = Math.Sin(pi);

        //Calculate the hour angle
        double H    = CT.H2R(theta - Longitude / 15 - Alpha);
        double cosH = Math.Cos(H);
        double sinH = Math.Sin(H);

        //Calculate the adjustment in right ascension
        double DeltaAlpha = Math.Atan2(-RhoCosThetaPrime * sinpi * sinH, cosDelta - RhoCosThetaPrime * sinpi * cosH);

        COR Topocentric = new COR();

        Topocentric.X = CT.M24(Alpha + CT.R2H(DeltaAlpha));
        Topocentric.Y = CT.R2D(Math.Atan2((Math.Sin(Delta) - RhoSinThetaPrime * sinpi) * Math.Cos(DeltaAlpha), cosDelta - RhoCosThetaPrime * sinpi * cosH));

        return(Topocentric);
    }
    public static double TrueLongitudeAscendingNode(double JD)
    {
        double TrueAscendingNode = MeanLongitudeAscendingNode(JD);

        double D = MeanElongation(JD);

        D = CT.D2R(D);
        double M = CAAEarth.SunMeanAnomaly(JD);

        M = CT.D2R(M);
        double Mdash = MeanAnomaly(JD);

        Mdash = CT.D2R(Mdash);
        double F = ArgumentOfLatitude(JD);

        F = CT.D2R(F);

        //Add the principal additive terms
        TrueAscendingNode -= 1.4979 * Math.Sin(2 * (D - F));
        TrueAscendingNode -= 0.1500 * Math.Sin(M);
        TrueAscendingNode -= 0.1226 * Math.Sin(2 * D);
        TrueAscendingNode += 0.1176 * Math.Sin(2 * F);
        TrueAscendingNode -= 0.0801 * Math.Sin(2 * (Mdash - F));

        return(CT.M360(TrueAscendingNode));
    }
    public static double DistanceBetweenPoints(double GeographicalLatitude1, double GeographicalLongitude1, double GeographicalLatitude2, double GeographicalLongitude2)
    {
        //Convert from degress to radians
        GeographicalLatitude1  = CT.D2R(GeographicalLatitude1);
        GeographicalLatitude2  = CT.D2R(GeographicalLatitude2);
        GeographicalLongitude1 = CT.D2R(GeographicalLongitude1);
        GeographicalLongitude2 = CT.D2R(GeographicalLongitude2);

        double F         = (GeographicalLatitude1 + GeographicalLatitude2) / 2;
        double G         = (GeographicalLatitude1 - GeographicalLatitude2) / 2;
        double lambda    = (GeographicalLongitude1 - GeographicalLongitude2) / 2;
        double sinG      = Math.Sin(G);
        double cosG      = Math.Cos(G);
        double cosF      = Math.Cos(F);
        double sinF      = Math.Sin(F);
        double sinLambda = Math.Sin(lambda);
        double cosLambda = Math.Cos(lambda);
        double S         = (sinG * sinG * cosLambda * cosLambda) + (cosF * cosF * sinLambda * sinLambda);
        double C         = (cosG * cosG * cosLambda * cosLambda) + (sinF * sinF * sinLambda * sinLambda);
        double w         = Math.Atan(Math.Sqrt(S / C));
        double R         = Math.Sqrt(S * C) / w;
        double D         = 2 * w * 6378.14;
        double Hprime    = (3 * R - 1) / (2 * C);
        double Hprime2   = (3 * R + 1) / (2 * S);
        double f         = 0.0033528131778969144060323814696721;

        return(D * (1 + (f * Hprime * sinF * sinF * cosG * cosG) - (f * Hprime2 * cosF * cosF * sinG * sinG)));
    }
Beispiel #4
0
//Static methods

    //////////////////////////////// Implementation ///////////////////////////////

    public static double SpringEquinox(int Year)
    {
        //calculate the approximate date
        double JDE = 0;

        if (Year <= 1000)
        {
            double Y        = Year / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 1721139.29189 + 365242.13740 * Y + 0.06134 * Ysquared + 0.00111 * Ycubed - 0.00071 * Y4;
        }
        else
        {
            double Y        = (Year - 2000) / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 2451623.80984 + 365242.37404 * Y + 0.05169 * Ysquared - 0.00411 * Ycubed - 0.00057 * Y4;
        }

        double Correction;

        do
        {
            double SunLongitude = CAASun.ApparentEclipticLongitude(JDE);
            Correction = 58 * Math.Sin(CT.D2R(-SunLongitude));
            JDE       += Correction;
        }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second

        return(JDE);
    }
Beispiel #5
0
    public static double SummerSolstice(int Year)
    {
        //calculate the approximate date
        double JDE = 0;

        if (Year <= 1000)
        {
            double Y        = Year / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 1721233.25401 + 365241.72562 * Y - 0.05323 * Ysquared + 0.00907 * Ycubed + 0.00025 * Y4;
        }
        else
        {
            double Y        = (Year - 2000) / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 2451716.56767 + 365241.62603 * Y + 0.00325 * Ysquared + 0.00888 * Ycubed - 0.00030 * Y4;
        }

        double Correction;

        do
        {
            double SunLongitude = CAASun.ApparentEclipticLongitude(JDE);
            Correction = 58 * Math.Sin(CT.D2R(90 - SunLongitude));
            JDE       += Correction;
        }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second

        return(JDE);
    }
Beispiel #6
0
    public static double AutumnEquinox(int Year)
    {
        //calculate the approximate date
        double JDE = 0;

        if (Year <= 1000)
        {
            double Y        = Year / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 1721325.70455 + 365242.49558 * Y - 0.11677 * Ysquared - 0.00297 * Ycubed + 0.00074 * Y4;
        }
        else
        {
            double Y        = (Year - 2000) / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 2451810.21715 + 365242.01767 * Y - 0.11575 * Ysquared + 0.00337 * Ycubed + 0.00078 * Y4;
        }

        double Correction;

        do
        {
            double SunLongitude = CAASun.ApparentEclipticLongitude(JDE);
            Correction = 58 * Math.Sin(CT.D2R(180 - SunLongitude));
            JDE       += Correction;
        }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second

        return(JDE);
    }
Beispiel #7
0
    public static double WinterSolstice(int Year)
    {
        //calculate the approximate date
        double JDE = 0;

        if (Year <= 1000)
        {
            double Y        = Year / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 1721414.39987 + 365242.88257 * Y - 0.00769 * Ysquared - 0.00933 * Ycubed - 0.00006 * Y4;
        }
        else
        {
            double Y        = (Year - 2000) / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 2451900.05952 + 365242.74049 * Y - 0.06223 * Ysquared - 0.00823 * Ycubed + 0.00032 * Y4;
        }

        double Correction;

        do
        {
            double SunLongitude = CAASun.ApparentEclipticLongitude(JDE);
            Correction = 58 * Math.Sin(CT.D2R(270 - SunLongitude));
            JDE       += Correction;
        }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second

        return(JDE);
    }
//Static methods
//Tangible Process Only End


    ////////////////////////////////// Implementation /////////////////////////////

    public static CAABinaryStarDetails Calculate(double t, double P, double T, double e, double a, double i, double omega, double w)
    {
        double n = 360 / P;
        double M = CT.M360(n * (t - T));
        double E = CAAKepler.Calculate(M, e);

        E     = CT.D2R(E);
        i     = CT.D2R(i);
        w     = CT.D2R(w);
        omega = CT.D2R(omega);

        CAABinaryStarDetails details = new CAABinaryStarDetails();

        details.r = a * (1 - e * Math.Cos(E));

        double v = Math.Atan(Math.Sqrt((1 + e) / (1 - e)) * Math.Tan(E / 2)) * 2;

        details.Theta = Math.Atan2(Math.Sin(v + w) * Math.Cos(i), Math.Cos(v + w)) + omega;
        details.Theta = CT.M360(CT.R2D(details.Theta));

        double sinvw = Math.Sin(v + w);
        double cosvw = Math.Cos(v + w);
        double cosi  = Math.Cos(i);

        details.Rho = details.r * Math.Sqrt((sinvw * sinvw * cosi * cosi) + (cosvw * cosvw));

        return(details);
    }
Beispiel #9
0
//Static methods

    ///////////////////////// Implementation //////////////////////////////////////

    public static double Calculate(double JD)
    {
        double rho        = (JD - 2451545) / 365250;
        double rhosquared = rho * rho;
        double rhocubed   = rhosquared * rho;
        double rho4       = rhocubed * rho;
        double rho5       = rho4 * rho;

        //Calculate the Suns mean longitude
        double L0 = CT.M360(280.4664567 + 360007.6982779 * rho + 0.03032028 * rhosquared + rhocubed / 49931 - rho4 / 15300 - rho5 / 2000000);

        //Calculate the Suns apparent right ascension
        double SunLong    = CAASun.ApparentEclipticLongitude(JD);
        double SunLat     = CAASun.ApparentEclipticLatitude(JD);
        double epsilon    = CAANutation.TrueObliquityOfEcliptic(JD);
        COR    Equatorial = CT.Ec2Eq(SunLong, SunLat, epsilon);

        epsilon = CT.D2R(epsilon);
        double E = L0 - 0.0057183 - Equatorial.X * 15 + CT.DMS2D(0, 0, CAANutation.NutationInLongitude(JD)) * Math.Cos(epsilon);

        if (E > 180)
        {
            E = -(360 - E);
        }
        E *= 4; //Convert to minutes of time

        return(E);
    }
    public static CAAEclipticalElementDetails FK4B1950ToFK5J2000(double i0, double w0, double omega0)
    {
        //convert to radians
        double L         = CT.D2R(5.19856209);
        double J         = CT.D2R(0.00651966);
        double i0rad     = CT.D2R(i0);
        double omega0rad = CT.D2R(omega0);
        double sini0rad  = Math.Sin(i0rad);
        double cosi0rad  = Math.Cos(i0rad);

        //Calculate some values used later
        double cosJ = Math.Cos(J);
        double sinJ = Math.Sin(J);
        double W    = L + omega0rad;
        double cosW = Math.Cos(W);
        double sinW = Math.Sin(W);
        double A    = sinJ * sinW;
        double B    = sini0rad * cosJ + cosi0rad * sinJ * cosW;

        //Calculate the values
        CAAEclipticalElementDetails details = new CAAEclipticalElementDetails();

        details.i = CT.R2D(Math.Asin(Math.Sqrt(A * A + B * B)));
        double cosi = cosi0rad * cosJ - sini0rad * sinJ * cosW;

        if (cosi < 0)
        {
            details.i = 180 - details.i;
        }

        details.w     = CT.M360(w0 + CT.R2D(Math.Atan2(A, B)));
        details.omega = CT.M360(CT.R2D(Math.Atan2(sini0rad * sinW, cosi0rad * sinJ + sini0rad * cosJ * cosW)) - 4.50001688);

        return(details);
    }
Beispiel #11
0
    public static double PassageThroNode(double k)
    {
        //convert from K to T
        double T        = k / 1342.23;
        double Tsquared = T * T;
        double Tcubed   = Tsquared * T;
        double T4       = Tcubed * T;

        double D     = CT.M360(183.6380 + 331.73735682 * k + 0.0014852 * Tsquared + 0.00000209 * Tcubed - 0.000000010 * T4);
        double M     = CT.M360(17.4006 + 26.82037250 * k + 0.0001186 * Tsquared + 0.00000006 * Tcubed);
        double Mdash = CT.M360(38.3776 + 355.52747313 * k + 0.0123499 * Tsquared + 0.000014627 * Tcubed - 0.000000069 * T4);
        double omega = CT.M360(123.9767 - 1.44098956 * k + 0.0020608 * Tsquared + 0.00000214 * Tcubed - 0.000000016 * T4);
        double V     = CT.M360(299.75 + 132.85 * T - 0.009173 * Tsquared);
        double P     = CT.M360(omega + 272.75 - 2.3 * T);
        double E     = 1 - 0.002516 * T - 0.0000074 * Tsquared;

        //convert to radians
        D = CT.D2R(D);
        double D2 = 2 * D;
        double D4 = D2 * D2;

        M     = CT.D2R(M);
        Mdash = CT.D2R(Mdash);
        double Mdash2 = 2 * Mdash;

        omega = CT.D2R(omega);
        V     = CT.D2R(V);
        P     = CT.D2R(P);

        double JD = 2451565.1619 + 27.212220817 * k + 0.0002762 * Tsquared + 0.000000021 * Tcubed - 0.000000000088 * T4 - 0.4721 * Math.Sin(Mdash) - 0.1649 * Math.Sin(D2) - 0.0868 * Math.Sin(D2 - Mdash) + 0.0084 * Math.Sin(D2 + Mdash) - E * 0.0083 * Math.Sin(D2 - M) - E * 0.0039 * Math.Sin(D2 - M - Mdash) + 0.0034 * Math.Sin(Mdash2) - 0.0031 * Math.Sin(D2 - Mdash2) + E * 0.0030 * Math.Sin(D2 + M) + E * 0.0028 * Math.Sin(M - Mdash) + E * 0.0026 * Math.Sin(M) + 0.0025 * Math.Sin(D4) + 0.0024 * Math.Sin(D) + E * 0.0022 * Math.Sin(M + Mdash) + 0.0017 * Math.Sin(omega) + 0.0014 * Math.Sin(D4 - Mdash) + E * 0.0005 * Math.Sin(D2 + M - Mdash) + E * 0.0004 * Math.Sin(D2 - M + Mdash) - E * 0.0003 * Math.Sin(D2 - M * M) + E * 0.0003 * Math.Sin(D4 - M) + 0.0003 * Math.Sin(V) + 0.0003 * Math.Sin(P);

        return(JD);
    }
    public static double TrueApogee(double k)
    {
        double MeanJD = MeanApogee(k);

        //convert from K to T
        double T        = k / 1325.55;
        double Tsquared = T * T;
        double Tcubed   = Tsquared * T;
        double T4       = Tcubed * T;

        double D = CT.M360(171.9179 + 335.9106046 * k - 0.0100383 * Tsquared - 0.00001156 * Tcubed + 0.000000055 * T4);

        D = CT.D2R(D);
        double M = CT.M360(347.3477 + 27.1577721 * k - 0.0008130 * Tsquared - 0.0000010 * Tcubed);

        M = CT.D2R(M);
        double F = CT.M360(316.6109 + 364.5287911 * k - 0.0125053 * Tsquared - 0.0000148 * Tcubed);

        F = CT.D2R(F);

        int    nApogeeCoefficients = GFX.g_MoonPerigeeApogeeCoefficients2.Length;
        double Sigma = 0;

        for (int i = 0; i < nApogeeCoefficients; i++)
        {
            Sigma += (GFX.g_MoonPerigeeApogeeCoefficients2[i].C + T * GFX.g_MoonPerigeeApogeeCoefficients2[i].T) * Math.Sin(D * GFX.g_MoonPerigeeApogeeCoefficients2[i].D + M * GFX.g_MoonPerigeeApogeeCoefficients2[i].M + F * GFX.g_MoonPerigeeApogeeCoefficients2[i].F);
        }

        return(MeanJD + Sigma);
    }
    public static double ApogeeParallax(double k)
    {
        //convert from K to T
        double T        = k / 1325.55;
        double Tsquared = T * T;
        double Tcubed   = Tsquared * T;
        double T4       = Tcubed * T;

        double D = CT.M360(171.9179 + 335.9106046 * k - 0.0100383 * Tsquared - 0.00001156 * Tcubed + 0.000000055 * T4);

        D = CT.D2R(D);
        double M = CT.M360(347.3477 + 27.1577721 * k - 0.0008130 * Tsquared - 0.0000010 * Tcubed);

        M = CT.D2R(M);
        double F = CT.M360(316.6109 + 364.5287911 * k - 0.0125053 * Tsquared - 0.0000148 * Tcubed);

        F = CT.D2R(F);

        int    nApogeeCoefficients = GFX.g_MoonPerigeeApogeeCoefficients4.Length;
        double Parallax            = 3245.251;

        for (int i = 0; i < nApogeeCoefficients; i++)
        {
            Parallax += (GFX.g_MoonPerigeeApogeeCoefficients4[i].C + T * GFX.g_MoonPerigeeApogeeCoefficients4[i].T) * Math.Cos(D * GFX.g_MoonPerigeeApogeeCoefficients4[i].D + M * GFX.g_MoonPerigeeApogeeCoefficients4[i].M + F * GFX.g_MoonPerigeeApogeeCoefficients4[i].F);
        }

        return(Parallax / 3600);
    }
//Conversion functions
    public static COR Equatorial2TopocentricDelta(double Alpha, double Delta, double Distance, double Longitude, double Latitude, double Height, double JD)
    {
        double RhoSinThetaPrime = CAAGlobe.RhoSinThetaPrime(Latitude, Height);
        double RhoCosThetaPrime = CAAGlobe.RhoCosThetaPrime(Latitude, Height);

        //Calculate the Sidereal time
        double theta = CAASidereal.ApparentGreenwichSiderealTime(JD);

        //Convert to radians
        Delta = CT.D2R(Delta);
        double cosDelta = Math.Cos(Delta);

        //Calculate the Parallax
        double pi = Math.Asin(GFX.g_AAParallax_C1 / Distance);

        //Calculate the hour angle
        double H    = CT.H2R(theta - Longitude / 15 - Alpha);
        double cosH = Math.Cos(H);
        double sinH = Math.Sin(H);

        COR DeltaTopocentric = new COR();

        DeltaTopocentric.X = CT.R2H(-pi * RhoCosThetaPrime * sinH / cosDelta);
        DeltaTopocentric.Y = CT.R2D(-pi * (RhoSinThetaPrime * cosDelta - RhoCosThetaPrime * cosH * Math.Sin(Delta)));
        return(DeltaTopocentric);
    }
    public static double EclipticLongitude(double JD)
    {
        double Ldash        = MeanLongitude(JD);
        double LdashDegrees = Ldash;

        Ldash = CT.D2R(Ldash);
        double D = MeanElongation(JD);

        D = CT.D2R(D);
        double M = CAAEarth.SunMeanAnomaly(JD);

        M = CT.D2R(M);
        double Mdash = MeanAnomaly(JD);

        Mdash = CT.D2R(Mdash);
        double F = ArgumentOfLatitude(JD);

        F = CT.D2R(F);

        double E = CAAEarth.Eccentricity(JD);
        double T = (JD - 2451545) / 36525;

        double A1 = CT.M360(119.75 + 131.849 * T);

        A1 = CT.D2R(A1);
        double A2 = CT.M360(53.09 + 479264.290 * T);

        A2 = CT.D2R(A2);
        double A3 = CT.M360(313.45 + 481266.484 * T);

        A3 = CT.D2R(A3);

        int nLCoefficients = GFX.g_MoonCoefficients1.Length;

        Debug.Assert(GFX.g_MoonCoefficients2.Length == nLCoefficients);
        double SigmaL = 0;

        for (int i = 0; i < nLCoefficients; i++)
        {
            double ThisSigma = GFX.g_MoonCoefficients2[i].A * Math.Sin(GFX.g_MoonCoefficients1[i].D * D + GFX.g_MoonCoefficients1[i].M * M + GFX.g_MoonCoefficients1[i].Mdash * Mdash + GFX.g_MoonCoefficients1[i].F * F);

            if (GFX.g_MoonCoefficients1[i].M != 0)
            {
                ThisSigma *= E;
            }

            SigmaL += ThisSigma;
        }

        //Finally the additive terms
        SigmaL += 3958 * Math.Sin(A1);
        SigmaL += 1962 * Math.Sin(Ldash - F);
        SigmaL += 318 * Math.Sin(A2);

        //And finally apply the nutation in longitude
        double NutationInLong = CAANutation.NutationInLongitude(JD);

        return(CT.M360(LdashDegrees + SigmaL / 1000000 + NutationInLong / 3600));
    }
//Static methods

    /////////////////////////// Implementation ////////////////////////////////////

    public static double RhoSinThetaPrime(double GeographicalLatitude, double Height)
    {
        GeographicalLatitude = CT.D2R(GeographicalLatitude);

        double U = Math.Atan(0.99664719 * Math.Tan(GeographicalLatitude));

        return(0.99664719 * Math.Sin(U) + (Height / 6378149 * Math.Sin(GeographicalLatitude)));
    }
Beispiel #17
0
//Static methods

    ////////////////////// Implementation /////////////////////////////////////////

    public static double ParallacticAngle(double HourAngle, double Latitude, double delta)
    {
        HourAngle = CT.H2R(HourAngle);
        Latitude  = CT.D2R(Latitude);
        delta     = CT.D2R(delta);

        return(CT.R2D(Math.Atan2(Math.Sin(HourAngle), Math.Tan(Latitude) * Math.Cos(delta) - Math.Sin(delta) * Math.Cos(HourAngle))));
    }
Beispiel #18
0
    public static double PhaseAngle(double GeocentricElongation, double EarthObjectDistance, double EarthSunDistance)
    {
        //Convert from degrees to radians
        GeocentricElongation = CT.D2R(GeocentricElongation);

        //Return the result
        return(CT.M360(CT.R2D(Math.Atan2(EarthSunDistance * Math.Sin(GeocentricElongation), EarthObjectDistance - EarthSunDistance * Math.Cos(GeocentricElongation)))));
    }
Beispiel #19
0
    public static double IlluminatedFraction(double PhaseAngle)
    {
        //Convert from degrees to radians
        PhaseAngle = CT.D2R(PhaseAngle);

        //Return the result
        return((1 + Math.Cos(PhaseAngle)) / 2);
    }
    public static double SaturnMagnitudeAA(double r, double Delta, double DeltaU, double B)
    {
        //Convert from degrees to radians
        B = CT.D2R(B);
        double sinB = Math.Sin(B);

        return(-8.88 + 5 * Util.Log10(r * Delta) + 0.044 * Math.Abs(DeltaU) - 2.60 * Math.Sin(Math.Abs(B)) + 1.25 * sinB * sinB);
    }
    public static double EclipticLatitude(double JD)
    {
        double Ldash = MeanLongitude(JD);

        Ldash = CT.D2R(Ldash);
        double D = MeanElongation(JD);

        D = CT.D2R(D);
        double M = CAAEarth.SunMeanAnomaly(JD);

        M = CT.D2R(M);
        double Mdash = MeanAnomaly(JD);

        Mdash = CT.D2R(Mdash);
        double F = ArgumentOfLatitude(JD);

        F = CT.D2R(F);

        double E = CAAEarth.Eccentricity(JD);
        double T = (JD - 2451545) / 36525;

        double A1 = CT.M360(119.75 + 131.849 * T);

        A1 = CT.D2R(A1);
        double A2 = CT.M360(53.09 + 479264.290 * T);

        A2 = CT.D2R(A2);
        double A3 = CT.M360(313.45 + 481266.484 * T);

        A3 = CT.D2R(A3);

        int nBCoefficients = GFX.g_MoonCoefficients3.Length;

        Debug.Assert(GFX.g_MoonCoefficients4.Length == nBCoefficients);
        double SigmaB = 0;

        for (int i = 0; i < nBCoefficients; i++)
        {
            double ThisSigma = GFX.g_MoonCoefficients4[i] * Math.Sin(GFX.g_MoonCoefficients3[i].D * D + GFX.g_MoonCoefficients3[i].M * M + GFX.g_MoonCoefficients3[i].Mdash * Mdash + GFX.g_MoonCoefficients3[i].F * F);

            if (GFX.g_MoonCoefficients3[i].M != 0)
            {
                ThisSigma *= E;
            }

            SigmaB += ThisSigma;
        }

        //Finally the additive terms
        SigmaB -= 2235 * Math.Sin(Ldash);
        SigmaB += 382 * Math.Sin(A3);
        SigmaB += 175 * Math.Sin(A1 - F);
        SigmaB += 175 * Math.Sin(A1 + F);
        SigmaB += 127 * Math.Sin(Ldash - Mdash);
        SigmaB -= 115 * Math.Sin(Ldash + Mdash);

        return(SigmaB / 1000000);
    }
Beispiel #22
0
    public static double NutationInRightAscension(double Alpha, double Delta, double Obliquity, double NutationInLongitude, double NutationInObliquity)
    {
        //Convert to radians
        Alpha     = CT.H2R(Alpha);
        Delta     = CT.D2R(Delta);
        Obliquity = CT.D2R(Obliquity);

        return((Math.Cos(Obliquity) + Math.Sin(Obliquity) * Math.Sin(Alpha) * Math.Tan(Delta)) * NutationInLongitude - Math.Cos(Alpha) * Math.Tan(Delta) * NutationInObliquity);
    }
Beispiel #23
0
    public static double NutationInDeclination(double Alpha, double Delta, double Obliquity, double NutationInLongitude, double NutationInObliquity)
    {
        //Convert to radians
        Alpha     = CT.H2R(Alpha);
        Delta     = CT.D2R(Delta);
        Obliquity = CT.D2R(Obliquity);

        return(Math.Sin(Obliquity) * Math.Cos(Alpha) * NutationInLongitude + Math.Sin(Alpha) * NutationInObliquity);
    }
    public static double RadiusOfCurvature(double GeographicalLatitude)
    {
        //Convert from degress to radians
        GeographicalLatitude = CT.D2R(GeographicalLatitude);

        double sinGeo = Math.Sin(GeographicalLatitude);

        return((6378.14 * (1 - 0.0066943847614084)) / Math.Pow((1 - 0.0066943847614084 * sinGeo * sinGeo), 1.5));
    }
    public static double RadiusOfParallelOfLatitude(double GeographicalLatitude)
    {
        //Convert from degress to radians
        GeographicalLatitude = CT.D2R(GeographicalLatitude);

        double sinGeo = Math.Sin(GeographicalLatitude);

        return((6378.14 * Math.Cos(GeographicalLatitude)) / (Math.Sqrt(1 - 0.0066943847614084 * sinGeo * sinGeo)));
    }
    public static double RhoCosThetaPrime(double GeographicalLatitude, double Height)
    {
        //Convert from degress to radians
        GeographicalLatitude = CT.D2R(GeographicalLatitude);

        double U = Math.Atan(0.99664719 * Math.Tan(GeographicalLatitude));

        return(Math.Cos(U) + (Height / 6378149 * Math.Cos(GeographicalLatitude)));
    }
//Static methods

    /////////////////////////// Implementation ////////////////////////////////////

    public static CAAEclipticalElementDetails Calculate(double i0, double w0, double omega0, double JD0, double JD)
    {
        double T        = (JD0 - 2451545.0) / 36525;
        double Tsquared = T * T;
        double t        = (JD - JD0) / 36525;
        double tsquared = t * t;
        double tcubed   = tsquared * t;

        //Now convert to radians
        double i0rad     = CT.D2R(i0);
        double omega0rad = CT.D2R(omega0);

        double eta = (47.0029 - 0.06603 * T + 0.000598 * Tsquared) * t + (-0.03302 + 0.000598 * T) * tsquared + 0.00006 * tcubed;

        eta = CT.D2R(CT.DMS2D(0, 0, eta));

        double pi = 174.876384 * 3600 + 3289.4789 * T + 0.60622 * Tsquared - (869.8089 + 0.50491 * T) * t + 0.03536 * tsquared;

        pi = CT.D2R(CT.DMS2D(0, 0, pi));

        double p = (5029.0966 + 2.22226 * T - 0.000042 * Tsquared) * t + (1.11113 - 0.000042 * T) * tsquared - 0.000006 * tcubed;

        p = CT.D2R(CT.DMS2D(0, 0, p));

        double sini0rad        = Math.Sin(i0rad);
        double cosi0rad        = Math.Cos(i0rad);
        double sinomega0rad_pi = Math.Sin(omega0rad - pi);
        double cosomega0rad_pi = Math.Cos(omega0rad - pi);
        double sineta          = Math.Sin(eta);
        double coseta          = Math.Cos(eta);
        double A    = sini0rad * sinomega0rad_pi;
        double B    = -sineta * cosi0rad + coseta * sini0rad * cosomega0rad_pi;
        double irad = Math.Asin(Math.Sqrt(A * A + B * B));

        CAAEclipticalElementDetails details = new CAAEclipticalElementDetails();

        details.i = CT.R2D(irad);
        double cosi = cosi0rad * coseta + sini0rad * sineta * cosomega0rad_pi;

        if (cosi < 0)
        {
            details.i = 180 - details.i;
        }

        double phi = pi + p;

        details.omega = CT.M360(CT.R2D(Math.Atan2(A, B) + phi));

        A = -sineta * sinomega0rad_pi;
        B = sini0rad * coseta - cosi0rad * sineta * cosomega0rad_pi;
        double deltaw = CT.R2D(Math.Atan2(A, B));

        details.w = CT.M360(w0 + deltaw);

        return(details);
    }
Beispiel #28
0
    public static double PositionAngle(double Alpha0, double Delta0, double Alpha, double Delta)
    {
        //Convert to radians
        Alpha0 = CT.H2R(Alpha0);
        Alpha  = CT.H2R(Alpha);
        Delta0 = CT.D2R(Delta0);
        Delta  = CT.D2R(Delta);

        return(CT.M360(CT.R2D(Math.Atan2(Math.Cos(Delta0) * Math.Sin(Alpha0 - Alpha), Math.Sin(Delta0) * Math.Cos(Delta) - Math.Cos(Delta0) * Math.Sin(Delta) * Math.Cos(Alpha0 - Alpha)))));
    }
    public static double PhaseAngleRectangular(double x, double y, double z, double B, double L, double Delta)
    {
        //Convert from degrees to radians
        B = CT.D2R(B);
        L = CT.D2R(L);
        double cosB = Math.Cos(B);

        //Return the result
        return(CT.M360(CT.R2D(Math.Acos((x * cosB * Math.Cos(L) + y * cosB * Math.Sin(L) + z * Math.Sin(B)) / Delta))));
    }
    public static double PhaseAngle2(double R, double R0, double B, double L, double L0, double Delta)
    {
        //Convert from degrees to radians
        B  = CT.D2R(B);
        L  = CT.D2R(L);
        L0 = CT.D2R(L0);

        //Return the result
        return(CT.M360(CT.R2D(Math.Acos((R - R0 * Math.Cos(B) * Math.Cos(L - L0)) / Delta))));
    }