Exemplo n.º 1
0
        public static StarDate GetStarDate(DateTime date)
        {
            DateTime baseDate = new DateTime(2012, 1, 1);
            TimeSpan diff     = date.Subtract(baseDate);

            //TimeSpan baseSpan = new TimeSpan(diff.Ticks);

            //baseDate = baseDate.Add(baseSpan).AddYears(1204);
            baseDate = baseDate.Add(diff).AddYears(1204);

            StarDate starDate = new StarDate(baseDate);

            return(starDate);
        }
Exemplo n.º 2
0
        public static void UpdateLocation(SystemBody body)
        {
            double angle  = body.BaseAngle;
            double radius = body.OrbitalRadius;
            double period = body.OrbitalPeriod;

            StarDate baseDate = StarDate.GetStarDate(new DateTime(2012, 1, 1));
            //StarDate currentDate = StarDate.Now;

            //Passou a estar fixo pois estava com alguma dificuldade em manter as coisas em orbita ;P
            StarDate currentDate = StarDate.GetStarDate(new DateTime(2024, 1, 1));

            TimeSpan span = currentDate.Date.Subtract(baseDate.Date);

            angle += ((span.TotalDays / 365.25) * period * 360);

            double rad = 0.0174532925;

            double ssX = (long)(radius * Math.Cos(angle * rad) * 149598000);
            double ssY = (long)(radius * Math.Sin(angle * rad) * 149598000);
            double ssZ = 0;

            body.SystemLocation.SetInSystemCoords(ssX, ssY, ssZ);
        }