Exemple #1
0
        public static void PlanetXYZ(double JD, int PlanetNumber, double Accuracy, ref double X, ref double Y, ref double Z)
        {
            double[] numArray  = new double[4];
            double[] numArray2 = new double[6];

            numArray2[0] = 1.0;
            numArray2[1] = (JD - 2451545.0) / 365250.0;
            numArray2[2] = numArray2[1] * numArray2[1];
            numArray2[3] = numArray2[2] * numArray2[1];
            numArray2[4] = numArray2[3] * numArray2[1];
            numArray2[5] = numArray2[4] * numArray2[1];

            numArray[1] = 0.0;
            numArray[2] = 0.0;
            numArray[3] = 0.0;


            for (int i = 1; i <= s_AberrationArgs.Length; i++)
            {
                EarthAberrationData entry = s_AberrationArgs[i - 1];

                numArray[entry.I1] += (entry.D1 * Math.Cos(entry.D2 + (entry.D3 * numArray2[1]))) * numArray2[entry.I2];
                if (entry.D1 < Accuracy)
                {
                    break;
                }
            }

            X = (numArray[1] + (4.4036E-07 * numArray[2])) - (1.90919E-07 * numArray[3]);
            Y = ((-4.79966E-07 * numArray[1]) + (0.917482137087 * numArray[2])) - (0.397776982902 * numArray[3]);
            Z = (0.397776982902 * numArray[2]) + (0.917482137087 * numArray[3]);
        }
Exemple #2
0
        static AstroUtilities()
        {
            using (Stream resStr = AssemblyHelper.GetEmbededResourceStreamThatClientMustDispose("Tangra.KweeVanWoerden.Resources", "Earth.bin"))
                using (BinaryReader reader = new BinaryReader(resStr))
                {
                    long entriesCount = resStr.Length / EarthAberrationData.REC_LENGTH;

                    s_AberrationArgs = new EarthAberrationData[entriesCount];

                    for (int i = 0; i < entriesCount; i++)
                    {
                        s_AberrationArgs[i] = new EarthAberrationData(reader);
                    }
                }

            using (Stream resStr = AssemblyHelper.GetEmbededResourceStreamThatClientMustDispose("Tangra.KweeVanWoerden.Resources", "Nutation.bin"))
                using (BinaryReader reader = new BinaryReader(resStr))
                {
                    long entriesCount = resStr.Length / EarthNutationData.REC_LENGTH;

                    s_NutationArgs = new EarthNutationData[entriesCount];

                    for (int i = 0; i < entriesCount; i++)
                    {
                        s_NutationArgs[i] = new EarthNutationData(reader);
                    }
                }


            using (Stream resStr = AssemblyHelper.GetEmbededResourceStreamThatClientMustDispose("Tangra.KweeVanWoerden.Resources", "Constellations.bin"))
                using (TextReader reader = new StreamReader(resStr))
                {
                    for (int i = 0; i < 88; i++)
                    {
                        s_Constellations[i]      = new Constellation();
                        s_Constellations[i].Name = reader.ReadLine();
                    }

                    for (int i = 0; i < 88; i++)
                    {
                        s_Constellations[i].Abbreviation = reader.ReadLine();
                    }

                    for (int i = 0; i < 357; i++)
                    {
                        s_ConstellationBoundaries[i]                    = new ConstellationBoundaryEntry();
                        s_ConstellationBoundaries[i].RaFrom             = float.Parse(reader.ReadLine(), CultureInfo.InvariantCulture);
                        s_ConstellationBoundaries[i].RaTo               = float.Parse(reader.ReadLine(), CultureInfo.InvariantCulture);
                        s_ConstellationBoundaries[i].Dec                = float.Parse(reader.ReadLine(), CultureInfo.InvariantCulture);
                        s_ConstellationBoundaries[i].ConstellationIndex = int.Parse(reader.ReadLine(), CultureInfo.InvariantCulture);
                    }
                }
        }
