private static void Bhava30DegreeStartingFromHorizon(List <AstroPlanet> pList, double[] cusps, Horoscope horoScope, Mod mod, int j, double bIncrement, AstroBhava bhava) { bhava.BhavaEndDegreesFromHorizon = mod.sub(bIncrement, 30); bhava.BhavaStartDegreesFromHorizon = bIncrement; bhava.BhavaEndDegreesFromMesha = mod.sub(cusps[1], bhava.BhavaEndDegreesFromHorizon);// Rasi start/ end degress were adjusted but I didn't touch this. Rasi ascendent value has to add to the end value bhava.BhavaStartDegreesFromMesha = mod.add(bhava.BhavaEndDegreesFromMesha, 30); bhava.BhavaMidDegreesFromHorizon = mod.add(bhava.BhavaStartDegreesFromHorizon, bhava.BhavaEndDegreesFromHorizon) / 2.0; bhava.LengthDegrees = mod.sub(bhava.BhavaStartDegreesFromHorizon, bhava.BhavaEndDegreesFromHorizon); bhava.BhavaNumber = j + 1; foreach (AstroPlanet planet in pList) { if ((planet.Longitude >= bhava.BhavaEndDegreesFromMesha && planet.Longitude <= bhava.BhavaStartDegreesFromMesha) || ((bhava.BhavaStartDegreesFromMesha < bhava.BhavaEndDegreesFromMesha) && (((planet.Longitude <= bhava.BhavaStartDegreesFromMesha) && (planet.Longitude >= 0)) || ((planet.Longitude >= bhava.BhavaEndDegreesFromMesha) && (planet.Longitude <= 360))))) { planet.Bhava = bhava; planet.AjustedBhavaLongitude = mod.sub(planet.Longitude, bhava.BhavaEndDegreesFromMesha); planet.Bhava = bhava; bhava.Planets.Add(planet); horoScope.BhavaPlanetList.Add(planet); } } horoScope.BhavaHouseList.Add(bhava); }
private static void Bhava15DegreeEitherSideFromLagna(List <AstroPlanet> pList, double[] cusps, Horoscope horoScope, Mod mod, int j, double bIncrement, AstroBhava bhava) { bhava.BhavaEndDegreesFromHorizon = mod.sub(bIncrement, 30); bhava.BhavaStartDegreesFromHorizon = bIncrement; bhava.BhavaEndDegreesFromMesha = mod.sub(cusps[1], bhava.BhavaEndDegreesFromHorizon); bhava.BhavaStartDegreesFromMesha = mod.add(bhava.BhavaEndDegreesFromMesha, 30); bhava.BhavaMidDegreesFromHorizon = mod.add(bhava.BhavaStartDegreesFromHorizon, bhava.BhavaEndDegreesFromHorizon) / 2.0; bhava.LengthDegrees = mod.sub(bhava.BhavaStartDegreesFromHorizon, bhava.BhavaEndDegreesFromHorizon); bhava.BhavaNumber = j + 1; foreach (AstroPlanet planet in pList) { if ((planet.Longitude >= bhava.BhavaEndDegreesFromMesha && planet.Longitude <= bhava.BhavaStartDegreesFromMesha) || ((bhava.BhavaStartDegreesFromMesha < bhava.BhavaEndDegreesFromMesha) && (((planet.Longitude <= bhava.BhavaStartDegreesFromMesha) && (planet.Longitude >= 0)) || ((planet.Longitude >= bhava.BhavaEndDegreesFromMesha) && (planet.Longitude <= 360))))) { planet.Bhava = bhava; planet.AjustedBhavaLongitude = mod.sub(planet.Longitude, bhava.BhavaEndDegreesFromMesha); planet.Bhava = bhava; bhava.Planets.Add(planet); horoScope.BhavaPlanetList.Add(planet); } } horoScope.BhavaHouseList.Add(bhava); }
public Horoscope CalculateHoroscope(List <AstroPlanet> pList) { swissEph.swe_set_ephe_path("C:\\SWEPH\\EPHE"); DateTime dt = new DateTime(Year, Month, Day, Hour, Minute, Second); TimeData tData = new TimeData(AstroPlace.GetUniversalTime(dt, LocationData.Longitude)); tjd_ut = tData.JulianDateTime; double[] cusps = new double[13]; double[] ascmc = new double[10]; // cusps - the end point of a house swissEph.swe_houses_ex(tjd_ut, SwissEph.SEFLG_SIDEREAL, LocationData.Latitude, LocationData.Longitude, 'A', cusps, ascmc); Horoscope horoScope = new Horoscope(); Mod mod = new Mod(360); int lagna = 0; // postion starts from 1 for (int i = 1; i < cusps.Length; i++) { if ((cusps[i] > 0) && (cusps[i] < 30)) { lagna = i; } } if (lagna == 0) { for (int i = 1; i < cusps.Length; i++) { if ((cusps[i] > 0) && (cusps[i] < 35)) { lagna = i; } } } int j = 0; horoScope.RasiHouseList = new List <AstroRasi>(); horoScope.BhavaHouseList = new List <AstroBhava>(); IntCircle intCycle = new IntCircle(12, lagna); double lagnaAscendant = cusps[lagna]; double bIncrement = 30.0; while (j != 12) { // The 14 is used as the adjustment required to // get the right lagna integer from the lagna integer AstroRasi rasi = new AstroRasi((EnumRasi)intCycle.ValueMinusCurrent(14)); rasi.AscendentDegrees = cusps[intCycle.Current]; rasi.AscendentDegreesFromMesha = (intCycle.Current == 1) ? 0.0 : mod.sub(cusps[1], cusps[intCycle.Current]) + cusps[intCycle.Current]; rasi.RasiEndDegreesFromMesha = (intCycle.Current == 1) ? 0.0 : mod.sub(cusps[1], cusps[intCycle.Current]); rasi.RasiEndDegreesFromHorizon = cusps[intCycle.Current]; rasi.RasiStartDegreesFromMesha = (intCycle.Previous == 1) ? 360.0 : mod.sub(cusps[1], cusps[intCycle.Previous]); rasi.RasiStartDegreesFromHorizon = cusps[intCycle.Previous]; rasi.RasiMidDegreesFromMesha = (rasi.RasiStartDegreesFromMesha + rasi.RasiEndDegreesFromMesha) / 2.0; rasi.LengthDegrees = mod.sub(rasi.RasiEndDegreesFromMesha, rasi.RasiStartDegreesFromMesha); rasi.Length = rasi.LengthDegrees; rasi.HouseNumber = j + 1; foreach (AstroPlanet planet in pList) { if (planet.Longitude >= rasi.RasiEndDegreesFromMesha && planet.Longitude <= rasi.RasiStartDegreesFromMesha || ((rasi.RasiStartDegreesFromMesha < rasi.RasiEndDegreesFromMesha) && (((planet.Longitude <= rasi.RasiStartDegreesFromMesha) && (planet.Longitude >= 0)) || ((planet.Longitude >= rasi.RasiEndDegreesFromMesha) && (planet.Longitude <= 360))))) { planet.Rasi = rasi; planet.AjustedLongitude = mod.sub(planet.Longitude, rasi.RasiEndDegreesFromMesha); rasi.Planets.Add(planet); horoScope.RasiPlanetList.Add(planet); } } horoScope.RasiHouseList.Add(rasi); AstroBhava bhava = new AstroBhava(); Bhava30DegreeStartingFromHorizon(pList, cusps, horoScope, mod, j, bIncrement, bhava); if (lagna == intCycle.Current) { horoScope.LagnaRasi = rasi; horoScope.NavamsaRasi = new AstroRasi(AstroBase.GetNawamsaRasi(rasi.AscendentDegreesFromMesha)); } intCycle.GoBackward(); j++; bIncrement = mod.sub(bIncrement, 30.0); if (j == 12) { break; } } return(horoScope); }