Пример #1
0
        public static bool DrawPrecessionChart(RenderContext renderContext, float opacity, Color drawColor)
        {
            MakePrecessionChart();

            PrecTextBatch.Draw(renderContext, opacity, drawColor);

            precLineList.DrawLines(renderContext, opacity, drawColor);

            return(true);
        }
Пример #2
0
        public static bool DrawAltAzGrid(RenderContext renderContext, float opacity, Color drawColor)
        {
            Coordinates zenithAltAz = new Coordinates(0, 0);
            Coordinates zenith      = Coordinates.HorizonToEquitorial(zenithAltAz, SpaceTimeController.Location, SpaceTimeController.Now);

            double   raPart  = -((zenith.RA + 6) / 24.0 * (Math.PI * 2));
            double   decPart = -(((zenith.Dec)) / 360.0 * (Math.PI * 2));
            string   raText  = Coordinates.FormatDMS(zenith.RA);
            Matrix3d mat     = Matrix3d.RotationY((float)-raPart);

            mat.Multiply(Matrix3d.RotationX((float)decPart));
            mat.Invert();

            if (altAzLineList == null)
            {
                altAzLineList = new SimpleLineList();
                altAzLineList.DepthBuffered = false;

                for (double l = 0; l < 360; l += 10)
                {
                    for (double b = -80; b < 80; b += 2)
                    {
                        altAzLineList.AddLine(Coordinates.RADecTo3dAu(l / 15, b, 1), Coordinates.RADecTo3dAu(l / 15, b + 2, 1));
                    }
                }

                for (double b = -80; b <= 80; b += 10)
                {
                    for (double l = 0; l < 360; l += 5)
                    {
                        altAzLineList.AddLine(Coordinates.RADecTo3dAu(l / 15, b, 1), Coordinates.RADecTo3dAu((l + 5) / 15, b, 1));
                    }
                }

                int counter = 0;
                for (double l = 0; l < 360; l += 1)
                {
                    double b = 0.25;
                    switch (counter % 10)
                    {
                    case 0:
                        counter++;
                        continue;

                    case 5:
                        b = .5;
                        break;
                    }
                    counter++;

                    altAzLineList.AddLine(Coordinates.RADecTo3dAu(l / 15, b, 1), Coordinates.RADecTo3dAu(l / 15, -b, 1));
                }

                counter = 0;
                for (double l = 0; l < 360; l += 90)
                {
                    counter = 0;
                    for (double b = -80; b <= 80; b += 1)
                    {
                        double width = 0.5 / 2;
                        switch (counter % 10)
                        {
                        case 0:
                            counter++;
                            continue;

                        case 5:
                            width = .5;
                            break;
                        }
                        counter++;

                        altAzLineList.AddLine(Coordinates.RADecTo3dAu((l + width) / 15, b, 1), Coordinates.RADecTo3dAu((l - width) / 15, b, 1));
                    }
                }
            }

            Matrix3d matOldWorld     = renderContext.World.Clone();
            Matrix3d matOldWorldBase = renderContext.WorldBase.Clone();

            renderContext.WorldBase = Matrix3d.MultiplyMatrix(mat, renderContext.World);
            renderContext.World     = renderContext.WorldBase.Clone();
            renderContext.MakeFrustum();

            altAzLineList.ViewTransform = Matrix3d.InvertMatrix(mat);

            altAzLineList.DrawLines(renderContext, opacity, drawColor);

            renderContext.WorldBase = matOldWorldBase;
            renderContext.World     = matOldWorld;
            renderContext.MakeFrustum();
            return(true);
        }
