Esempio n. 1
0
        public AspectRecurrenceEvent(DateTimeOffset time, Position pos1, Position pos2, Double refAspectDegree)
            : base(pos1.Owner, time, pos1)
        {
            Pair = new PlanetPair(pos1.Owner, pos2.Owner);

            if (Interior != Where.Owner)
            {
                Who   = Pair.Interior;
                Where = pos2;
            }

            ExteriorPosition = pos1.Owner > pos2.Owner ? pos1 : pos2;
            RefAspectDegree  = refAspectDegree;
            double dif = Math.Round(InteriorPosition.Longitude - ExteriorPosition.Longitude - refAspectDegree + 360) % 360;

            if (Aspect.All.ContainsKey(dif))
            {
                TheAspect = Aspect.All[dif];
            }
            else
            {
                TheAspect = null;
            }

            Kind = PlanetEventFlag.AspectRecurred;
        }
Esempio n. 2
0
        public static List <RelationBrief> RelationBriefsOf(PlanetPair pair, double degree1, double degree2)
        {
            List <RelationBrief> result = new List <RelationBrief>();

            double        orb     = pair.Orb;
            List <double> aspects = pair.ConcernedAspects;

            double angle;

            foreach (KeyValuePair <RelationType, angleDelegate> kvp in relationDelegates)
            {
                angle = kvp.Value(aspects, orb, degree1, degree2);
                if (angle != -1)
                {
                    RelationBrief newRelation = new RelationBrief(kvp.Key, angle);
                    result.Add(newRelation);
                }
            }

            return(result);

            //double distance, geometric, harmonic, hypotenuse, aspect;

            //distance = DistanceOf(degree1, degree2);
            //aspect = aspectAngleOf(aspects, orb, distance);

            //if (aspect != -1)
            //{
            //    RelationBrief distanceRelation = new RelationBrief(RelationType.Apparent, aspect);
            //    aspects.Add(distanceRelation);
            //}

            //geometric = GeometricMeanOf(degree1, degree2);
            //aspect = aspectAngleOf(aspects, orb, geometric);

            //if (aspect != -1)
            //{
            //    RelationBrief geometricRelation = new RelationBrief(RelationType.GeometricMean, aspect);
            //    aspects.Add(geometricRelation);
            //}

            //harmonic = HarmonicMeanOf(degree1, degree2);
            //aspect = aspectAngleOf(aspects, orb, distance);

            //if (aspect != -1)
            //{
            //    RelationBrief distanceRelation = new RelationBrief(RelationType.Apparent, aspect);
            //    aspects.Add(distanceRelation);
            //}

            //geometric = GeometricMeanOf(degree1, degree2);
            //aspect = aspectAngleOf(aspects, orb, geometric);

            //if (aspect != -1)
            //{
            //    RelationBrief geometricRelation = new RelationBrief(RelationType.GeometricMean, aspect);
            //    aspects.Add(geometricRelation);
            //}
        }
Esempio n. 3
0
 public Relation(bool isHeliocentric, bool isMovement, PlanetPair pair, RelationBrief brief, double degree1, double degree2)
 {
     IsHeliocentric = isHeliocentric;
     IsMovement     = isMovement;
     Pair           = pair;
     Brief          = brief;
     Degree1        = degree1;
     Degree2        = degree2;
 }
Esempio n. 4
0
 public Relation(PlanetPair pair, RelationBrief brief, double degree1, double degree2)
 {
     IsHeliocentric = false;
     IsMovement     = false;
     Pair           = pair;
     Brief          = brief;
     Degree1        = degree1;
     Degree2        = degree2;
 }
Esempio n. 5
0
        public ExactAspectEvent(DateTimeOffset time, Position pos1, Position pos2, Aspect theAspect, PlanetEventFlag kind)
            : base(pos1.Owner, time, pos1)
        {
            Pair = new PlanetPair(pos1.Owner, pos2.Owner);

            if (Interior != Where.Owner)
            {
                Who   = Pair.Interior;
                Where = pos2;
            }

            ExteriorPosition = pos1.Owner > pos2.Owner ? pos1 : pos2;
            TheAspect        = theAspect;
            Kind             = kind;
        }
