Example #1
0
 public IEnumerable <BodyPartRecord> GetBasePartAt(ChassisPoint cp, BodyPosition bp = BodyPosition.Undefined)
 {
     foreach (var record in BaseBodyDef.AllParts)
     {
         if (record.def is DroidChassisPartDef)
         {
             var def = record.def as DroidChassisPartDef;
             if (def.ChassisPoint == cp)
             {
                 if (record is DroidChassisPartRecord)
                 {
                     var chassisRecord = record as DroidChassisPartRecord;
                     if (bp == BodyPosition.Undefined || chassisRecord.bodyPosition == bp)
                     {
                         yield return(record);
                     }
                 }
                 else
                 {
                     yield return(record);
                 }
             }
         }
     }
 }
Example #2
0
        public Longitude LongitudeOfSunMoonYoga(double ut)
        {
            BodyPosition bp_sun  = Basics.CalculateSingleBodyPosition(ut, sweph.SE_SUN, Body.Name.Sun, BodyType.Name.Graha, this.h);
            BodyPosition bp_moon = Basics.CalculateSingleBodyPosition(ut, sweph.SE_MOON, Body.Name.Moon, BodyType.Name.Graha, this.h);
            Longitude    rel     = bp_moon.longitude.add(bp_sun.longitude);

            return(rel);
        }
Example #3
0
        public double GetTransitForward(double ut, Longitude lonToFind)
        {
            if (this.b == Body.Name.Lagna)
            {
                return(GetLagnaTransitForward(ut, lonToFind));
            }


            bool   becomesDirect = true;
            double ut_curr       = ut;
            double ut_next       = ut;

            while (true)
            {
                ut_curr = ut_next;

                double ut_start = ut_curr;
                if (ut_curr != ut)
                {
                    ut_start += this.GetStep();
                }
                ut_next = findNextCuspForward(ut_start, ref becomesDirect);

                BodyPosition bp_curr = Basics.CalculateSingleBodyPosition(ut_curr, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h);
                BodyPosition bp_next = Basics.CalculateSingleBodyPosition(ut_next, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h);

                //Console.WriteLine ("{0}, {1}, {2}", becomesDirect, bp_curr.longitude, bp_next.longitude);

                if (false == becomesDirect &&
                    lonToFind.sub(bp_curr.longitude).value <= bp_next.longitude.sub(bp_curr.longitude).value)
                {
                    //Console.WriteLine ("+ Found {0} between {1} and {2}", lonToFind, bp_curr.longitude, bp_next.longitude);
                    break;
                }
                else if (true == becomesDirect &&
                         lonToFind.sub(bp_next.longitude).value <= bp_curr.longitude.sub(bp_next.longitude).value)
                {
                    //Console.WriteLine ("- Found {0} betweeen {1} and {2}", lonToFind, bp_next.longitude, bp_curr.longitude);
                    break;
                }
                else
                {
                    //Console.WriteLine ("{3} Didn't find {0} betweeen {1} and {2}", lonToFind, bp_curr.longitude, bp_next.longitude, ut_curr);
                }
            }

            if (false == becomesDirect)
            {
                return(this.BinaryLonSearch(ut_curr, ut_next, lonToFind, true));
            }
            else
            {
                return(this.BinaryLonSearch(ut_curr, ut_next, lonToFind, false));
            }
        }
Example #4
0
 public Task(int Id, BodyPosition Body, ArmPosition Arm, DOF dof, InputType Input = InputType.TRIGGER)
 {
     this.Id              = Id;
     this.Round           = 0;
     this.BodyPos         = Body;
     this.ArmPos          = Arm;
     this.DegreeOfFreedom = dof;
     this.Input           = Input;
     this.Circles         = new List <Circle>();
     this.Stack           = new List <Position>();
 }
Example #5
0
        public Longitude GetLon(double ut, ref bool bForward)
        {
            if (this.b == Body.Name.Lagna)
            {
                return(new Longitude(sweph.swe_lagna(ut)));
            }

            BodyPosition bp = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h);

            bForward = bp.speed_longitude >= 0;
            return(bp.longitude);
        }
    void Update()
    {
        h = Input.GetAxisRaw("Horizontal");
        v = Input.GetAxisRaw("Vertical");

        //====================CROUCH CONTROLS====================
        if (Input.GetKeyDown(KeyCode.LeftControl))
        {
            ttPositionCheck = Time.time + ttPosition;
        }
        if (Input.GetKey(KeyCode.LeftControl))
        {
            if (ttPositionCheck > Time.time)        //If the player just tapped the cntl key
            {
                if (bp == BodyPosition.Standing || bp == BodyPosition.Prone)
                {
                    bp = BodyPosition.Crouching;
                }
                else
                if (bp == BodyPosition.Crouching)
                {
                    bp = BodyPosition.Standing;
                }

                Debug.Log(ttPositionCheck + " / " + bp);
                return;
            }
            if (ttPositionCheck < Time.time)        //If the player held the cntl key
            {
                if (bp == BodyPosition.Standing || bp == BodyPosition.Crouching)
                {
                    bp = BodyPosition.Prone;
                }
                else
                if (bp == BodyPosition.Prone)
                {
                    bp = BodyPosition.Standing;
                }
                Debug.Log(ttPositionCheck + " / " + bp);
            }
        }


        //====================RUN CONTROLS====================
        if (Input.GetKey(KeyCode.LeftShift))
        {
            run = true;
        }
        else
        {
            run = false;
        }
    }
Example #7
0
        public double ojaYugmaRasyAmsaBala(Body.Name b)
        {
            this.verifyGraha(b);
            BodyPosition bp      = h.getPosition(b);
            ZodiacHouse  zh_rasi = bp.toDivisionPosition(new Division(Basics.DivisionType.Rasi)).zodiac_house;
            ZodiacHouse  zh_amsa = bp.toDivisionPosition(new Division(Basics.DivisionType.Navamsa)).zodiac_house;
            double       s       = 0;

            s += this.ojaYugmaHelper(b, zh_rasi);
            s += this.ojaYugmaHelper(b, zh_amsa);
            return(s);
        }
Example #8
0
        public Longitude LongitudeOfSun(double ut, ref bool bDirRetro)
        {
            BodyPosition bp = Basics.CalculateSingleBodyPosition(ut, sweph.SE_SUN, Body.Name.Sun, BodyType.Name.Graha, this.h);

            if (bp.speed_longitude >= 0)
            {
                bDirRetro = false;
            }
            else
            {
                bDirRetro = true;
            }
            return(bp.longitude);
        }