Пример #3
0
        public static bool DrawEcliptic(RenderContext renderContext, float opacity, Color drawColor)
        {
            Color col = drawColor;

            int year = SpaceTimeController.Now.GetUTCFullYear();

            if (eclipticOverviewLineList == null || year != EclipticYear)
            {
                if (eclipticOverviewLineList != null)
                {
                    eclipticOverviewLineList.Clear();
                    eclipticOverviewLineList = null;
                }

                EclipticYear = year;
                double   obliquity = Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow);
                Matrix3d mat       = Matrix3d.RotationX((-obliquity / 360.0 * (Math.PI * 2)));


                double daysPerYear = 365.25;



                if (DT.IsLeap(year, true))
                {
                    monthDays[1] = 29;

                    daysPerYear = 366;
                }
                else
                {
                    monthDays[1] = 28;
                    daysPerYear  = 365;
                }
                int count = 2 * (int)daysPerYear;
                EclipticCount = (int)daysPerYear;
                double jYear = SpaceTimeController.UtcToJulian(new Date(year, 0, 1, 12, 0, 0));


                int    index = 0;
                double d     = 0;

                eclipticOverviewLineList = new SimpleLineList();
                eclipticOverviewLineList.DepthBuffered = false;
                for (int m = 0; m < 12; m++)
                {
                    int daysThisMonth = (int)monthDays[m];
                    for (int i = 0; i < daysThisMonth; i++)
                    {
                        AstroRaDec sunRaDec = Planets.GetPlanetLocationJD("Sun", jYear);

                        COR sunEcliptic = CT.Eq2Ec(sunRaDec.RA, sunRaDec.Dec, obliquity);

                        d = sunEcliptic.X;

                        double width = .005f;
                        if (i == 0)
                        {
                            width = .01f;
                        }
                        double dd = d;// +180;

                        eclipticOverviewLineList.AddLine(
                            Vector3d.TransformCoordinate(Vector3d.Create((Math.Cos((dd * Math.PI * 2.0) / 360)),
                                                                         width,
                                                                         (Math.Sin((dd * Math.PI * 2.0) / 360))), mat),
                            Vector3d.TransformCoordinate(Vector3d.Create((Math.Cos((dd * Math.PI * 2.0) / 360)),
                                                                         -width,
                                                                         (Math.Sin((dd * Math.PI * 2.0) / 360))), mat)
                            );


                        index++;
                        jYear += 1;
                    }
                    d += monthDays[m];
                }
            }


            eclipticOverviewLineList.DrawLines(renderContext, opacity, drawColor);
            return(true);
        }
Пример #4
0
        public static bool DrawEquitorialGrid(RenderContext renderContext, float opacity, Color drawColor)
        {
            if (equLineList == null)
            {
                equLineList = new SimpleLineList();
                equLineList.DepthBuffered = false;

                for (double hour = 0; hour < 24; hour++)
                {
                    for (double dec = -80; dec < 80; dec += 2)
                    {
                        equLineList.AddLine(Coordinates.RADecTo3dAu(hour, dec, 1), Coordinates.RADecTo3dAu(hour, dec + 2, 1));
                    }
                }


                for (double dec = -80; dec <= 80; dec += 10)
                {
                    for (double hour = 0; hour < 23.8; hour += .2)
                    {
                        equLineList.AddLine(Coordinates.RADecTo3dAu(hour, dec, 1), Coordinates.RADecTo3dAu(hour + .2, dec, 1));
                        //todo fix for color bright
                    }
                }


                int counter = 0;
                for (double ra = 0; ra < 24; ra += .25)
                {
                    double dec = 0.5;

                    switch (counter % 4)
                    {
                    case 0:
                        counter++;
                        continue;

                    case 3:
                    case 1:
                        dec = .25;
                        break;
                    }
                    counter++;

                    equLineList.AddLine(Coordinates.RADecTo3dAu(ra, dec, 1), Coordinates.RADecTo3dAu(ra, -dec, 1));
                }
                counter = 0;
                for (double ra = 0; ra < 24; ra += 3)
                {
                    counter = 0;
                    for (double dec = -80; dec <= 80; dec += 1)
                    {
                        double width = 0.5 / 30;
                        switch (counter % 10)
                        {
                        case 0:
                            counter++;
                            continue;

                        case 5:
                            width = .5 / 15;
                            break;
                        }

                        counter++;

                        equLineList.AddLine(Coordinates.RADecTo3dAu(ra + width, dec, 1), Coordinates.RADecTo3dAu(ra - width, dec, 1));
                    }
                }
            }

            equLineList.DrawLines(renderContext, opacity, drawColor);

            return(true);
        }
