Beispiel #1
0
        private static void MakeEclipticText()
        {
            int year = SpaceTimeController.Now.GetUTCFullYear();

            if (EclipOvTextBatch == null)
            {
                EclipOvTextBatch = new Text3dBatch(80);

                EclipticTextYear = 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;

                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 dd = d;// +180;

                        if (i == Math.Floor(daysThisMonth / 2.0))
                        {
                            Vector3d center = Vector3d.TransformCoordinate(Vector3d.Create((Math.Cos((dd * Math.PI * 2.0) / 360)),
                                                                                           .025f,
                                                                                           (Math.Sin((dd * Math.PI * 2.0) / 360))), mat);
                            Vector3d up = Vector3d.TransformCoordinate(Vector3d.Create((Math.Cos((dd * Math.PI * 2.0) / 360)),
                                                                                       .045f,
                                                                                       (Math.Sin((dd * Math.PI * 2.0) / 360))), mat);
                            up.Subtract(center);

                            up.Normalize();
                            EclipOvTextBatch.Add(new Text3d(center, up, monthNames[m], 80, .000159375));
                        }


                        index++;

                        index++;
                        jYear += 1;
                    }
                    d += monthDays[m];
                }
            }
        }
Beispiel #2
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);
        }