Exemplo n.º 1
0
    public static CAASelenographicMoonDetails CalculateSelenographicPositionOfSun(double JD)
    {
        double R       = CAAEarth.RadiusVector(JD) * 149597970;
        double Delta   = CAAMoon.RadiusVector(JD);
        double lambda0 = CAASun.ApparentEclipticLongitude(JD);
        double lambda  = CAAMoon.EclipticLongitude(JD);
        double beta    = CAAMoon.EclipticLatitude(JD);

        double lambdah = CAACoordinateTransformation.MapTo0To360Range(lambda0 + 180 + Delta / R * 57.296 * Math.Cos(CAACoordinateTransformation.DegreesToRadians(beta)) * Math.Sin(CAACoordinateTransformation.DegreesToRadians(lambda0 - lambda)));
        double betah   = Delta / R * beta;

        //What will be the return value
        CAASelenographicMoonDetails details = new CAASelenographicMoonDetails();

        //Calculate the optical libration
        double omega   = 0;
        double DeltaU  = 0;
        double sigma   = 0;
        double I       = 0;
        double rho     = 0;
        double ldash0  = 0;
        double bdash0  = 0;
        double ldash20 = 0;
        double bdash20 = 0;
        double epsilon = 0;

        CalculateOpticalLibration(JD, lambdah, betah, ref ldash0, ref bdash0, ref ldash20, ref bdash20, ref epsilon, ref omega, ref DeltaU, ref sigma, ref I, ref rho);

        details.l0 = ldash0 + ldash20;
        details.b0 = bdash0 + bdash20;
        details.c0 = CAACoordinateTransformation.MapTo0To360Range(450 - details.l0);
        return(details);
    }