Example #9
0
        public Longitude GetLongitude(double ut, ref bool bForwardDir)
        {
            int          swephBody = BodyNameToSweph(b);
            BodyPosition bp        = Basics.CalculateSingleBodyPosition(ut, swephBody, b, BodyType.Name.Other, h);

            if (bp.speed_longitude >= 0)
            {
                bForwardDir = true;
            }
            else
            {
                bForwardDir = false;
            }
            return(bp.longitude);
        }
Example #10
0
        private void PrintBody(BodyPosition bp)
        {
            Brush b = Brushes.Black;

            g.ResetTransform();
            g.TranslateTransform(left, top);
            g.DrawString(bp.name.ToString(), f, b, 0, 0);
            g.DrawString(bp.longitude.ToString(), f_fix, b, width / 6, 0);

            string    s        = "";
            Nakshatra nak      = bp.longitude.toNakshatra();
            int       nak_pada = bp.longitude.toNakshatraPada();

            s = string.Format("{0} {1}", nak.toShortString(), nak_pada);
            g.DrawString(s, f, b, (float)((width / 6) * 2.5), 0);

            top += f.Height;
        }
Example #11
0
    public static List <Task> CreateTasks(LatinSquare LTC, LatinSquare LTT)
    {
        /**string file = Path.Combine(Application.streamingAssetsPath, "latinsquares.txt");
         * for (int r = 0; r <= 12; r++) {*/
        int[] column = LTC.GetColumn(Config.UserId % 8);
        int   start  = (Config.UserId * LTC.GetSize()) % LTT.GetSize();
        //int[] column = LTC.GetColumn(r % 8);
        //int start = (r * LTC.GetSize()) % LTT.GetSize();
        List <Task> Tasks = new List <Task>();

        for (int i = 0; i < column.Length; i++)
        {
            // Get states from LatinSquare for Tasks
            int          state = column[i];
            BodyPosition Body  = state <= 4 ? BodyPosition.SITTING : BodyPosition.STANDING;
            ArmPosition  Arm   = new List <int>()
            {
                1, 2, 5, 6
            }.IndexOf(state) != -1 ? ArmPosition.STRECHED : ArmPosition.APPLIED;
            DOF dof = state % 2 == 0 ? DOF.THREE : DOF.SIX;

            Task tmp = new Task(i, Body, Arm, dof);
            tmp.CreateCircles(LTT, (i * column.Length) % LTT.GetSize());
            Debug.Log(tmp.PrintCommand(i));

            /**if (!File.Exists(file)) {
             *   using (StreamWriter w = File.CreateText(file)) {
             *       w.WriteLine("UserId: " + r + " | TaskNo. " + i + " | Command: " + tmp.PrintCommand(i));
             *   }
             * } else {
             *   using (StreamWriter w = File.AppendText(file)) {
             *       w.WriteLine("UserId: " + r + " | TaskNo. " + i + " | Command: " + tmp.PrintCommand(i));
             *   }
             * }*/

            Tasks.Add(tmp);

            start = start < LTC.GetSize() ? start + 1 : 0;
            //}
        }

        return(Tasks);
    }
Example #12
0
        public double FindClosestTransit(double ut, Longitude lonToFind)
        {
            BodyPosition bp = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h);

            while (Transit.CircLonLessThan(bp.longitude, lonToFind))
            {
                //Console.WriteLine("- {0} {1}", bp.longitude.value, lonToFind.value);
                ut++;
                bp = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h);
            }

            while (Transit.CircLonLessThan(lonToFind, bp.longitude))
            {
                //Console.WriteLine("+ {0} {1}", bp.longitude.value, lonToFind.value);
                ut--;
                bp = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h);
            }

            return(ut);
        }
Example #13
0
        public Longitude GenericLongitude(double ut, ref bool bDirRetro)
        {
            if (b == Body.Name.Lagna)
            {
                return(new Longitude(sweph.swe_lagna(ut)));
            }

            BodyPosition bp = Basics.CalculateSingleBodyPosition(ut,
                                                                 sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h);

            if (bp.speed_longitude >= 0)
            {
                bDirRetro = false;
            }
            else
            {
                bDirRetro = true;
            }
            return(bp.longitude);
        }
Example #14
0
        public double gotoNextRetroSolarCusp(double ut)
        {
            return(ut);

#if DND
            Longitude    cusp_start = new Longitude(0);
            Longitude    cusp_end   = new Longitude(0);
            BodyPosition bp_sun     = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(Body.Name.Sun), Body.Name.Sun, BodyType.Name.Other);
            BodyPosition bp_b       = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other);
            Longitude    diff       = bp_b.longitude.sub(bp_sun.longitude);
            if (Transit.CircLonLessThan(cusp_start, diff) &&
                Transit.CircLonLessThan(diff, cusp_end))
            {
                return(ut);
            }

            Longitude diffIncrease = diff.sub(cusp_start);
            double    ret          = ut + (diffIncrease.value * 360.0 / 365.2425);
            return(ret);
#endif
        }
Example #15
0
        public static string Get(ChassisPoint cp, BodyPosition bp = BodyPosition.Undefined)
        {
            switch (cp)
            {
            case ChassisPoint.ArmourPlating:
                return("Armour plating");

            case ChassisPoint.ArmourHardPoint:
                return("Armour hard point");

            case ChassisPoint.MotivatorManipulation:
                return("Motivator (manipulation)");

            case ChassisPoint.MotivatorMoving:
                return("Motivator (moving)");

            case ChassisPoint.CPU:
                return("CPU");

            case ChassisPoint.VisualReceptor:
                if (bp == BodyPosition.LeftVisualReceptor)
                {
                    return("Left visual receptor");
                }
                else if (bp == BodyPosition.RightVisualReceptor)
                {
                    return("Right visual receptor");
                }
                else
                {
                    return("Visual receptor");
                }

            case ChassisPoint.MediumHead:
                return("Head");

            case ChassisPoint.MediumChassis:
                return("Chassis");

            case ChassisPoint.MediumShoulder:
                if (bp == BodyPosition.LeftShoulder)
                {
                    return("Left shoulder");
                }
                else if (bp == BodyPosition.LeftShoulder)
                {
                    return("Right shoulder");
                }
                else
                {
                    return("Shoulder");
                }

            case ChassisPoint.MediumArm:
                if (bp == BodyPosition.LeftArm)
                {
                    return("Left arm");
                }
                else if (bp == BodyPosition.RightArm)
                {
                    return("Right arm");
                }
                else
                {
                    return("Arm");
                }

            case ChassisPoint.MediumHand:
                if (bp == BodyPosition.RightHand)
                {
                    return("Right hand");
                }
                else if (bp == BodyPosition.LeftArm)
                {
                    return("Left hand");
                }
                else
                {
                    return("Hand");
                }

            case ChassisPoint.MediumFinger:
                return("Finger");

            case ChassisPoint.MediumLegSocket:
                return("Leg socket");

            case ChassisPoint.MediumLeg:
                if (bp == BodyPosition.LeftLeg)
                {
                    return("Left leg");
                }
                else if (bp == BodyPosition.RightLeg)
                {
                    return("Right leg");
                }
                else
                {
                    return("Leg");
                }

            case ChassisPoint.MediumFoot:
                if (bp == BodyPosition.LeftFoot)
                {
                    return("Left foot");
                }
                else if (bp == BodyPosition.RightFoot)
                {
                    return("Right foot");
                }
                else
                {
                    return("Foot");
                }

            default:
                return("Slot");
            }
        }