Esempio n. 6
0
        public List <IPlanetEvent> this[SeFlg centric, PlanetPair pair]
        {
            get
            {
                Dictionary <PlanetEventFlag, Dictionary <PlanetId, List <IPlanetEvent> > > aspectarian =
                    (centric == SeFlg.GEOCENTRIC) ? GeoAspectarian : centric == SeFlg.HELIOCENTRIC ? HelioAspectarian : null;

                if (aspectarian == null || !aspectarian.ContainsKey(PlanetEventFlag.AspectCategory))
                {
                    return(null);
                }

                List <IPlanetEvent> result = new List <IPlanetEvent>();

                if (pair.Interior == PlanetId.SE_ECL_NUT)
                {
                    throw new NotImplementedException();
                }
                else if (pair.Exterior == PlanetId.SE_ECL_NUT)
                {
                    foreach (KeyValuePair <PlanetId, List <IPlanetEvent> > kvp in aspectarian[PlanetEventFlag.AspectCategory])
                    {
                        if (!pair.Contains(kvp.Key))
                        {
                            continue;
                        }

                        foreach (IPlanetEvent evt in kvp.Value)
                        {
                            ExactAspectEvent aspEvt = evt as ExactAspectEvent;
                            if (aspEvt == null)
                            {
                                throw new Exception();
                            }

                            if (pair.Contains(aspEvt.Pair))
                            {
                                result.Add(aspEvt);
                            }
                        }
                    }
                }
                else
                {
                    foreach (IPlanetEvent evt in aspectarian[PlanetEventFlag.AspectCategory][pair.Interior])
                    {
                        ExactAspectEvent aspEvt = evt as ExactAspectEvent;
                        if (aspEvt == null)
                        {
                            throw new Exception();
                        }

                        if (pair.Contains(aspEvt.Pair))
                        {
                            result.Add(aspEvt);
                        }
                    }
                }

                return(result.Count == 0 ? null : result);
            }
        }
Esempio n. 7
0
 public Similarity(PlanetPair pair)
 {
     Pair     = pair;
     Category = PlanetEventFlag.AspectCategory;
 }
Esempio n. 8
0
        static Relation()
        {
            for (int i = 0; i < Ephemeris.GeocentricLuminaries.Count - 1; i++)
            {
                PlanetId interior = Ephemeris.GeocentricLuminaries[i];

                if (interior == PlanetId.SE_MOON)
                {
                    continue;
                }

                if (interior == PlanetId.Five_Average)
                {
                    break;
                }

                GeoConcernedSinglePositions.Add(new PlanetPair(interior, PlanetId.SE_ECL_NUT));
                GeoConcernedSingleMovements.Add(new PlanetPair(interior, PlanetId.SE_ECL_NUT));

                for (int j = i + 1; j < Ephemeris.GeocentricLuminaries.Count - 1; j++)
                {
                    PlanetId exterior = Ephemeris.GeocentricLuminaries[j];

                    if (exterior == PlanetId.SE_MOON)
                    {
                        continue;
                    }
                    else if (interior == PlanetId.SE_PLUTO || exterior == PlanetId.Five_Average)
                    {
                        break;
                    }

                    PlanetPair pair = new PlanetPair(interior, exterior);

                    GeoConcernedDualPositions.Add(pair);
                    GeoConcernedDualMovements.Add(pair);
                }
            }

            GeoConcernedDualPositions.Sort();
            GeoConcernedDualPositions.Reverse();
            GeoConcernedDualMovements.Sort();
            GeoConcernedDualMovements.Reverse();


            for (int i = 0; i < Ephemeris.HeliocentricLuminaries.Count - 1; i++)
            {
                PlanetId interior = Ephemeris.HeliocentricLuminaries[i];

                if (interior == PlanetId.SE_MOON)
                {
                    continue;
                }

                if (interior == PlanetId.Five_Average)
                {
                    break;
                }

                HelioConcernedSinglePositions.Add(new PlanetPair(interior, PlanetId.SE_ECL_NUT));
                HelioConcernedSingleMovements.Add(new PlanetPair(interior, PlanetId.SE_ECL_NUT));

                for (int j = i + 1; j < Ephemeris.HeliocentricLuminaries.Count - 1; j++)
                {
                    PlanetId exterior = Ephemeris.GeocentricLuminaries[j];

                    if (exterior == PlanetId.SE_MOON)
                    {
                        continue;
                    }
                    else if (interior == PlanetId.SE_PLUTO || exterior == PlanetId.Five_Average)
                    {
                        break;
                    }

                    PlanetPair pair = new PlanetPair(interior, exterior);

                    HelioConcernedDualPositions.Add(pair);
                    HelioConcernedDualMovements.Add(pair);
                }
            }

            HelioConcernedDualPositions.Sort();
            HelioConcernedDualPositions.Reverse();
            HelioConcernedDualMovements.Sort();
            HelioConcernedDualMovements.Reverse();
        }