Exemplo n.º 2
0
    protected static CAAPhysicalMoonDetails CalculateHelper(double JD, ref double Lambda, ref double Beta, ref double epsilon, ref CAA2DCoordinate Equatorial)
    {
        //What will be the return value
        CAAPhysicalMoonDetails details = new CAAPhysicalMoonDetails();

        //Calculate the initial quantities
        Lambda = CAAMoon.EclipticLongitude(JD);
        Beta   = CAAMoon.EclipticLatitude(JD);

        //Calculate the optical libration
        double omega  = 0;
        double DeltaU = 0;
        double sigma  = 0;
        double I      = 0;
        double rho    = 0;

        CalculateOpticalLibration(JD, Lambda, Beta, ref details.ldash, ref details.bdash, ref details.ldash2, ref details.bdash2, ref epsilon, ref omega, ref DeltaU, ref sigma, ref I, ref rho);
        double epsilonrad = CAACoordinateTransformation.DegreesToRadians(epsilon);

        //Calculate the total libration
        details.l = details.ldash + details.ldash2;
        details.b = details.bdash + details.bdash2;
        double b = CAACoordinateTransformation.DegreesToRadians(details.b);

        //Calculate the position angle
        double V     = omega + DeltaU + CAACoordinateTransformation.DegreesToRadians(sigma) / Math.Sin(I);
        double I_rho = I + CAACoordinateTransformation.DegreesToRadians(rho);
        double X     = Math.Sin(I_rho) * Math.Sin(V);
        double Y     = Math.Sin(I_rho) * Math.Cos(V) * Math.Cos(epsilonrad) - Math.Cos(I_rho) * Math.Sin(epsilonrad);
        double w     = Math.Atan2(X, Y);

        Equatorial = CAACoordinateTransformation.Ecliptic2Equatorial(Lambda, Beta, epsilon);
        double Alpha = CAACoordinateTransformation.HoursToRadians(Equatorial.X);

        details.P = CAACoordinateTransformation.RadiansToDegrees(Math.Asin(Math.Sqrt(X * X + Y * Y) * Math.Cos(Alpha - w) / (Math.Cos(b))));

        return(details);
    }
        public static AstroRaDec GetPlanet(double jDate, EO planetIn, double locLat, double locLong, double locHeight)
        {
            int planet = (int)planetIn;

//C++ TO C# CONVERTER NOTE: This static local variable declaration (not allowed in C#) has been moved just prior to the method:
//			static CAAGalileanMoonsDetails galDetails;
//C++ TO C# CONVERTER NOTE: This static local variable declaration (not allowed in C#) has been moved just prior to the method:
//			static CAAEllipticalPlanetaryDetails jupDetails;
//C++ TO C# CONVERTER NOTE: This static local variable declaration (not allowed in C#) has been moved just prior to the method:
//			static CAAPhysicalJupiterDetails jupPhisical;
//C++ TO C# CONVERTER NOTE: This static local variable declaration (not allowed in C#) has been moved just prior to the method:
//			static double jDateLast = 0;

            locLong = -locLong;
            if (planet < 9)
            {
                EPD Details   = ELL.Calculate(jDate, planetIn);
                COR corrected = CAAParallax.Equatorial2Topocentric(Details.ApparentGeocentricRA, Details.ApparentGeocentricDeclination, Details.ApparentGeocentricDistance, locLong, locLat, locHeight, jDate);
                return(new AstroRaDec(corrected.X, corrected.Y, Details.ApparentGeocentricDistance, false, false));
            }
            else if (planet == 9)
            {
                double lat       = CAAMoon.EclipticLatitude(jDate);
                double lng       = CAAMoon.EclipticLongitude(jDate);
                double dis       = CAAMoon.RadiusVector(jDate) / 149598000;
                double epsilon   = CAANutation.TrueObliquityOfEcliptic(jDate);
                COR    d         = CT.Ec2Eq(lng, lat, epsilon);
                COR    corrected = CAAParallax.Equatorial2Topocentric(d.X, d.Y, dis, locLong, locLat, locHeight, jDate);

                return(new AstroRaDec(corrected.X, corrected.Y, dis, false, false));
            }
            else
            {
                if (jDate != jDateLast)
                {
                    jupDetails  = ELL.Calculate(jDate, (EO)4);
                    jupPhisical = CAAPhysicalJupiter.Calculate(jDate);
                    COR corrected = CAAParallax.Equatorial2Topocentric(jupDetails.ApparentGeocentricRA, jupDetails.ApparentGeocentricDeclination, jupDetails.ApparentGeocentricDistance, locLong, locLat, locHeight, jDate);
                    jupDetails.ApparentGeocentricRA          = corrected.X;
                    jupDetails.ApparentGeocentricDeclination = corrected.Y;
                    galDetails = GM.Calculate(jDate);
                    jDateLast  = jDate;
                }


                double jupiterDiameter = 0.000954501;
                double scale           = (Math.Atan(.5 * (jupiterDiameter / jupDetails.ApparentGeocentricDistance))) / 3.1415927 * 180;

                double raScale = (scale / Math.Cos(jupDetails.ApparentGeocentricDeclination / 180.0 * 3.1415927)) / 15;

                double xMoon    = 0;
                double yMoon    = 0;
                double zMoon    = 0;
                bool   shadow   = false;
                bool   eclipsed = false;

                switch (planet)
                {
                case 10:                         // IO
                    xMoon    = galDetails.Satellite1.ApparentRectangularCoordinates.X;
                    yMoon    = galDetails.Satellite1.ApparentRectangularCoordinates.Y;
                    zMoon    = galDetails.Satellite1.ApparentRectangularCoordinates.Z;
                    eclipsed = galDetails.Satellite1.bInEclipse;
                    shadow   = galDetails.Satellite1.bInShadowTransit;
                    break;

                case 11:                         //Europa
                    xMoon    = galDetails.Satellite2.ApparentRectangularCoordinates.X;
                    yMoon    = galDetails.Satellite2.ApparentRectangularCoordinates.Y;
                    zMoon    = galDetails.Satellite2.ApparentRectangularCoordinates.Z;
                    eclipsed = galDetails.Satellite2.bInEclipse;
                    shadow   = galDetails.Satellite2.bInShadowTransit;
                    break;

                case 12:                         //Ganymede
                    xMoon    = galDetails.Satellite3.ApparentRectangularCoordinates.X;
                    yMoon    = galDetails.Satellite3.ApparentRectangularCoordinates.Y;
                    zMoon    = galDetails.Satellite3.ApparentRectangularCoordinates.Z;
                    eclipsed = galDetails.Satellite3.bInEclipse;
                    shadow   = galDetails.Satellite3.bInShadowTransit;
                    break;

                case 13:                         //Callisto
                    xMoon    = galDetails.Satellite4.ApparentRectangularCoordinates.X;
                    yMoon    = galDetails.Satellite4.ApparentRectangularCoordinates.Y;
                    zMoon    = galDetails.Satellite4.ApparentRectangularCoordinates.Z;
                    eclipsed = galDetails.Satellite4.bInEclipse;
                    shadow   = galDetails.Satellite4.bInShadowTransit;
                    break;

                case 14:                         // IO Shadow
                    xMoon  = galDetails.Satellite1.ApparentShadowRectangularCoordinates.X;
                    yMoon  = galDetails.Satellite1.ApparentShadowRectangularCoordinates.Y;
                    zMoon  = galDetails.Satellite1.ApparentShadowRectangularCoordinates.Z * .9;
                    shadow = galDetails.Satellite1.bInShadowTransit;
                    break;

                case 15:                         //Europa Shadow
                    xMoon  = galDetails.Satellite2.ApparentShadowRectangularCoordinates.X;
                    yMoon  = galDetails.Satellite2.ApparentShadowRectangularCoordinates.Y;
                    zMoon  = galDetails.Satellite2.ApparentShadowRectangularCoordinates.Z * .9;
                    shadow = galDetails.Satellite2.bInShadowTransit;
                    break;

                case 16:                         //Ganymede Shadow
                    xMoon  = galDetails.Satellite3.ApparentShadowRectangularCoordinates.X;
                    yMoon  = galDetails.Satellite3.ApparentShadowRectangularCoordinates.Y;
                    zMoon  = galDetails.Satellite3.ApparentShadowRectangularCoordinates.Z * .9;
                    shadow = galDetails.Satellite3.bInShadowTransit;
                    break;

                case 17:                         //Callisto Shadow
                    xMoon  = galDetails.Satellite4.ApparentShadowRectangularCoordinates.X;
                    yMoon  = galDetails.Satellite4.ApparentShadowRectangularCoordinates.Y;
                    zMoon  = galDetails.Satellite4.ApparentShadowRectangularCoordinates.Z * .9;
                    shadow = galDetails.Satellite4.bInShadowTransit;
                    break;
                }

                double xTemp;
                double yTemp;
                double radians = jupPhisical.P / 180.0 * 3.1415927;
                xTemp = xMoon * Math.Cos(radians) - yMoon * Math.Sin(radians);
                yTemp = xMoon * Math.Sin(radians) + yMoon * Math.Cos(radians);
                xMoon = xTemp;
                yMoon = yTemp;

                return(new AstroRaDec(jupDetails.ApparentGeocentricRA - (xMoon * raScale), jupDetails.ApparentGeocentricDeclination + yMoon * scale, jupDetails.ApparentGeocentricDistance + (zMoon * jupiterDiameter / 2), shadow, eclipsed));
            }
        }