public void TestMethod1() { AstroThithi thithi = new AstroThithi(EnumThithi.Amavasya); int j = 1; for (int i = 7; i < 360; i += 12) { EnumThithi th = thithi.ofDeg(2, i); if (i >= 348) { Assert.IsTrue(th == (EnumThithi)16); } else { Assert.IsTrue(th == (EnumThithi)j); } if (i >= 175 && j == 15) { j = 1; } else { j++; } } }
public CalculationBase(AstroPlace locationData, bool IsWithDetails) { NakathEndDateTime = null; ThithiEndDateTime = null; KarnaEndDateTime = null; YogaEndDateTime = null; swissEph.swe_set_topo(locationData.Longitude, locationData.Latitude, 0.0); DateTime dateTime = locationData.BirthDateTime; LocationData = locationData; CurrentDateTime = dateTime; Year = dateTime.Year; Month = dateTime.Month; Day = dateTime.Day; Hour = dateTime.Hour; Minute = dateTime.Minute; Second = dateTime.Second; List <AstroPlanet> pList = (IsWithDetails)? CalculatePlanetPositionWithDetailsOptmized():CalculatePlanetPosition(); Sun = pList.Find(x => x.Current == EnumPlanet.Sun); Moon = pList.Find(x => x.Current == EnumPlanet.Moon); Mars = pList.Find(x => x.Current == EnumPlanet.Mars); Mercury = pList.Find(x => x.Current == EnumPlanet.Mercury); Jupiter = pList.Find(x => x.Current == EnumPlanet.Jupiter); Venus = pList.Find(x => x.Current == EnumPlanet.Venus); Saturn = pList.Find(x => x.Current == EnumPlanet.Saturn); Uranus = pList.Find(x => x.Current == EnumPlanet.Uranus); Neptune = pList.Find(x => x.Current == EnumPlanet.Neptune); Pluto = pList.Find(x => x.Current == EnumPlanet.Pluto); Rahu = pList.Find(x => x.Current == EnumPlanet.Rahu); Kethu = pList.Find(x => x.Current == EnumPlanet.Kethu); Nakath = new AstroNakath(this.Moon.Longitude); Nakath.EndTime = NakathEndDateTime; WeekDay = new AstroWeekDay((EnumWeekDay)((int)dateTime.DayOfWeek + 1)); Thithi = new AstroThithi(new AstroThithi(EnumThithi.Amavasya).ofDeg(this.Sun.Longitude, this.Moon.Longitude)); Thithi.EndTime = ThithiEndDateTime; Yoga = new AstroYoga(new AstroYoga(EnumYoga.Shula).ofDeg(this.Sun.Longitude, this.Moon.Longitude)); Yoga.EndTime = YogaEndDateTime; Karna = new AstroKarna(new AstroKarna(EnumKarana.Balava).ofDeg(this.Sun.Longitude, this.Moon.Longitude)); Karna.EndTime = KarnaEndDateTime; Horoscope = CalculateHoroscope(pList); Horoscope.ExtraDetails = new BirthRasiExtra(Horoscope); Horoscope.ExtraDetails.ThithiNumber = Thithi.Current; Horoscope.ExtraDetails.IsPura = (Thithi.ThithiPaksha == EnumPaksha.Krishna); Horoscope.Nakath = Nakath; Init(); }
private void ThithiEndTime(double[] cusps, AstroPlanet curSun, double orgSunLong, double orgMoonLong, Mod mod360) { double thithiEnd = Math.Truncate(mod360.sub(orgMoonLong, orgSunLong) / AstroConsts.ThithiLength) * AstroConsts.ThithiLength + AstroConsts.ThithiLength; AstroThithi tempThithi = new AstroThithi(new AstroThithi(EnumThithi.Amavasya).ofDeg(curSun.Longitude, cusps[0])); AstroThithi currentThithi = new AstroThithi(new AstroThithi(EnumThithi.Amavasya).ofDeg(orgSunLong, orgMoonLong)); if (currentThithi.Current != tempThithi.Current) { double difSpeed = cusps[3] - curSun.SpeedInLongitude; double thithiTimeDif = ((mod360.sub(cusps[0], curSun.Longitude) - thithiEnd) / ((difSpeed == 0) ? 1 : difSpeed)) * 1440 * -1; if (ThithiEndDateTime == null) { ThithiEndDateTime = TimeData.JulianToDateTime(tjd_ut, LocationData.TimeZone).AddMinutes(thithiTimeDif); } } }