Esempio n. 9
0
        public static List <Relation> RelationsBetween(PlanetPair pair, DateTimeOffset time1, DateTimeOffset time2)
        {
            double degree1, degree2, movement1, movement2;

            if (pair.Interior == PlanetId.SE_ECL_NUT || time1 == time2)
            {
                return(null);
            }

            List <RelationBrief> briefs = null;
            List <Relation>      result = new List <Relation>();

            //For single planet
            if (pair.Exterior == PlanetId.SE_ECL_NUT)
            {
                degree1 = Ephemeris.GeocentricPositionOf(time1, pair.Interior).Longitude;
                degree2 = Ephemeris.GeocentricPositionOf(time2, pair.Interior).Longitude;
                briefs  = RelationBriefsOf(pair, degree1, degree2);

                foreach (RelationBrief brief in briefs)
                {
                    result.Add(new Relation(pair, brief, degree1, degree2));
                }

                degree1 = Ephemeris.HeliocentricPositionOf(time1, pair.Interior).Longitude;
                degree2 = Ephemeris.HeliocentricPositionOf(time2, pair.Interior).Longitude;
                briefs  = RelationBriefsOf(pair, degree1, degree2);

                foreach (RelationBrief brief in briefs)
                {
                    result.Add(new Relation(true, false, pair, brief, degree1, degree2));
                }
            }
            else
            {
                //Geocentric position relations
                double pos1 = Ephemeris.GeocentricPositionOf(time1, pair.Interior).Longitude;
                double pos2 = Ephemeris.GeocentricPositionOf(time1, pair.Exterior).Longitude;
                degree1 = pos2 - pos1;

                pos1    = Ephemeris.GeocentricPositionOf(time2, pair.Interior).Longitude;
                pos2    = Ephemeris.GeocentricPositionOf(time2, pair.Exterior).Longitude;
                degree2 = pos2 - pos1;
                briefs  = RelationBriefsOf(pair, degree1, degree2);

                foreach (RelationBrief brief in briefs)
                {
                    result.Add(new Relation(pair, brief, degree1, degree2));
                }

                //Geocentric movements relations
                movement1 = Movements.MovementOf(pair.Interior, false, time1, time2);
                movement2 = Movements.MovementOf(pair.Exterior, false, time1, time2);
                briefs    = RelationBriefsOf(pair, movement1, movement2);

                foreach (RelationBrief brief in briefs)
                {
                    result.Add(new Relation(false, true, pair, brief, movement1, movement2));
                }

                //Heliocentric position relations
                pos1    = Ephemeris.HeliocentricPositionOf(time1, pair.Interior).Longitude;
                pos2    = Ephemeris.HeliocentricPositionOf(time1, pair.Exterior).Longitude;
                degree1 = pos2 - pos1;

                pos1    = Ephemeris.HeliocentricPositionOf(time2, pair.Interior).Longitude;
                pos2    = Ephemeris.HeliocentricPositionOf(time2, pair.Exterior).Longitude;
                degree2 = pos2 - pos1;
                briefs  = RelationBriefsOf(pair, degree1, degree2);

                foreach (RelationBrief brief in briefs)
                {
                    result.Add(new Relation(true, false, pair, brief, degree1, degree2));
                }

                //Heliocentric movements relations
                movement1 = Movements.MovementOf(pair.Interior, true, time1, time2);
                movement2 = Movements.MovementOf(pair.Exterior, true, time1, time2);
                briefs    = RelationBriefsOf(pair, movement1, movement2);

                foreach (RelationBrief brief in briefs)
                {
                    result.Add(new Relation(true, true, pair, brief, movement1, movement2));
                }
            }


            return(result);
        }