Пример #5
0
        public static bool DrawGalacticGrid(RenderContext renderContext, float opacity, Color drawColor)
        {
            if (galLineList == null)
            {
                galLineList = new SimpleLineList();
                galLineList.DepthBuffered = false;

                for (double l = 0; l < 360; l += 10)
                {
                    for (double b = -80; b < 80; b += 2)
                    {
                        galLineList.AddLine(Coordinates.GalacticTo3dDouble(l, b), Coordinates.GalacticTo3dDouble(l, b + 2));
                    }
                }

                for (double b = -80; b <= 80; b += 10)
                {
                    for (double l = 0; l < 360; l += 5)
                    {
                        galLineList.AddLine(Coordinates.GalacticTo3dDouble(l, b), Coordinates.GalacticTo3dDouble(l + 5, b));
                    }
                }

                int counter = 0;
                for (double l = 0; l < 360; l += 1)
                {
                    double b = 0.25;
                    switch (counter % 10)
                    {
                    case 0:
                        counter++;
                        continue;

                    case 5:
                        b = .5;
                        break;
                    }
                    counter++;

                    galLineList.AddLine(Coordinates.GalacticTo3dDouble(l, b), Coordinates.GalacticTo3dDouble(l, -b));
                }

                counter = 0;
                for (double l = 0; l < 360; l += 90)
                {
                    counter = 0;
                    for (double b = -80; b <= 80; b += 1)
                    {
                        double width = 0.5 / 2;
                        switch (counter % 10)
                        {
                        case 0:
                            counter++;
                            continue;

                        case 5:
                            width = .5;
                            break;
                        }
                        counter++;

                        galLineList.AddLine(Coordinates.GalacticTo3dDouble(l + width, b), Coordinates.GalacticTo3dDouble(l - width, b));
                    }
                }
            }

            galLineList.DrawLines(renderContext, opacity, drawColor);

            return(true);
        }
Пример #6
0
        public static bool DrawEclipticGrid(RenderContext renderContext, float opacity, Color drawColor)
        {
            if (eclipticLineList == null)
            {
                eclipticLineList = new SimpleLineList();
                eclipticLineList.DepthBuffered = false;

                double   obliquity = Coordinates.MeanObliquityOfEcliptic(2451545);
                Matrix3d mat       = Matrix3d.RotationX((-obliquity / 360.0 * (Math.PI * 2)));


                for (double l = 0; l < 360; l += 10)
                {
                    for (double b = -80; b < 80; b += 2)
                    {
                        eclipticLineList.AddLine(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b + 2, 1), mat));
                    }
                }

                for (double b = -80; b <= 80; b += 10)
                {
                    for (double l = 0; l < 360; l += 5)
                    {
                        eclipticLineList.AddLine(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu((l + 5) / 15, b, 1), mat));
                    }
                }

                int counter = 0;
                for (double l = 0; l < 360; l += 1)
                {
                    double b = 0.25;
                    switch (counter % 10)
                    {
                    case 0:
                        counter++;
                        continue;

                    case 5:
                        b = .5;
                        break;
                    }
                    counter++;

                    eclipticLineList.AddLine(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, -b, 1), mat));
                }

                counter = 0;
                for (double l = 0; l < 360; l += 90)
                {
                    counter = 0;
                    for (double b = -80; b <= 80; b += 1)
                    {
                        double width = 0.5 / 2;
                        switch (counter % 10)
                        {
                        case 0:
                            counter++;
                            continue;

                        case 5:
                            width = .5;
                            break;
                        }
                        counter++;

                        eclipticLineList.AddLine(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu((l + width) / 15, b, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu((l - width) / 15, b, 1), mat));
                    }
                }
            }

            eclipticLineList.DrawLines(renderContext, opacity, drawColor);

            return(true);
        }