public GCEarthData SetEarthData(GCEarthData e) { Longitude = e.longitudeDeg; Latitude = e.latitudeDeg; TimeZone = e.TimeZone; return(e); }
private void CalculateSunRasi(GCLocation loc, GregorianDateTime vcEnd, GregorianDateTime vcAdd, GCConfigRatedEvents rec) { int nData; GregorianDateTime vcNext = new GregorianDateTime(); int ndst; GCEarthData earth = loc.GetEarthData(); vcAdd.SubtractDays(30); while (vcAdd.IsBeforeThis(vcEnd)) { vcNext.Set(GCSankranti.GetNextSankranti(vcAdd, earth, out nData)); if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) { vcNext.InitWeekDay(); vcNext.AddHours(loc.TimeZone.GetBiasMinutesForDay(vcNext) / 60.0); //AddEvent(vcNext, CoreEventType.CCTYPE_SANK, nData, ndst); AddRating(vcNext, rec.rateGrahaRasi[0, nData], rec.rateGrahaRasi[0, Prev(nData, 12)]); } else { break; } vcAdd.Set(vcNext); vcAdd.NextDay(); } }
public double GetPlanetHouse(double longitudeTropical, double julianDate, GCEarthData earth) { double longitudeSidereal = longitudeTropical - GCAyanamsha.GetAyanamsa(julianDate); double firstHouseStart = earth.GetAscendantDegrees(julianDate) - 15.0; return(GCMath.putIn360(longitudeSidereal - firstHouseStart) / 30.0); }
/*************************************/ /* sun functions */ /* */ /* sun longitude */ /* sunrise, sunset time */ /* */ /*************************************/ ////////////////////////////////////////////////////////////////////////// // // VCTIME vct [in] - valid must be each member of this structure // // from vct uses members: year, month, day // double is in range 0.0 - 1.0 private void SunPosition(GregorianDateTime vct, GCEarthData ed, double dayHours) { double DG = GCMath.PI / 180; double RAD = 180 / GCMath.PI; double dLatitude = ed.latitudeDeg; double dLongitude = ed.longitudeDeg; // mean ecliptic longitude of the sun meanLongitudeOfSun = GCSunData.SunGetMeanLong(vct.year, vct.month, vct.day) + (360 / 365.25) * dayHours / 360.0; // ecliptic longitude of perigee double elp = GCSunData.SunGetPerigee(vct.year, vct.month, vct.day); // mean anomaly of the sun double mas = meanLongitudeOfSun - elp; // ecliptic longitude of the sun double els = 0.0; this.longitudeDeg = els = meanLongitudeOfSun + 1.915 * Math.Sin(mas * DG) + 0.02 * Math.Sin(2 * DG * mas); // declination of the sun this.declinationDeg = RAD * Math.Asin(0.39777 * Math.Sin(els * DG)); // right ascension of the sun this.rightAscensionDeg = els - RAD * Math.Atan2(Math.Sin(2 * els * DG), 23.2377 + Math.Cos(2 * DG * els)); // equation of time equationOfTime = this.rightAscensionDeg - meanLongitudeOfSun; }
public override string ToString() { return(string.Format("{0}: {1} {2}: {3} {4}: {5}", GCStrings.getString(10), GCEarthData.GetTextLatitude(latitudeDeg), GCStrings.getString(11), GCEarthData.GetTextLongitude(longitudeDeg), GCStrings.Localized("Timezone"), TTimeZone.GetTimeZoneOffsetText(OffsetUtcHours))); }
public GCEquatorialCoords getTopocentricEquatorial(GCEarthData obs, double jdate) { double u, h, delta_alpha; double rho_sin, rho_cos; const double b_a = 0.99664719; GCEquatorialCoords tec = new GCEquatorialCoords(); double altitude = 0; // geocentric position of observer on the earth surface // 10.1 - 10.3 u = GCMath.arcTanDeg(b_a * b_a * GCMath.tanDeg(obs.latitudeDeg)); rho_sin = b_a * GCMath.sinDeg(u) + altitude / 6378140.0 * GCMath.sinDeg(obs.latitudeDeg); rho_cos = GCMath.cosDeg(u) + altitude / 6378140.0 * GCMath.cosDeg(obs.latitudeDeg); // equatorial horizontal paralax // 39.1 double parallax = GCMath.arcSinDeg(GCMath.sinDeg(8.794 / 3600) / (radius / GCMath.AU)); // geocentric hour angle of the body h = GCEarthData.SiderealTimeGreenwich(jdate) + obs.longitudeDeg - rightAscension; // 39.2 delta_alpha = GCMath.arcTanDeg( (-rho_cos * GCMath.sinDeg(parallax) * GCMath.sinDeg(h)) / (GCMath.cosDeg(this.declination) - rho_cos * GCMath.sinDeg(parallax) * GCMath.cosDeg(h))); tec.rightAscension = rightAscension + delta_alpha; tec.declination = declination + GCMath.arcTanDeg( ((GCMath.sinDeg(declination) - rho_sin * GCMath.sinDeg(parallax)) * GCMath.cosDeg(delta_alpha)) / (GCMath.cosDeg(declination) - rho_cos * GCMath.sinDeg(parallax) * GCMath.cosDeg(h))); return(tec); }
/*********************************************************************/ /* Finds date of Pratipat, Krsna Paksa, Visnu Masa */ /* */ /* EARTHDATA earth - location */ /* int nYear - Gregorian year */ /* */ /*********************************************************************/ public static GregorianDateTime GetFirstDayOfYear(GCEarthData earth, int nYear) { int[] a = { 2, 15, 3, 1, 3, 15, 4, 1, 4, 15 }; GregorianDateTime d = new GregorianDateTime(); GCAstroData day = new GCAstroData(); int gy, j, masa; int step; UInt32 tmp; if (nYear >= 1950 && nYear < 2058) { tmp = gGaurBeg[(nYear - 1950) * 26 + 22]; d.month = (int)(tmp & 0x3e0) >> 5; d.day = (int)(tmp & 0x1f); d.year = nYear; d.NextDay(); a[0] = d.month; a[1] = d.day; } for (int i = 0; i < 10; i += 2) { d.year = nYear; d.month = a[i]; d.day = a[i + 1]; day.DayCalc(d, earth); masa = day.MasaCalc(d, earth); gy = day.GaurabdaYear; if (masa == 11) // visnu masa { do { // shifts date step = day.sunRise.Tithi / 2; step = (step > 0) ? step : 1; for (j = step; j > 0; j--) { d.PreviousDay(); } // try new time day.DayCalc(d, earth); }while (day.sunRise.Tithi < 28); d.NextDay(); d.TimezoneHours = earth.OffsetUtcHours; d.shour = day.sunRise.TotalDays; return(d); } } d.year = -1; d.month = -1; d.day = -1; d.TimezoneHours = earth.OffsetUtcHours; d.shour = day.sunRise.TotalDays; return(d); }
public static int GetNextYogaStart(GCEarthData ed, GregorianDateTime startDate, out GregorianDateTime nextDate) { double phi = 40.0 / 3.0; double l1, l2, longitudeSun; double jday = startDate.GetJulianComplete(); double xj; double longitudeMoon; GregorianDateTime d = new GregorianDateTime(); d.Set(startDate); GregorianDateTime xd = new GregorianDateTime(); double scan_step = 0.5; int prev_tit = 0; int new_tit = -1; double ayanamsha = GCAyanamsha.GetAyanamsa(jday); longitudeMoon = GCCoreAstronomy.GetMoonLongitude(d, ed); longitudeSun = GCCoreAstronomy.GetSunLongitude(d, ed); l1 = GCMath.putIn360(longitudeMoon + longitudeSun - 2 * ayanamsha); prev_tit = Convert.ToInt32(Math.Floor(l1 / phi)); int counter = 0; while (counter < 20) { xj = jday; xd.Set(d); jday += scan_step; d.shour += scan_step; if (d.shour > 1.0) { d.shour -= 1.0; d.NextDay(); } longitudeMoon = GCCoreAstronomy.GetMoonLongitude(d, ed); longitudeSun = GCCoreAstronomy.GetSunLongitude(d, ed); l2 = GCMath.putIn360(longitudeMoon + longitudeSun - 2 * ayanamsha); new_tit = Convert.ToInt32(Math.Floor(l2 / phi)); if (prev_tit != new_tit) { jday = xj; d.Set(xd); scan_step *= 0.5; counter++; continue; } else { l1 = l2; } } nextDate = d; return(new_tit); }
/*********************************************************************/ /* */ /* finds previous time when starts next tithi */ /* */ /* timezone is not changed */ /* */ /* return value: index of tithi 0..29 */ /* or -1 if failed */ /*********************************************************************/ public static int GetPrevTithiStart(GCEarthData ed, GregorianDateTime startDate, out GregorianDateTime nextDate) { double phi = 12.0; double l1, l2, longitudeSun, longitudeMoon; double jday = startDate.GetJulianComplete(); double xj; GregorianDateTime d = new GregorianDateTime(); d.Set(startDate); GregorianDateTime xd = new GregorianDateTime(); double scan_step = 0.5; int prev_tit = 0; int new_tit = -1; longitudeMoon = GCCoreAstronomy.GetMoonLongitude(d, ed); longitudeSun = GCCoreAstronomy.GetSunLongitude(d, ed); l1 = GCMath.putIn360(longitudeMoon - longitudeSun - 180.0); prev_tit = GCMath.IntFloor(l1 / phi); int counter = 0; while (counter < 20) { xj = jday; xd.Set(d); jday -= scan_step; d.shour -= scan_step; if (d.shour < 0.0) { d.shour += 1.0; d.PreviousDay(); } longitudeSun = GCCoreAstronomy.GetSunLongitude(d, ed); longitudeMoon = GCCoreAstronomy.GetMoonLongitude(d, ed); l2 = GCMath.putIn360(longitudeMoon - longitudeSun - 180.0); new_tit = GCMath.IntFloor(l2 / phi); if (prev_tit != new_tit) { jday = xj; d.Set(xd); scan_step *= 0.5; counter++; continue; } else { l1 = l2; } } nextDate = d; // nextDate.shour += startDate.tzone / 24.0; // nextDate.NormalizeValues(); return(new_tit); }
public static int GetGaurabdaYear(GregorianDateTime vc, GCEarthData earth) { GCAstroData day = new GCAstroData(); day.DayCalc(vc, earth); day.MasaCalc(vc, earth); return(day.GaurabdaYear); }
public string GetFullName() { return(string.Format("{0} ({1}, {2}, {3}: {4})" , Title , GCEarthData.GetTextLatitude(Latitude) , GCEarthData.GetTextLongitude(Longitude) , GCStrings.Localized("Timezone") , TimeZoneName)); }
public GCEarthData GetEarthData() { GCEarthData e = new GCEarthData(); e.TimeZone = TimeZone; e.latitudeDeg = Latitude; e.longitudeDeg = Longitude; return(e); }
public static double GetSunLongitude(GregorianDateTime vct, GCEarthData earth) { switch (System) { case AstronomySystem.Meeus: return(GCSunData.GetSunLongitude(vct)); } return(0); }
//=========================================================================== // //=========================================================================== public static void VCTIMEtoVATIME(GregorianDateTime vc, out GaurabdaDate va, GCEarthData earth) { GCAstroData day = new GCAstroData(); day.DayCalc(vc, earth); va = new GaurabdaDate(); va.masa = day.MasaCalc(vc, earth); va.tithi = day.sunRise.Tithi; va.gyear = day.GaurabdaYear; }
public static int GetNextMoonRasi(GCEarthData ed, GregorianDateTime startDate, out GregorianDateTime nextDate) { double phi = 30.0; double l1, l2, longitudeMoon; double jday = startDate.GetJulianComplete(); GregorianDateTime d = new GregorianDateTime(); d.Set(startDate); double ayanamsa = GCAyanamsha.GetAyanamsa(jday); double scan_step = 0.5; int prev_naks = 0; int new_naks = -1; double xj; GregorianDateTime xd = new GregorianDateTime(); longitudeMoon = GCCoreAstronomy.GetMoonLongitude(d, ed); l1 = GCMath.putIn360(longitudeMoon - ayanamsa); prev_naks = GCMath.IntFloor(l1 / phi); int counter = 0; while (counter < 20) { xj = jday; xd.Set(d); jday += scan_step; d.shour += scan_step; if (d.shour > 1.0) { d.shour -= 1.0; d.NextDay(); } longitudeMoon = GCCoreAstronomy.GetMoonLongitude(d, ed); l2 = GCMath.putIn360(longitudeMoon - ayanamsa); new_naks = GCMath.IntFloor(l2 / phi); if (prev_naks != new_naks) { jday = xj; d.Set(xd); scan_step *= 0.5; counter++; continue; } else { l1 = l2; } } nextDate = new GregorianDateTime(); nextDate.Set(d); return(new_naks); }
public static double GetMoonElevation(GCEarthData e, GregorianDateTime vc) { GCMoonData moon = new GCMoonData(); double d = vc.GetJulianComplete(); moon.Calculate(d); moon.CorrectEqatorialWithParallax(d, e.latitudeDeg, e.longitudeDeg, 0); moon.calc_horizontal(d, e.longitudeDeg, e.latitudeDeg); return(moon.elevation); }
public static double SiderealTimeGreenwich(double date) { double jd, t; double delta_phi = 0.0, epsilon = 0.0; jd = date; t = (jd - 2451545.0) / 36525.0; GCEarthData.CalculateNutations(date, out delta_phi, out epsilon); return(GCMath.putIn360(280.46061837 + 360.98564736629 * (jd - 2451545.0) + t * t * (0.000387933 - t / 38710000) + delta_phi * GCMath.cosDeg(epsilon))); }
/// <summary> /// /// </summary> /// <param name="julianDateUTC">Time in UT1 or for general use UTC. This should reflect also hours, minutes and seconds. When finding local sidereal time, /// this argument should contains time that is observed on Greenwich meridian. Use function GetJulianDetailed or GetGreenwichDateTime</param> /// <param name="longitudeDegrees"></param> /// <returns></returns> public static double SiderealTimeLocal(double julianDateUTC, double longitudeDegrees, double timezoneDegrees) { double julianDate2000, julianMillenium; double delta_phi = 0.0, epsilon = 0.0; julianDate2000 = julianDateUTC - 2451545.0; julianMillenium = julianDate2000 / 36525.0; GCEarthData.CalculateNutations(julianDateUTC, out delta_phi, out epsilon); return(GCMath.putIn360(280.46061837 + 360.98564736629 * julianDate2000 + julianMillenium * julianMillenium * (0.000387933 - julianMillenium / 38710000) + delta_phi * GCMath.cosDeg(epsilon) + longitudeDegrees - timezoneDegrees)); }
public static double GetMoonLongitude(GregorianDateTime vct, GCEarthData earth) { switch (System) { case AstronomySystem.Meeus: GCMoonData moon = new GCMoonData(); moon.Calculate(vct.GetJulianComplete()); return(moon.longitude_deg); } return(0); }
public static GCHourTime CalcSunrise(GregorianDateTime vct, GCEarthData earth) { double tempSunrise = 180.0; GCSunData sun = new GCSunData(); for (int i = 0; i < 3; i++) { sun.SunPosition(vct, earth, tempSunrise - 180.0); double x; // definition of event double eventdef = 0.01454; /* switch(ed.obs) * { * case 1: // civil twilight * eventdef = 0.10453; * break; * case 2: // nautical twilight * eventdef = 0.20791; * break; * case 3: // astronomical twilight * eventdef = 0.30902; * break; * default:// center of the sun on the horizont * eventdef = 0.01454; * break; * }*/ eventdef = (eventdef / GCMath.cosDeg(earth.latitudeDeg)) / GCMath.cosDeg(sun.declinationDeg); x = GCMath.tanDeg(earth.latitudeDeg) * GCMath.tanDeg(sun.declinationDeg) + eventdef; if ((x >= -1.0) && (x <= 1.0)) { // time of sunrise tempSunrise = 90.0 - earth.longitudeDeg - GCMath.arcSinDeg(x) + sun.equationOfTime; } else { // initial values for the case // that no rise no set for that day tempSunrise = -360.0; break; } } GCHourTime result = new GCHourTime(); result.longitude = sun.longitudeDeg; result.SetDegTime(tempSunrise + earth.OffsetUtcHours * 15.0); return(result); }
public static XmlDocument GetSankrantiListXml(GCLocation loc, GregorianDateTime vcStart, GregorianDateTime vcEnd) { GregorianDateTime d = new GregorianDateTime(); int zodiac; XmlDocument doc = new XmlDocument(); XmlElement e1 = doc.CreateElement("xml"); doc.AppendChild(e1); XmlElement e2, e3; GCEarthData earth = loc.GetEarthData(); // open file d.Set(vcStart); e2 = doc.CreateElement("request"); e1.AppendChild(e2); e2.SetAttribute("name", "Sankranti"); e2.SetAttribute("version", GCStrings.getString(130)); e2.SetAttribute("longitude", loc.Longitude.ToString()); e2.SetAttribute("latitude", loc.Latitude.ToString()); e2.SetAttribute("timezone", loc.OffsetUtcHours.ToString()); e2.SetAttribute("startdate", vcStart.ToString()); e2.SetAttribute("enddate", vcEnd.ToString()); e2 = doc.CreateElement("result"); e2.SetAttribute("name", "SankrantiList"); e1.AppendChild(e2); while (d.IsBeforeThis(vcEnd)) { d.Set(GCSankranti.GetNextSankranti(d, earth, out zodiac)); d.InitWeekDay(); e3 = doc.CreateElement("sank"); e2.AppendChild(e3); e3.SetAttribute("date", d.ToString()); e3.SetAttribute("dayweekid", d.dayOfWeek.ToString()); e3.SetAttribute("dayweek", GCCalendar.GetWeekdayName(d.dayOfWeek)); e3.SetAttribute("time", d.LongTimeString()); e3.SetAttribute("rasi", zodiac.ToString()); e3.SetAttribute("rasiName", GCRasi.GetName(zodiac)); e3.SetAttribute("rasiNameEn", GCRasi.GetNameEn(zodiac)); d.NextDay(); d.NextDay(); } return(doc); }
//================================================================================== // //================================================================================== public void calc_horizontal(double date, double longitude, double latitude) { double h; h = GCMath.putIn360(GCEarthData.SiderealTimeGreenwich(date) - this.rightAscension + longitude); this.azimuth = GCMath.rad2deg(Math.Atan2(GCMath.sinDeg(h), GCMath.cosDeg(h) * GCMath.sinDeg(latitude) - GCMath.tanDeg(this.declination) * GCMath.cosDeg(latitude))); this.elevation = GCMath.rad2deg(Math.Asin(GCMath.sinDeg(latitude) * GCMath.sinDeg(this.declination) + GCMath.cosDeg(latitude) * GCMath.cosDeg(this.declination) * GCMath.cosDeg(h))); }
/* * * Routines for calculation begining and ending times of given Tithi * * Main function is GetTithiTimes * */ public static double GetTithiTimes(GCEarthData ed, GregorianDateTime vc, out double titBeg, out double titEnd, double sunRise) { GregorianDateTime d1, d2; vc.shour = sunRise; GCTithi.GetPrevTithiStart(ed, vc, out d1); GCTithi.GetNextTithiStart(ed, vc, out d2); titBeg = d1.shour + d1.GetJulian() - vc.GetJulian(); titEnd = d2.shour + d2.GetJulian() - vc.GetJulian(); return(titEnd - titBeg); }
public double elevation, azimuth; // (* h, A *) public void Calculate(double jdate) { GCEclipticalCoords crd = CalculateEcliptical(jdate); GCEquatorialCoords eqc; eqc = GCEarthData.eclipticalToEquatorialCoords(ref crd, jdate); this.radius = crd.distance; this.longitude_deg = crd.longitude; this.latitude_deg = crd.latitude; // equaltorial coordinates this.rightAscension = eqc.rightAscension; this.declination = eqc.declination; }
public static GCHorizontalCoords equatorialToHorizontalCoords(GCEquatorialCoords eqc, GCEarthData obs, double date) { double localHourAngle; GCHorizontalCoords hc; localHourAngle = GCMath.putIn360(GCEarthData.SiderealTimeGreenwich(date) - eqc.rightAscension + obs.longitudeDeg); hc.azimut = GCMath.rad2deg(Math.Atan2(GCMath.sinDeg(localHourAngle), GCMath.cosDeg(localHourAngle) * GCMath.sinDeg(obs.latitudeDeg) - GCMath.tanDeg(eqc.declination) * GCMath.cosDeg(obs.latitudeDeg))); hc.elevation = GCMath.rad2deg(Math.Asin(GCMath.sinDeg(obs.latitudeDeg) * GCMath.sinDeg(eqc.declination) + GCMath.cosDeg(obs.latitudeDeg) * GCMath.cosDeg(eqc.declination) * GCMath.cosDeg(localHourAngle))); return(hc); }
/// <summary> /// /// </summary> /// <param name="julianDateUTC">This contains time UTC, that means time observed on Greenwich meridian. DateTime in other /// timezones should be converted into timezone UTC+0h before using in this method.</param> /// <returns></returns> public double GetAscendantDegrees(double julianDateUTC) { double A = GCEarthData.SiderealTimeLocal(julianDateUTC, longitudeDeg, OffsetUtcHours * 15.0); double E = 23.4392911; double ascendant = GCMath.arcTan2Deg(-GCMath.cosDeg(A), GCMath.sinDeg(A) * GCMath.cosDeg(E) + GCMath.tanDeg(latitudeDeg) * GCMath.sinDeg(E)); if (ascendant < 180) { ascendant += 180; } else { ascendant -= 180; } return(GCMath.putIn360(ascendant - GCAyanamsha.GetAyanamsa(julianDateUTC))); }
/*********************************************************************/ /* */ /* Calculation of tithi, paksa, naksatra, yoga for given */ /* Gregorian date */ /* */ /* */ /*********************************************************************/ public int DayCalc(GregorianDateTime date, GCEarthData earth) { double d; // sun position on sunrise on that day sunRise = GCSunData.CalcSunrise(date, earth); sunSet = GCSunData.CalcSunset(date, earth); // arunodaya is 96 min before sunrise // sunrise_deg is from range 0-360 so 96min=24deg sunArunodaya.TotalDays = sunRise.TotalDays - 96 / 1440.0; sunArunodaya.longitude = sunRise.longitude - (24.0 / 365.25); // noon sunNoon.TotalDays = (sunSet.TotalDays + sunRise.TotalDays) / 2; sunNoon.longitude = (sunRise.longitude + sunSet.longitude) / 2; date.shour = sunRise.TotalDays; // date.shour is [0..1] time of sunrise in local timezone time this.JulianDay = date.GetJulianDetailed(); // moon position at sunrise on that day sunRise.longitudeMoon = GCCoreAstronomy.GetMoonLongitude(date, earth); this.Ayanamsa = GCAyanamsha.GetAyanamsa(this.JulianDay); sunArunodaya.Ayanamsa = this.Ayanamsa; sunRise.Ayanamsa = this.Ayanamsa; sunNoon.Ayanamsa = this.Ayanamsa; sunSet.Ayanamsa = this.Ayanamsa; // masa this.Masa = -1; date.shour = sunSet.TotalDays; sunSet.longitudeMoon = GCCoreAstronomy.GetMoonLongitude(date, earth); date.shour = sunArunodaya.TotalDays; sunArunodaya.longitudeMoon = GCCoreAstronomy.GetMoonLongitude(date, earth); return(1); }
private void CalculatePlanetHouse(int bodyId, GCLocation loc, GregorianDateTime vcEnd, GregorianDateTime vcAdd, GCConfigRatedEvents rec) { int nData; double JD, JDE; GCEarthData earth = loc.GetEarthData(); JD = vcAdd.GetJulian() - 0.5 - loc.OffsetUtcHours / 24.0; JDE = vcEnd.GetJulian() + 0.5 - loc.OffsetUtcHours / 24.0; // initial rasi at the start date 00:00 nData = GCMath.IntFloor(GetPlanetHouse(GCVSOPAstronomy.GetPlanetLongitude(bodyId, JD), JD, earth)); AddRating(JD, loc, rec.rateGrahaHouse[bodyId, nData], rec.rateGrahaHouse[bodyId, Prev(nData, 12)]); while ((JD = FindNextHouseChange(JD, JDE, bodyId, earth, out nData)) < JDE) { AddRating(JD, loc, rec.rateGrahaHouse[bodyId, nData], rec.rateGrahaHouse[bodyId, Prev(nData, 12)]); JD += 1.0 / 24.0; } }
public double FindNextHouseChange(double startJD, double endJD, int bodyId, GCEarthData earth, out int nNextHouse) { double jd = startJD; double A, B, B1; int C, D; double step = 1.0 / 24.0; A = GetPlanetHouse(GCVSOPAstronomy.GetPlanetLongitude(bodyId, jd), jd, earth); jd += step; B1 = A; B = GetPlanetHouse(GCVSOPAstronomy.GetPlanetLongitude(bodyId, jd), jd, earth); C = GCMath.IntFloor(A); D = GCMath.IntFloor(B); while (jd < endJD && Math.Abs(B1 - B) >= 1 / 86400.0) { if (C == D) { // goto next date A = B; C = D; } else if (C < D) { jd = jd - step; step *= (D - A) / (B - A); } else // C > D { jd = jd - step; step *= (A - C) / (A - B); } jd += step; B1 = B; B = GetPlanetHouse(GCVSOPAstronomy.GetPlanetLongitude(bodyId, jd), jd, earth); D = GCMath.IntFloor(B); } nNextHouse = GCMath.IntFloor(GetPlanetHouse(GCVSOPAstronomy.GetPlanetLongitude(bodyId, jd + 0.5 / 24.0), jd + 0.5 / 24.0, earth)); return(jd); }
public bool NextNewFullIsVriddhi(GCEarthData earth) { int i = 0; int nTithi; int nPrevTithi = 100; VAISNAVADAY t = this; for (i = 0; i < 8 && t != null; i++) { nTithi = t.astrodata.sunRise.Tithi; if ((nTithi == nPrevTithi) && GCTithi.TITHI_FULLNEW_MOON(nTithi)) { return(true); } nPrevTithi = nTithi; t = t.Next; } return(false); }