Example #16
0
 public void CopyFrom(PartCustomisePack pack)
 {
     chassisPoint = pack.ChassisPoint;
     bodyPosition = pack.BodyPosition;
     part         = pack.Part;
 }
Example #17
0
 public PartCustomisePack(ChassisPoint cp, DroidChassisPartDef part = null, BodyPosition position = BodyPosition.Undefined)
 {
     chassisPoint = cp;
     this.part    = part;
     bodyPosition = position;
 }
Example #18
0
        public void DrawChakra(Graphics g)
        {
            //this.DrawInnerChakra(g);

            if (false == this.PrintMode)
            {
                g.Clear(MhoraGlobalOptions.Instance.ChakraBackgroundColor);
            }

            this.ResetChakra(g, 0.0);
            g.DrawEllipse(pn_grey, -40, -40, 80, 80);
            g.DrawEllipse(pn_grey, -125, -125, 250, 250);
            g.DrawEllipse(pn_grey, -105, -105, 210, 210);
            g.DrawEllipse(pn_grey, -115, -115, 230, 230);

            Body.Name[] bodies = new Body.Name[10]
            {
                Body.Name.Lagna, Body.Name.Sun, Body.Name.Moon, Body.Name.Mars, Body.Name.Mercury,
                Body.Name.Jupiter, Body.Name.Venus, Body.Name.Saturn, Body.Name.Rahu, Body.Name.Ketu
            };

            for (int i = 0; i < 12; i++)
            {
                ResetChakra(g, i * 30);
                g.DrawLine(pn_lgrey, 40, 0, 125, 0);
            }
            for (int i = 0; i < 12; i++)
            {
                ResetChakra(g, i * 30 + 15);
                ZodiacHouse.Name z  = (ZodiacHouse.Name)(i + 1);
                SizeF            sz = g.MeasureString(z.ToString(), f);
                g.DrawString(z.ToString(), f, Brushes.Gray, 40 - sz.Width, 0);
            }
            for (int i = 0; i < 27; i++)
            {
                ResetChakra(g, (i + 1) * (360.0 / 27.0));          //+((360.0/27.0)/2.0));
                g.TranslateTransform(105, 0);
                g.RotateTransform((float)90.0);
                SizeF sz = g.MeasureString(nak_s[i], f);
                g.DrawString(nak_s[i], f, Brushes.Gray, (float)(360.0 / 27.0) - (sz.Width / 2), sz.Height / 2);
            }
            for (int i = 0; i < 27 * 4; i++)
            {
                ResetChakra(g, i * (360.0 / (27.0 * 4.0)));
                Pen p = pn_lgrey;
                if (i % 12 == 0)
                {
                    p = pn_black;
                }
                g.DrawLine(p, 115, 0, 125, 0);

                p = pn_lgrey;
                if (i % 4 == 0)
                {
                    p = pn_black;
                }
                g.DrawLine(p, 105, 0, 115, 0);
            }

            double dist_sat = h.getPosition(Body.Name.Saturn).distance;

            foreach (Body.Name b in bodies)
            {
                Pen          pn_b = new Pen(MhoraGlobalOptions.Instance.getBinduColor(b));
                Brush        br_b = new SolidBrush(MhoraGlobalOptions.Instance.getBinduColor(b));
                BodyPosition bp   = h.getPosition(b);
                ResetChakra(g, bp.longitude.value);
                int chWidth = 2;
                g.DrawEllipse(pn_black, 110 - (chWidth), 0, 1, 1);
                g.FillEllipse(br_b, 120 - chWidth, -chWidth, chWidth * 2, chWidth * 2);
                g.DrawEllipse(pn_grey, 120 - chWidth, -chWidth, chWidth * 2, chWidth * 2);
                SizeF sz = g.MeasureString(b.ToString(), f);
                g.DrawString(b.ToString(), f, Brushes.Black, 125, -sz.Height / 2);

                // current position with distance
                int dist = (int)(bp.distance / dist_sat * (105 - 40 - chWidth * 2));
                g.FillEllipse(br_b, 40 + dist - chWidth, -chWidth, chWidth * 2, chWidth * 2);
                g.DrawEllipse(pn_grey, 40 + dist - chWidth, -chWidth, chWidth * 2, chWidth * 2);

                // speed
                double dspSize = (bp.speed_longitude / 360.0) * 12000.0;
                if (bp.speed_longitude < 0)
                {
                    dspSize *= 2.0;
                }
                int spSize = (int)dspSize;
                if (spSize > 40)
                {
                    spSize = 40;
                }
                if (bp.speed_longitude > 0)
                {
                    g.DrawLine(pn_lgrey, 40 + dist, -chWidth, 40 + dist, -spSize);
                }
                else
                {
                    g.DrawLine(pn_lgrey, 40 + dist, chWidth, 40 + dist, -spSize);
                }
            }
        }
