Ejemplo n.º 1
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;
            }
        }
Ejemplo n.º 2
0
        //public DateTime GetEventTime()
        //{
        //    Double expected = DegreesExpected;

        //    double jul = referencePoint;
        //    PlanetPosition interiorPos, exterirorPos;
        //    double angle, orb, speed, step = 100.0, inPos, exPos;

        //    for (int tryCount = 0; tryCount < maxTry; tryCount ++ )
        //    {
        //        interiorPos = SweWrapper.PositionOf(jul, Interior, SeFlg.SEFLG_SPEED);
        //        exterirorPos = SweWrapper.PositionOf(jul, Exterior, SeFlg.SEFLG_SPEED);

        //        inPos = interiorPos.Rectascension.Degrees;
        //        exPos = exterirorPos.Rectascension.Degrees;

        //        angle =( inPos - exPos + 360) % 360.0;

        //        orb = ( (angle > 180.0) ? 360.0-expected : expected) - angle;
        //        speed = interiorPos.LongVelo.Degrees - exterirorPos.LongVelo.Degrees;

        //        if (!cachedAspects.ContainsKey(jul))
        //            cachedAspects.Add(jul, angle);

        //        if (Math.Abs(orb) < Negligible)
        //            return SweWrapper.UtcFromJulianDay(jul);

        //        step = orb / speed;
        //        jul += step;

        //        //step = Math.Min(step / 2.0, Math.Abs(orb / speed));

        //        //if (orb * speed * (inPos-exPos) > 0)
        //        //    jul += step;
        //        //else
        //        //    jul -= step;
        //    }
        //    return getClosestFromCache();
        //}

        public Phenomenon PhenomenonNearby()
        {
            Double expected = similarAspectDegrees(cachedAspects[referencePoint]);

            double         jul = referencePoint;
            PlanetPosition interiorPos, exterirorPos;
            double         angle, orb, speed, step = 100.0, inPos, exPos;

            for (int tryCount = 0; tryCount < maxTry; tryCount++)
            {
                interiorPos  = SweWrapper.PositionOf(jul, Interior, SeFlg.SEFLG_SPEED);
                exterirorPos = SweWrapper.PositionOf(jul, Exterior, SeFlg.SEFLG_SPEED);

                inPos = interiorPos.Rectascension.Degrees;
                exPos = exterirorPos.Rectascension.Degrees;

                angle = (inPos - exPos + 360) % 360.0;

                orb   = ((angle > 180.0) ? 360.0 - expected : expected) - angle;
                speed = interiorPos.LongVelo.Degrees - exterirorPos.LongVelo.Degrees;

                if (!cachedAspects.ContainsKey(jul))
                {
                    cachedAspects.Add(jul, angle);
                }

                if (Math.Abs(orb) < Negligible)
                {
                    return(new Phenomenon(SweWrapper.UtcFromJulianDay(jul),
                                          new RelationKind(Interior, Exterior, Aspect.AspectTypeOf(expected)), inPos, exPos));
                    //return SweWrapper.UtcFromJulianDay(jul);
                }

                step = orb / speed;
                jul += step;

                //step = Math.Min(step / 2.0, Math.Abs(orb / speed));

                //if (orb * speed * (inPos-exPos) > 0)
                //    jul += step;
                //else
                //    jul -= step;
            }
            return(null);
        }
Ejemplo n.º 3
0
        public static bool HasRelation(PlanetPosition posA, PlanetPosition posB)
        {
            Angle theAngle = posA - posB;

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