Пример #1
0
        public static PlanetPosition NorthSouthNode(double jul_ut, PlanetId id, SeFlg flag)
        {
            if (id != PlanetId.SE_NORTHNODE && id != PlanetId.SE_SOUTHNODE)
            {
                throw new Exception("Wrong parameter of " + id.ToString());
            }

            double[] xnasc    = new double[6];
            double[] xndsc    = new double[6];
            double[] xperi    = new double[6];
            double[] xaphe    = new double[6];
            String   errorMsg = "";

            if (swe_nod_aps_ut(jul_ut, PlanetId.SE_MOON, flag, 0, xnasc, xndsc, xperi, xaphe, errorMsg) == SeFlg.ERR)
            {
                DateTime utc = SweWrapper.UtcFromJulianDay(jul_ut);
                Console.WriteLine(String.Format("Error for {0}@{1} with Flag of {2}: {3}", id, utc, SeFlg.DEFAULT, errorMsg));
                return(null);
            }
            else
            {
                PlanetPosition nodePos = new PlanetPosition(id, (id == PlanetId.SE_NORTHNODE) ? xnasc : xndsc);
                return(nodePos);
            }
        }
Пример #2
0
        public void Calculate()
        {
            double jul_ut = SweWrapper.ToJulianDay(this.moment);

            PlanetPosition pos = null;

            foreach (PlanetId id in Astrolabe.Concerned)
            {
                pos = SweWrapper.PositionOf(jul_ut, id, SeFlg.SEFLG_SPEED);

                if (this.starPositions.ContainsKey(id))
                {
                    this.starPositions[id] = pos;
                }
                else
                {
                    this.starPositions.Add(id, pos);
                }

                //this.starPositions.Add(id, pos);

                //pos2 = PositionOf(jul_et, id);
            }

            SweWrapper.swe_close();

            PlanetPosition posA, posB;

            patterns.Clear();

            for (int i = 0; i < starPositions.Count - 1; i++)
            {
                KeyValuePair <PlanetId, PlanetPosition> kvp = starPositions.ElementAt(i);
                posA = kvp.Value;
                for (int j = i + 1; j < starPositions.Count; j++)
                {
                    kvp  = starPositions.ElementAt(j);
                    posB = kvp.Value;

                    if (Relation.HasRelation(posA, posB))
                    {
                        Relation newRelation = new Relation(posA, posB);

                        patterns.Add(newRelation.Kind, newRelation);
                    }
                }
            }
        }
Пример #3
0
        public Relation(PlanetPosition ppA, PlanetPosition ppB)
        {
            this.apart = ppA.Rectascension - ppB.Rectascension;
            AspectType type = Aspect.AspectTypeOf(apart);

            this.kind = new RelationKind(ppA.Id, ppB.Id, type);
            if (ppA.Id <= ppB.Id)
            {
                this.inLongitude  = ppA.Rectascension.Degrees;
                this.outLongitude = ppB.Rectascension.Degrees;
            }
            else
            {
                this.inLongitude  = ppB.Rectascension.Degrees;
                this.outLongitude = ppA.Rectascension.Degrees;
            }
        }
Пример #4
0
        public static bool HasRelation(PlanetPosition posA, PlanetPosition posB)
        {
            Angle theAngle = posA - posB;

            return(Aspect.AspectTypeOf(theAngle) != AspectType.None);
        }