Beispiel #1
0
        protected override void OnTimeChanged()
        {
            int   years = this.Time.UniversalTime.Year - 2000;
            Angle ra    = Angle.FromHours(this.RightAscension) + Angle.FromHours(0, 0, this.RightAscensionProperMotion * years);

            Angle dec = Angle.FromDegrees(this.Declination) + Angle.FromDegrees(0, 0, this.DeclinationProperMotion * years);

            this.EquatorialCoordinate = new EquatorialCoordinate(ra, dec);

            base.OnTimeChanged();
        }
Beispiel #2
0
        public void Initialize()
        {
            foreach (Connector connector in this.Connectors)
            {
                FindStar(connector.From).IsConnectedInConstellation = true;
                FindStar(connector.To).IsConnectedInConstellation   = true;
            }

            // The following calculation is solely for positioning the name
            // of the constellation relative to its contents.

            // First determine if the constellation crosses the 0° right ascension line
            int numLessThan8Hours     = 0;
            int numGreaterThan16Hours = 0;

            foreach (Star star in this.Stars)
            {
                if (star.RightAscension < 8)
                {
                    numLessThan8Hours += 1;
                }
                else if (star.RightAscension > 16)
                {
                    numGreaterThan16Hours += 1;
                }
            }

            bool straddles = numLessThan8Hours > 0 && numGreaterThan16Hours > 0;
            bool countAll  = this.Connectors.Count == 0;

            int    count = 0;
            double rightAscensionTotal = 0;
            double declinationTotal    = 0;

            foreach (Star star in this.Stars)
            {
                if (countAll || star.IsConnectedInConstellation)
                {
                    count += 1;
                    rightAscensionTotal += star.RightAscension - (straddles && star.RightAscension > 16 ? 24 : 0);
                    declinationTotal    += star.Declination;
                }
            }

            this.EquatorialCoordinate = new EquatorialCoordinate(Angle.FromHours(rightAscensionTotal / count), Angle.FromDegrees(declinationTotal / count));
        }