Exemple #3
0
        static AstroUtilities()
        {
            using (Stream resStr = AssemblyHelper.GetEmbededResourceStreamThatClientMustDispose("Tangra.KweeVanWoerden.Resources", "Earth.bin"))
            using (BinaryReader reader = new BinaryReader(resStr))
            {
                long entriesCount = resStr.Length / EarthAberrationData.REC_LENGTH;

                s_AberrationArgs = new EarthAberrationData[entriesCount];

                for (int i = 0; i < entriesCount; i++)
                {
                    s_AberrationArgs[i] = new EarthAberrationData(reader);
                }
            }

            using (Stream resStr = AssemblyHelper.GetEmbededResourceStreamThatClientMustDispose("Tangra.KweeVanWoerden.Resources", "Nutation.bin"))
            using (BinaryReader reader = new BinaryReader(resStr))
            {
                long entriesCount = resStr.Length / EarthNutationData.REC_LENGTH;

                s_NutationArgs = new EarthNutationData[entriesCount];

                for (int i = 0; i < entriesCount; i++)
                {
                    s_NutationArgs[i] = new EarthNutationData(reader);
                }
            }

            using (Stream resStr = AssemblyHelper.GetEmbededResourceStreamThatClientMustDispose("Tangra.KweeVanWoerden.Resources", "Constellations.bin"))
            using (TextReader reader = new StreamReader(resStr))
            {
                for (int i = 0; i < 88; i++)
                {
                    s_Constellations[i] = new Constellation();
                    s_Constellations[i].Name = reader.ReadLine();
                }

                for (int i = 0; i < 88; i++)
                    s_Constellations[i].Abbreviation = reader.ReadLine();

                for (int i = 0; i < 357; i++)
                {
                    s_ConstellationBoundaries[i] = new ConstellationBoundaryEntry();
                    s_ConstellationBoundaries[i].RaFrom = float.Parse(reader.ReadLine(), CultureInfo.InvariantCulture);
                    s_ConstellationBoundaries[i].RaTo = float.Parse(reader.ReadLine(), CultureInfo.InvariantCulture);
                    s_ConstellationBoundaries[i].Dec = float.Parse(reader.ReadLine(), CultureInfo.InvariantCulture);
                    s_ConstellationBoundaries[i].ConstellationIndex = int.Parse(reader.ReadLine(), CultureInfo.InvariantCulture);
                }
            }
        }
Exemple #4
0
        public static void Aberration(double JD, out double C, out double D)
        {
            double[] numArray2;
            double[] numArray = new double[3];
            double   t        = (JD - 2451545.0) / 365250.0;

            numArray2 = new double[] { 0.0, 1.0, t, t *t, Math.Pow(t, 4), Math.Pow(t, 8), Math.Pow(t, 16) };

            double num3 = ((13.96971 * numArray2[2]) + (0.03086 * numArray2[3])) / 57.295779513082323;
            double num2 = Math.Cos((23.4392911 - (0.1300417 * numArray2[2])) / 57.295779513082323);

            numArray[1] = 0.0;
            numArray[2] = 0.0;

            for (int i = 1; i <= s_AberrationArgs.Length; i++)
            {
                EarthAberrationData entry = s_AberrationArgs[i - 1];

                double d = entry.D2 + (entry.D3 * numArray2[2]);
                if (entry.I1 != 3)
                {
                    numArray[entry.I1] -= (entry.D1 * (((entry.I2 * Math.Cos(d)) * numArray2[entry.I2]) - ((entry.D3 * Math.Sin(d)) * numArray2[entry.I2 + 1]))) / 365250.0;
                }

                if (entry.D1 < 1E-05)
                {
                    break;
                }
            }

            double num5 = ((1191.28 * numArray[1]) / 57.295779513082323) / 3600.0;
            double num4 = (((-1191.28 * numArray[2]) * num2) / 57.295779513082323) / 3600.0;

            C = num4 - ((num3 * num2) * num5);
            D = num5 + ((num3 / num2) * num4);
        }