Example #19
0
        public void SetView(BaseUserOptions.ViewType view)
        {
            MhoraControl mc = null;;

            switch (view)
            {
            case BaseUserOptions.ViewType.DivisionalChart:
                mc = new DivisionalChart(h);
                break;

            case BaseUserOptions.ViewType.Ashtakavarga:
                mc = new AshtakavargaControl(h);
                break;

            case BaseUserOptions.ViewType.ChakraSarvatobhadra81:
                mc = new Sarvatobhadra81Control(h);
                break;

            case BaseUserOptions.ViewType.NavamsaCircle:
                mc = new NavamsaControl(h);
                break;

            case BaseUserOptions.ViewType.VaraChakra:
                mc = new VaraChakra(h);
                break;

            case BaseUserOptions.ViewType.Panchanga:
                mc = new PanchangaControl(h);
                break;

            case BaseUserOptions.ViewType.KutaMatching:
            {
                Horoscope h2 = h;
                foreach (Form f in ((MhoraContainer)MhoraGlobalOptions.mainControl).MdiChildren)
                {
                    if (f is MhoraChild)
                    {
                        MhoraChild mch = (MhoraChild)f;
                        if (h == h2 && mch.getHoroscope() != h2)
                        {
                            h2 = mch.getHoroscope();
                            break;
                        }
                    }
                }
                mc = new KutaMatchingControl(h, h);
            }
            break;

            case BaseUserOptions.ViewType.DasaVimsottari:
                mc = new DasaControl(h, new VimsottariDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaYogini:
                mc = new DasaControl(h, new YoginiDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaShodashottari:
                mc = new DasaControl(h, new ShodashottariDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaAshtottari:
                mc = new DasaControl(h, new AshtottariDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaTithiAshtottari:
                mc = new DasaControl(h, new TithiAshtottariDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaKaranaChaturashitiSama:
                mc = new DasaControl(h, new KaranaChaturashitiSamaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaYogaVimsottari:
                mc = new DasaControl(h, new YogaVimsottariDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaLagnaKendradiRasi:
                mc = new DasaControl(h, new LagnaKendradiRasiDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaKarakaKendradiGraha:
                mc = new DasaControl(h, new KarakaKendradiGrahaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaKalachakra:
                mc = new DasaControl(h, new KalachakraDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaMoola:
                mc = new DasaControl(h, new MoolaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaNavamsa:
                mc = new DasaControl(h, new NavamsaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaMandooka:
                mc = new DasaControl(h, new MandookaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaChara:
                mc = new DasaControl(h, new CharaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaTrikona:
                mc = new DasaControl(h, new TrikonaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaSu:
                mc = new DasaControl(h, new SuDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaSudarshanaChakra:
                mc = new DasaControl(h, new SudarshanaChakraDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaMudda:
            {
                DasaControl dc = new DasaControl(h, new VimsottariDasa(h));
                dc.DasaOptions.YearType    = ToDate.DateType.SolarYear;
                dc.DasaOptions.YearLength  = 360;
                dc.DasaOptions.Compression = 1;
                dc.Reset();
                mc = dc;
            }
            break;

            case BaseUserOptions.ViewType.DasaSudarshanaChakraCompressed:
            {
                DasaControl dc = new DasaControl(h, new SudarshanaChakraDasa(h));
                dc.DasaOptions.YearType    = ToDate.DateType.SolarYear;
                dc.DasaOptions.YearLength  = 360;
                dc.DasaOptions.Compression = 1;
                dc.Reset();
                mc = dc;
            }
            break;

            case BaseUserOptions.ViewType.DasaYogaPraveshVimsottariCompressedYoga:
            {
                DasaControl dc = new DasaControl(h, new YogaVimsottariDasa(h));
                dc.compressToYogaPraveshaYearYoga();
                mc = dc;
            }
            break;

            case BaseUserOptions.ViewType.DasaTithiPraveshAshtottariCompressedTithi:
            {
                DasaControl dc = new DasaControl(h, new TithiAshtottariDasa(h));
                dc.DasaOptions.YearType = ToDate.DateType.TithiYear;
                ToDate td_pravesh = new ToDate(h.baseUT, ToDate.DateType.TithiPraveshYear, 360.0, 0, h);
                ToDate td_tithi   = new ToDate(h.baseUT, ToDate.DateType.TithiYear, 360.0, 0, h);
                sweph.obtainLock(h);
                if (td_tithi.AddYears(1).toUniversalTime() + 15.0 < td_pravesh.AddYears(1).toUniversalTime())
                {
                    dc.DasaOptions.YearLength = 390;
                }
                sweph.releaseLock(h);
                dc.DasaOptions.Compression = 1;

                TithiAshtottariDasa.UserOptions tuo = (TithiAshtottariDasa.UserOptions)dc.DasaSpecificOptions;
                tuo.UseTithiRemainder  = true;
                dc.DasaSpecificOptions = tuo;

                dc.Reset();
                mc = dc;
            }
            break;

            case BaseUserOptions.ViewType.DasaTithiPraveshAshtottariCompressedFixed:
            {
                DasaControl dc         = new DasaControl(h, new TithiAshtottariDasa(h));
                ToDate      td_pravesh = new ToDate(h.baseUT, ToDate.DateType.TithiPraveshYear, 360.0, 0, h);
                sweph.obtainLock(h);
                dc.DasaOptions.YearType   = ToDate.DateType.FixedYear;
                dc.DasaOptions.YearLength = td_pravesh.AddYears(1).toUniversalTime() -
                                            td_pravesh.AddYears(0).toUniversalTime();
                sweph.releaseLock(h);

                TithiAshtottariDasa.UserOptions tuo = (TithiAshtottariDasa.UserOptions)dc.DasaSpecificOptions;
                tuo.UseTithiRemainder      = true;
                dc.DasaSpecificOptions     = tuo;
                dc.DasaOptions.Compression = 1;

                dc.Reset();
                mc = dc;
            }
            break;

            case BaseUserOptions.ViewType.DasaTithiPraveshAshtottariCompressedSolar:
            {
                DasaControl dc         = new DasaControl(h, new TithiAshtottariDasa(h));
                ToDate      td_pravesh = new ToDate(h.baseUT, ToDate.DateType.TithiPraveshYear, 360.0, 0, h);
                sweph.obtainLock(h);
                double       ut_start = td_pravesh.AddYears(0).toUniversalTime();
                double       ut_end   = td_pravesh.AddYears(1).toUniversalTime();
                BodyPosition sp_start = Basics.CalculateSingleBodyPosition(
                    ut_start, sweph.BodyNameToSweph(Body.Name.Sun), Body.Name.Sun, BodyType.Name.Graha, this.h);
                BodyPosition sp_end = Basics.CalculateSingleBodyPosition(
                    ut_end, sweph.BodyNameToSweph(Body.Name.Sun), Body.Name.Sun, BodyType.Name.Graha, this.h);
                Longitude lDiff = sp_end.longitude.sub(sp_start.longitude);
                double    diff  = lDiff.value;
                if (diff < 120.0)
                {
                    diff += 360.0;
                }

                dc.DasaOptions.YearType   = ToDate.DateType.SolarYear;
                dc.DasaOptions.YearLength = diff;
                sweph.releaseLock(h);

                TithiAshtottariDasa.UserOptions tuo = (TithiAshtottariDasa.UserOptions)dc.DasaSpecificOptions;
                tuo.UseTithiRemainder  = true;
                dc.DasaSpecificOptions = tuo;


                //dc.DasaOptions.YearType = ToDate.DateType.FixedYear;
                //dc.DasaOptions.YearLength = td_pravesh.AddYears(1).toUniversalTime() -
                //	td_pravesh.AddYears(0).toUniversalTime();
                dc.DasaOptions.Compression = 1;

                dc.Reset();
                mc = dc;
            }
            break;

            case BaseUserOptions.ViewType.DasaDwadashottari:
                mc = new DasaControl(h, new DwadashottariDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaPanchottari:
                mc = new DasaControl(h, new PanchottariDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaShatabdika:
                mc = new DasaControl(h, new ShatabdikaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaChaturashitiSama:
                mc = new DasaControl(h, new ChaturashitiSamaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaDwisaptatiSama:
                mc = new DasaControl(h, new DwisaptatiSamaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaShatTrimshaSama:
                mc = new DasaControl(h, new ShatTrimshaSamaDasa(h));
                break;

            case BaseUserOptions.ViewType.BasicCalculations:
                mc = new BasicCalculationsControl(h);
                break;

            case BaseUserOptions.ViewType.KeyInfo:
                mc = new KeyInfoControl(h);
                break;

            case BaseUserOptions.ViewType.Balas:
                mc = new BalasControl(h);
                break;

            case BaseUserOptions.ViewType.TransitSearch:
                mc = new TransitSearch(h);
                break;

            case BaseUserOptions.ViewType.NaisargikaRasiDasa:
                mc = new DasaControl(h, new NaisargikaRasiDasa(h));
                break;

            case BaseUserOptions.ViewType.NaisargikaGrahaDasa:
                mc = new DasaControl(h, new NaisargikaGrahaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaNarayana:
                mc = new DasaControl(h, new NarayanaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaNarayanaSama:
                mc = new DasaControl(h, new NarayanaSamaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaShoola:
                mc = new DasaControl(h, new ShoolaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaNiryaanaShoola:
                mc = new DasaControl(h, new NirayaanaShoolaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaDrig:
                mc = new DasaControl(h, new DrigDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaTajaka:
                mc = new DasaControl(h, new TajakaDasa(h));
                break;

            case BaseUserOptions.ViewType.DasaTithiPravesh:
            {
                DasaControl dc = new DasaControl(h, new TithiPraveshDasa(h));
                dc.DasaOptions.YearType = ToDate.DateType.TithiPraveshYear;
                dc.LinkToHoroscope      = false;
                dc.Reset();
                mc = dc;
            }
            break;

            case BaseUserOptions.ViewType.DasaYogaPravesh:
            {
                DasaControl dc = new DasaControl(h, new YogaPraveshDasa(h));
                dc.DasaOptions.YearType = ToDate.DateType.YogaPraveshYear;
                dc.LinkToHoroscope      = false;
                dc.Reset();
                mc = dc;
            }
            break;

            case BaseUserOptions.ViewType.DasaNakshatraPravesh:
            {
                DasaControl dc = new DasaControl(h, new NakshatraPraveshDasa(h));
                dc.DasaOptions.YearType = ToDate.DateType.NakshatraPraveshYear;
                dc.LinkToHoroscope      = false;
                dc.Reset();
                mc = dc;
            }
            break;

            case BaseUserOptions.ViewType.DasaKaranaPravesh:
            {
                DasaControl dc = new DasaControl(h, new KaranaPraveshDasa(h));
                dc.DasaOptions.YearType = ToDate.DateType.KaranaPraveshYear;
                dc.LinkToHoroscope      = false;
                dc.Reset();
                mc = dc;
            }
            break;

            case BaseUserOptions.ViewType.DasaTattwa:
                mc = new DasaControl(h, new TattwaDasa(h));
                break;

            default:
                Debug.Assert(false, "Unknown View Internal error");
                break;
            }
            mc.Dock = DockStyle.Fill;
            if (null != this.Control)
            {
                this.Control.Dispose();
            }
            this.Control = mc;

            return;
        }
Example #20
0
        public void OnRecalculate(Object o)
        {
            Division dtype = new Division(Basics.DivisionType.Rasi);

            BodyPosition l1 = h.getPosition(Body.Name.Lagna);
            BodyPosition l2 = h2.getPosition(Body.Name.Lagna);
            BodyPosition m1 = h.getPosition(Body.Name.Moon);
            BodyPosition m2 = h2.getPosition(Body.Name.Moon);
            ZodiacHouse  z1 = m1.toDivisionPosition(dtype).zodiac_house;
            ZodiacHouse  z2 = m2.toDivisionPosition(dtype).zodiac_house;
            Nakshatra    n1 = m1.longitude.toNakshatra();
            Nakshatra    n2 = m2.longitude.toNakshatra();

            this.lView.Items.Clear();

            {
                ListViewItem li = new ListViewItem("Nakshatra Yoni");
                li.SubItems.Add(KutaNakshatraYoni.getType(n1).ToString()
                                + " (" + KutaNakshatraYoni.getSex(n1).ToString() + ")");
                li.SubItems.Add(KutaNakshatraYoni.getType(n2).ToString()
                                + " (" + KutaNakshatraYoni.getSex(n2).ToString() + ")");
                lView.Items.Add(li);
            }
            {
                ListViewItem li = new ListViewItem("Rasi Yoni");
                li.SubItems.Add(KutaRasiYoni.getType(z1).ToString());
                li.SubItems.Add(KutaRasiYoni.getType(z2).ToString());
                lView.Items.Add(li);
            }
            {
                ListViewItem li = new ListViewItem("Varna");
                li.SubItems.Add(KutaVarna.getType(n1).ToString());
                li.SubItems.Add(KutaVarna.getType(n2).ToString());
                li.SubItems.Add(KutaVarna.getScore(n1, n2).ToString() + "/" + KutaVarna.getMaxScore().ToString());
                lView.Items.Add(li);
            }
            {
                ListViewItem li = new ListViewItem("Gana (Chandra)");
                li.SubItems.Add(KutaGana.getType(n1).ToString());
                li.SubItems.Add(KutaGana.getType(n2).ToString());
                li.SubItems.Add(KutaGana.getScore(n1, n2).ToString() + "/" + KutaGana.getMaxScore().ToString());

                lView.Items.Add(li);
            }
            {
                ListViewItem li = new ListViewItem("Gana (Lagna)");
                li.SubItems.Add(KutaGana.getType(l1.longitude.toNakshatra()).ToString());
                li.SubItems.Add(KutaGana.getType(l2.longitude.toNakshatra()).ToString());
                li.SubItems.Add(KutaGana.getScore(l1.longitude.toNakshatra(), l2.longitude.toNakshatra()).ToString()
                                + "/" + KutaGana.getMaxScore().ToString());
                lView.Items.Add(li);
            }
            {
                ListViewItem li = new ListViewItem("Vedha");
                li.SubItems.Add(KutaVedha.getType(n1).ToString());
                li.SubItems.Add(KutaVedha.getType(n2).ToString());
                li.SubItems.Add(KutaVedha.getScore(n1, n2).ToString() + "/" + KutaVedha.getMaxScore().ToString());
                lView.Items.Add(li);
            }
            {
                ListViewItem li = new ListViewItem("Rajju");
                li.SubItems.Add(KutaRajju.getType(n1).ToString());
                li.SubItems.Add(KutaRajju.getType(n2).ToString());
                li.SubItems.Add(KutaRajju.getScore(n1, n2).ToString() + "/" + KutaRajju.getMaxScore().ToString());
                lView.Items.Add(li);
            }
            {
                ListViewItem li = new ListViewItem("Nadi");
                li.SubItems.Add(KutaNadi.getType(n1).ToString());
                li.SubItems.Add(KutaNadi.getType(n2).ToString());
                li.SubItems.Add(KutaNadi.getScore(n1, n2).ToString() + "/" + KutaNadi.getMaxScore().ToString());
                lView.Items.Add(li);
            }
            {
                ListViewItem li = new ListViewItem("Gotra (TD:Abhi)");
                li.SubItems.Add(KutaGotra.getType(n1).ToString());
                li.SubItems.Add(KutaGotra.getType(n2).ToString());
                li.SubItems.Add(KutaGotra.getScore(n1, n2).ToString() + "/" + KutaGotra.getMaxScore().ToString());
                lView.Items.Add(li);
            }
            {
                ListViewItem li = new ListViewItem("Vihanga");
                li.SubItems.Add(KutaVihanga.getType(n1).ToString());
                li.SubItems.Add(KutaVihanga.getType(n2).ToString());
                li.SubItems.Add(KutaVihanga.getDominator(n1, n2).ToString());
                lView.Items.Add(li);
            }
            {
                ListViewItem li = new ListViewItem("Bhuta (Nakshatra)");
                li.SubItems.Add(KutaBhutaNakshatra.getType(n1).ToString());
                li.SubItems.Add(KutaBhutaNakshatra.getType(n2).ToString());
                li.SubItems.Add(KutaBhutaNakshatra.getScore(n1, n2).ToString() + "/" + KutaBhutaNakshatra.getMaxScore().ToString());
                lView.Items.Add(li);
            }
            {
                ListViewItem li        = new ListViewItem("Ghataka (Moon)");
                ZodiacHouse  ja        = h.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house;
                ZodiacHouse  ch        = h2.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house;
                bool         isGhataka = GhatakaMoon.checkGhataka(ja, ch);
                li.SubItems.Add(ja.ToString());
                li.SubItems.Add(ch.ToString());
                li.SubItems.Add(getGhatakaString(isGhataka));
                lView.Items.Add(li);
            }
            {
                ListViewItem li        = new ListViewItem("Ghataka (Tithi)");
                ZodiacHouse  ja        = h.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house;
                Longitude    ltithi    = h2.getPosition(Body.Name.Moon).longitude.sub(h2.getPosition(Body.Name.Sun).longitude);
                Tithi        t         = ltithi.toTithi();
                bool         isGhataka = GhatakaTithi.checkTithi(ja, t);
                li.SubItems.Add(ja.ToString());
                li.SubItems.Add(t.ToString());
                li.SubItems.Add(getGhatakaString(isGhataka));
                lView.Items.Add(li);
            }
            {
                ListViewItem   li        = new ListViewItem("Ghataka (Day)");
                ZodiacHouse    ja        = h.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house;
                Basics.Weekday wd        = h2.wday;
                bool           isGhataka = GhatakaDay.checkDay(ja, wd);
                li.SubItems.Add(ja.ToString());
                li.SubItems.Add(wd.ToString());
                li.SubItems.Add(getGhatakaString(isGhataka));
                lView.Items.Add(li);
            }
            {
                ListViewItem li        = new ListViewItem("Ghataka (Star)");
                ZodiacHouse  ja        = h.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house;
                Nakshatra    na        = h2.getPosition(Body.Name.Moon).longitude.toNakshatra();
                bool         isGhataka = GhatakaStar.checkStar(ja, na);
                li.SubItems.Add(ja.ToString());
                li.SubItems.Add(na.ToString());
                li.SubItems.Add(getGhatakaString(isGhataka));
                lView.Items.Add(li);
            }
            {
                ListViewItem li        = new ListViewItem("Ghataka Lagna(S)");
                ZodiacHouse  ja        = h.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house;
                ZodiacHouse  sa        = h2.getPosition(Body.Name.Lagna).toDivisionPosition(dtype).zodiac_house;
                bool         isGhataka = GhatakaLagnaSame.checkLagna(ja, sa);
                li.SubItems.Add(ja.ToString());
                li.SubItems.Add(sa.ToString());
                li.SubItems.Add(getGhatakaString(isGhataka));
                lView.Items.Add(li);
            }
            {
                ListViewItem li        = new ListViewItem("Ghataka Lagna(O)");
                ZodiacHouse  ja        = h.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house;
                ZodiacHouse  op        = h2.getPosition(Body.Name.Lagna).toDivisionPosition(dtype).zodiac_house;
                bool         isGhataka = GhatakaLagnaOpp.checkLagna(ja, op);
                li.SubItems.Add(ja.ToString());
                li.SubItems.Add(op.ToString());
                li.SubItems.Add(getGhatakaString(isGhataka));
                lView.Items.Add(li);
            }
            this.ColorAndFontRows(this.lView);
        }
Example #21
0
        private void PopulateCache()
        {
            momentCusps = new double[opts.Divisions.Length][];
            zhCusps     = new ZodiacHouse.Name[opts.Divisions.Length][];
            for (int i = 0; i < opts.Divisions.Length; i++)
            {
                Division  dtype = opts.Divisions[i];
                ArrayList al    = new ArrayList();
                ArrayList zal   = new ArrayList();
                //Console.WriteLine ("Calculating cusps for {0} between {1} and {2}",
                //	dtype, this.utToMoment(ut_lower), this.utToMoment(ut_higher));
                double ut_curr = ut_lower - (1.0 / (24.0 * 60.0));

                sweph.obtainLock(h);
                BodyPosition bp = Basics.CalculateSingleBodyPosition(ut_curr, sweph.BodyNameToSweph(mBody), mBody,
                                                                     BodyType.Name.Graha, h);
                sweph.releaseLock(h);
                //BodyPosition bp = (BodyPosition)h.getPosition(mBody).Clone();
                //DivisionPosition dp = bp.toDivisionPosition(this.dtypeRasi);

                DivisionPosition dp = bp.toDivisionPosition(dtype);

                //Console.WriteLine ("Longitude at {0} is {1} as is in varga rasi {2}",
                //	this.utToMoment(ut_curr), bp.longitude, dp.zodiac_house.value);

                //bp.longitude = new Longitude(dp.cusp_lower - 0.2);
                //dp = bp.toDivisionPosition(dtype);

                while (true)
                {
                    Moment    m        = this.utToMoment(ut_curr);
                    Longitude foundLon = new Longitude(0);
                    bool      bForward = true;

                    //Console.WriteLine ("    Starting search at {0}", this.utToMoment(ut_curr));

                    ut_curr = cs.TransitSearch(mBody, this.utToMoment(ut_curr), true,
                                               new Longitude(dp.cusp_higher), foundLon, ref bForward);

                    bp.longitude = new Longitude(dp.cusp_higher + 0.1);
                    dp           = bp.toDivisionPosition(dtype);

                    if (ut_curr >= ut_lower && ut_curr <= ut_higher + (1.0 / (24.0 * 60.0 * 60.0)) * 5.0)
                    {
                        //	Console.WriteLine ("{0}: {1} at {2}",
                        //		dtype, foundLon, this.utToMoment(ut_curr));
                        al.Add(ut_curr);
                        zal.Add(dp.zodiac_house.value);
                    }
                    else if (ut_curr > ut_higher)
                    {
                        //	Console.WriteLine ("- {0}: {1} at {2}",
                        //		dtype, foundLon, this.utToMoment(ut_curr));
                        break;
                    }
                    ut_curr += ((1.0 / (24.0 * 60.0 * 60.0)) * 5.0);
                }
                momentCusps[i] = (double[])al.ToArray(typeof(double));
                zhCusps[i]     = (ZodiacHouse.Name[])zal.ToArray(typeof(ZodiacHouse.Name));
            }


            //for (int i=0; i<opts.Divisions.Length; i++)
            //{
            //	for (int j=0; j<momentCusps[i].Length; j++)
            //	{
            //		Console.WriteLine ("Cusp for {0} at {1}", opts.Divisions[i], momentCusps[i][j]);
            //	}
            //}
        }
Example #22
0
 void Start()
 {
     bp = BodyPosition.Standing;
 }
Example #23
0
        public Longitude GetLon(double ut)
        {
            BodyPosition bp = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h);

            return(bp.longitude);
        }
Example #24
0
        private void ComputeEntry(double ut, double[] geopos)
        {
            int    year = 0, month = 0, day = 0;
            double sunset = 0, hour = 0;

            sweph.obtainLock(h);
            h.populateSunrisetCacheHelper(ut - 0.5, ref sunrise, ref sunset, ref ut_sr);
            sweph.releaseLock(h);

            sweph.swe_revjul(ut_sr, ref year, ref month, ref day, ref hour);
            Moment    moment_sr = new Moment(year, month, day, hour);
            Moment    moment_ut = new Moment(ut, h);
            HoraInfo  infoCurr  = new HoraInfo(moment_ut, h.info.lat, h.info.lon, h.info.tz);
            Horoscope hCurr     = new Horoscope(infoCurr, h.options);

            ListViewItem li = null;

            PanchangaLocalMoments local = new PanchangaLocalMoments();

            local.sunrise    = hCurr.sunrise;
            local.sunset     = sunset;
            local.sunrise_ut = ut_sr;
            sweph.swe_revjul(ut, ref year, ref month, ref day, ref hour);
            local.wday = (Basics.Weekday)sweph.swe_day_of_week(ut);



            local.kalas_ut = hCurr.getKalaCuspsUt();
            if (this.opts.CalcSpecialKalas)
            {
                Body.Name bStart = Basics.weekdayRuler(hCurr.wday);
                if (hCurr.options.KalaType == HoroscopeOptions.EHoraType.Lmt)
                {
                    bStart = Basics.weekdayRuler(hCurr.lmt_wday);
                }

                local.rahu_kala_index   = this.rahu_kalas[(int)bStart];
                local.gulika_kala_index = this.gulika_kalas[(int)bStart];
                local.yama_kala_index   = this.yama_kalas[(int)bStart];
            }

            if (opts.CalcLagnaCusps)
            {
                li = new ListViewItem();
                sweph.obtainLock(h);
                BodyPosition     bp_lagna_sr = Basics.CalculateSingleBodyPosition(ut_sr, sweph.BodyNameToSweph(Body.Name.Lagna), Body.Name.Lagna, BodyType.Name.Lagna, h);
                DivisionPosition dp_lagna_sr = bp_lagna_sr.toDivisionPosition(new Division(Basics.DivisionType.Rasi));
                local.lagna_zh = dp_lagna_sr.zodiac_house.value;

                Longitude bp_lagna_base = new Longitude(bp_lagna_sr.longitude.toZodiacHouseBase());
                double    ut_transit    = ut_sr;
                for (int i = 1; i <= 12; i++)
                {
                    Retrogression r = new Retrogression(h, Body.Name.Lagna);
                    ut_transit = r.GetLagnaTransitForward(ut_transit, bp_lagna_base.add(i * 30.0));

                    PanchangaMomentInfo pmi = new PanchangaMomentInfo(
                        ut_transit, (int)bp_lagna_sr.longitude.toZodiacHouse().add(i + 1).value);
                    local.lagnas_ut.Add(pmi);
                }

                sweph.releaseLock(h);
            }

            if (opts.CalcTithiCusps)
            {
                Transit t = new Transit(h);
                sweph.obtainLock(h);
                Tithi tithi_start = t.LongitudeOfTithi(ut_sr).toTithi();
                Tithi tithi_end   = t.LongitudeOfTithi(ut_sr + 1.0).toTithi();

                Tithi tithi_curr = tithi_start.add(1);
                local.tithi_index_start = globals.tithis_ut.Count - 1;
                local.tithi_index_end   = globals.tithis_ut.Count - 1;

                while (tithi_start.value != tithi_end.value &&
                       tithi_curr.value != tithi_end.value)
                {
                    tithi_curr = tithi_curr.add(2);
                    double dLonToFind = ((double)(int)tithi_curr.value - 1) * (360.0 / 30.0);
                    double ut_found   = t.LinearSearchBinary(ut_sr, ut_sr + 1.0, new Longitude(dLonToFind),
                                                             new ReturnLon(t.LongitudeOfTithiDir));

                    globals.tithis_ut.Add(new PanchangaMomentInfo(ut_found, (int)tithi_curr.value));
                    local.tithi_index_end++;
                }
                sweph.releaseLock(h);
            }


            if (opts.CalcKaranaCusps)
            {
                Transit t = new Transit(h);
                sweph.obtainLock(h);
                Karana karana_start = t.LongitudeOfTithi(ut_sr).toKarana();
                Karana karana_end   = t.LongitudeOfTithi(ut_sr + 1.0).toKarana();

                Karana karana_curr = karana_start.add(1);
                local.karana_index_start = globals.karanas_ut.Count - 1;
                local.karana_index_end   = globals.karanas_ut.Count - 1;

                while (karana_start.value != karana_end.value &&
                       karana_curr.value != karana_end.value)
                {
                    karana_curr = karana_curr.add(2);
                    double dLonToFind = ((double)(int)karana_curr.value - 1) * (360.0 / 60.0);
                    double ut_found   = t.LinearSearchBinary(ut_sr, ut_sr + 1.0, new Longitude(dLonToFind),
                                                             new ReturnLon(t.LongitudeOfTithiDir));

                    globals.karanas_ut.Add(new PanchangaMomentInfo(ut_found, (int)karana_curr.value));
                    local.karana_index_end++;
                }
                sweph.releaseLock(h);
            }

            if (opts.CalcSMYogaCusps)
            {
                Transit t = new Transit(h);
                sweph.obtainLock(h);
                SunMoonYoga sm_start = t.LongitudeOfSunMoonYoga(ut_sr).toSunMoonYoga();
                SunMoonYoga sm_end   = t.LongitudeOfSunMoonYoga(ut_sr + 1.0).toSunMoonYoga();

                SunMoonYoga sm_curr = sm_start.add(1);
                local.smyoga_index_start = globals.smyogas_ut.Count - 1;
                local.smyoga_index_end   = globals.smyogas_ut.Count - 1;

                while (sm_start.value != sm_end.value &&
                       sm_curr.value != sm_end.value)
                {
                    sm_curr = sm_curr.add(2);
                    double dLonToFind = ((double)(int)sm_curr.value - 1) * (360.0 / 27);
                    double ut_found   = t.LinearSearchBinary(ut_sr, ut_sr + 1.0, new Longitude(dLonToFind),
                                                             new ReturnLon(t.LongitudeOfSunMoonYogaDir));

                    globals.smyogas_ut.Add(new PanchangaMomentInfo(ut_found, (int)sm_curr.value));
                    local.smyoga_index_end++;
                }

                sweph.releaseLock(h);
            }


            if (opts.CalcNakCusps)
            {
                bool    bDiscard = true;
                Transit t        = new Transit(h, Body.Name.Moon);
                sweph.obtainLock(h);
                Nakshatra nak_start = t.GenericLongitude(ut_sr, ref bDiscard).toNakshatra();
                Nakshatra nak_end   = t.GenericLongitude(ut_sr + 1.0, ref bDiscard).toNakshatra();

                local.nakshatra_index_start = globals.nakshatras_ut.Count - 1;
                local.nakshatra_index_end   = globals.nakshatras_ut.Count - 1;

                Nakshatra nak_curr = nak_start.add(1);

                while (nak_start.value != nak_end.value &&
                       nak_curr.value != nak_end.value)
                {
                    nak_curr = nak_curr.add(2);
                    double dLonToFind = ((double)((int)nak_curr.value - 1)) * (360.0 / 27.0);
                    double ut_found   = t.LinearSearchBinary(ut_sr, ut_sr + 1.0, new Longitude(dLonToFind),
                                                             new ReturnLon(t.GenericLongitude));

                    globals.nakshatras_ut.Add(new PanchangaMomentInfo(ut_found, (int)nak_curr.value));
                    Console.WriteLine("Found nakshatra {0}", nak_curr.value);
                    local.nakshatra_index_end++;
                }
                sweph.releaseLock(h);
            }

            if (opts.CalcHoraCusps)
            {
                local.horas_ut = hCurr.getHoraCuspsUt();
                hCurr.calculateHora(ut_sr + 1.0 / 24.0, ref local.hora_base);
            }

            if (opts.CalcKalaCusps)
            {
                hCurr.calculateKala(ref local.kala_base);
            }


            this.locals.Add(local);
            this.DisplayEntry(local);
        }
Example #25
0
        public Longitude LongitudeOfMoon(double ut)
        {
            BodyPosition bp_moon = Basics.CalculateSingleBodyPosition(ut, sweph.SE_MOON, Body.Name.Moon, BodyType.Name.Graha, this.h);

            return(bp_moon.longitude.add(0));
        }
Example #26
0
 public CustomiseGroupListItem(ChassisPoint cp = ChassisPoint.Undefined, BodyPosition bp = BodyPosition.Undefined)
 {
     ChassisPoint = cp;
     BodyPosition = bp;
 }
Example #27
0
        public double findNextCuspForward(double start_ut, ref bool becomesDirect)
        {
            double       ut_step = 1.0;
            BodyPosition bp      = Basics.CalculateSingleBodyPosition(start_ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h);

            // Body is currently direct
            if (bp.speed_longitude >= 0)
            {
                start_ut = gotoNextRetroSolarCusp(start_ut);
                double lower_ut  = start_ut;
                double higher_ut = start_ut;
                becomesDirect = false;
                while (true)
                {
                    lower_ut  = higher_ut;
                    higher_ut = lower_ut + ut_step;

                    // Find speeds
                    BodyPosition bp_l = Basics.CalculateSingleBodyPosition(lower_ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h);
                    BodyPosition bp_h = Basics.CalculateSingleBodyPosition(higher_ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h);

                    //Console.WriteLine ("DChecking daily {0} UT: {1} {2} Speed {3} {4}", b, lower_ut, higher_ut, bp_l.speed_longitude, bp_h.speed_longitude);
                    // If first one is retro, we're exactly at the cusp
                    // If higher is still direct, contine
                    if (bp_l.speed_longitude > 0 && bp_h.speed_longitude < 0)
                    {
                        break;
                    }
                    if (bp_l.speed_longitude < 0 && bp_h.speed_longitude < 0)
                    {
                        return(findNextCuspForward(lower_ut, ref becomesDirect));
                    }
                }

                // Within one day period
                return(BinaryCuspSearch(lower_ut, higher_ut, true));
            }

            // Body is current retrograde
            else
            {
                double lower_ut  = start_ut;
                double higher_ut = start_ut;
                becomesDirect = true;
                while (true)
                {
                    lower_ut  = higher_ut;
                    higher_ut = lower_ut + ut_step;
                    // Find speeds
                    BodyPosition bp_l = Basics.CalculateSingleBodyPosition(lower_ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h);
                    BodyPosition bp_h = Basics.CalculateSingleBodyPosition(higher_ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h);

                    //Console.WriteLine ("R Checking daily {0} UT: {1} {2} Speed {3} {4}", b, lower_ut, higher_ut, bp_l.speed_longitude, bp_h.speed_longitude);
                    if (bp_l.speed_longitude < 0 && bp_h.speed_longitude >= 0)
                    {
                        break;
                    }
                    if (bp_l.speed_longitude > 0 && bp_h.speed_longitude > 0)
                    {
                        return(findNextCuspForward(lower_ut, ref becomesDirect));
                    }
                }
                // Within one day period
                return(BinaryCuspSearch(lower_ut, higher_ut, false));
            }
        }