From 51bcc9ff116371f58e22690b64f25682a0340a96 Mon Sep 17 00:00:00 2001 From: Jim Carr Date: Sun, 28 Apr 2024 13:11:36 -0400 Subject: [PATCH 1/4] Remove unnecessary parentheses. --- PALib/PABinary.cs | 10 +- PALib/PAComet.cs | 20 +- PALib/PACoordinates.cs | 82 +++---- PALib/PADateTime.cs | 8 +- PALib/PAEclipses.cs | 14 +- PALib/PAMacros.cs | 510 ++++++++++++++++++++--------------------- PALib/PAMoon.cs | 38 +-- PALib/PAPlanet.cs | 26 +-- PALib/PASun.cs | 26 +-- 9 files changed, 367 insertions(+), 367 deletions(-) diff --git a/PALib/PABinary.cs b/PALib/PABinary.cs index de06e06..0472a28 100644 --- a/PALib/PABinary.cs +++ b/PALib/PABinary.cs @@ -20,20 +20,20 @@ public class PABinary { var binaryInfo = BinaryInfo.GetBinaryInfo(binaryName); - var yYears = (greenwichDateYear + (PAMacros.CivilDateToJulianDate(greenwichDateDay, greenwichDateMonth, greenwichDateYear) - PAMacros.CivilDateToJulianDate(0, 1, greenwichDateYear)) / 365.242191) - binaryInfo.EpochPeri; + var yYears = greenwichDateYear + (PAMacros.CivilDateToJulianDate(greenwichDateDay, greenwichDateMonth, greenwichDateYear) - PAMacros.CivilDateToJulianDate(0, 1, greenwichDateYear)) / 365.242191 - binaryInfo.EpochPeri; var mDeg = 360 * yYears / binaryInfo.Period; var mRad = (mDeg - 360 * (mDeg / 360).Floor()).ToRadians(); var eccentricity = binaryInfo.Ecc; var trueAnomalyRad = PAMacros.TrueAnomaly(mRad, eccentricity); - var rArcsec = (1 - eccentricity * (PAMacros.EccentricAnomaly(mRad, eccentricity)).Cosine()) * binaryInfo.Axis; + var rArcsec = (1 - eccentricity * PAMacros.EccentricAnomaly(mRad, eccentricity).Cosine()) * binaryInfo.Axis; var taPeriRad = trueAnomalyRad + binaryInfo.LongPeri.ToRadians(); - var y = (taPeriRad).Sine() * ((binaryInfo.Incl).ToRadians()).Cosine(); - var x = (taPeriRad).Cosine(); + var y = taPeriRad.Sine() * binaryInfo.Incl.ToRadians().Cosine(); + var x = taPeriRad.Cosine(); var aDeg = PAMacros.Degrees(y.AngleTangent2(x)); var thetaDeg1 = aDeg + binaryInfo.PANode; var thetaDeg2 = thetaDeg1 - 360 * (thetaDeg1 / 360).Floor(); - var rhoArcsec = rArcsec * (taPeriRad).Cosine() / ((thetaDeg2 - binaryInfo.PANode).ToRadians()).Cosine(); + var rhoArcsec = rArcsec * taPeriRad.Cosine() / (thetaDeg2 - binaryInfo.PANode).ToRadians().Cosine(); var positionAngleDeg = Math.Round(thetaDeg2, 1); var separationArcsec = Math.Round(rhoArcsec, 2); diff --git a/PALib/PAComet.cs b/PALib/PAComet.cs index 0401889..2293866 100644 --- a/PALib/PAComet.cs +++ b/PALib/PAComet.cs @@ -21,7 +21,7 @@ public class PAComet /// public (double cometRAHour, double cometRAMin, double cometDecDeg, double cometDecMin, double cometDistEarth) PositionOfEllipticalComet(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear, string cometName) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var greenwichDateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var greenwichDateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); @@ -35,28 +35,28 @@ public class PAComet var eccentricity = cometInfo.ecc_EccentricityOfOrbit; var trueAnomalyDeg = PAMacros.Degrees(PAMacros.TrueAnomaly(mcRad, eccentricity)); var lcDeg = trueAnomalyDeg + cometInfo.peri_LongitudeOfPerihelion; - var rAU = cometInfo.axis_SemiMajorAxisOfOrbit * (1 - eccentricity * eccentricity) / (1 + eccentricity * ((trueAnomalyDeg).ToRadians()).Cosine()); + var rAU = cometInfo.axis_SemiMajorAxisOfOrbit * (1 - eccentricity * eccentricity) / (1 + eccentricity * trueAnomalyDeg.ToRadians().Cosine()); var lcNodeRad = (lcDeg - cometInfo.node_LongitudeOfAscendingNode).ToRadians(); - var psiRad = ((lcNodeRad).Sine() * ((cometInfo.incl_InclinationOfOrbit).ToRadians()).Sine()).ASine(); + var psiRad = (lcNodeRad.Sine() * cometInfo.incl_InclinationOfOrbit.ToRadians().Sine()).ASine(); - var y = (lcNodeRad).Sine() * ((cometInfo.incl_InclinationOfOrbit).ToRadians()).Cosine(); - var x = (lcNodeRad).Cosine(); + var y = lcNodeRad.Sine() * cometInfo.incl_InclinationOfOrbit.ToRadians().Cosine(); + var x = lcNodeRad.Cosine(); var ldDeg = PAMacros.Degrees(y.AngleTangent2(x)) + cometInfo.node_LongitudeOfAscendingNode; - var rdAU = rAU * (psiRad).Cosine(); + var rdAU = rAU * psiRad.Cosine(); var earthLongitudeLeDeg = PAMacros.SunLong(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear) + 180.0; var earthRadiusVectorAU = PAMacros.SunDist(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var leLdRad = (earthLongitudeLeDeg - ldDeg).ToRadians(); - var aRad = (rdAU < earthRadiusVectorAU) ? (rdAU * (leLdRad).Sine()).AngleTangent2(earthRadiusVectorAU - rdAU * (leLdRad).Cosine()) : (earthRadiusVectorAU * (-leLdRad).Sine()).AngleTangent2(rdAU - earthRadiusVectorAU * (leLdRad).Cosine()); + var aRad = (rdAU < earthRadiusVectorAU) ? (rdAU * leLdRad.Sine()).AngleTangent2(earthRadiusVectorAU - rdAU * leLdRad.Cosine()) : (earthRadiusVectorAU * (-leLdRad).Sine()).AngleTangent2(rdAU - earthRadiusVectorAU * leLdRad.Cosine()); var cometLongDeg1 = (rdAU < earthRadiusVectorAU) ? 180.0 + earthLongitudeLeDeg + PAMacros.Degrees(aRad) : PAMacros.Degrees(aRad) + ldDeg; var cometLongDeg = cometLongDeg1 - 360 * (cometLongDeg1 / 360).Floor(); - var cometLatDeg = PAMacros.Degrees((rdAU * (psiRad).Tangent() * ((cometLongDeg1 - ldDeg).ToRadians()).Sine() / (earthRadiusVectorAU * (-leLdRad).Sine())).AngleTangent()); + var cometLatDeg = PAMacros.Degrees((rdAU * psiRad.Tangent() * (cometLongDeg1 - ldDeg).ToRadians().Sine() / (earthRadiusVectorAU * (-leLdRad).Sine())).AngleTangent()); var cometRAHours1 = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(cometLongDeg, 0, 0, cometLatDeg, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear)); var cometDecDeg1 = PAMacros.EcDec(cometLongDeg, 0, 0, cometLatDeg, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear); - var cometDistanceAU = (Math.Pow(earthRadiusVectorAU, 2) + Math.Pow(rAU, 2) - 2.0 * earthRadiusVectorAU * rAU * ((lcDeg - earthLongitudeLeDeg).ToRadians()).Cosine() * (psiRad).Cosine()).SquareRoot(); + var cometDistanceAU = (Math.Pow(earthRadiusVectorAU, 2) + Math.Pow(rAU, 2) - 2.0 * earthRadiusVectorAU * rAU * (lcDeg - earthLongitudeLeDeg).ToRadians().Cosine() * psiRad.Cosine()).SquareRoot(); var cometRAHour = PAMacros.DecimalHoursHour(cometRAHours1 + 0.008333); var cometRAMin = PAMacros.DecimalHoursMinute(cometRAHours1 + 0.008333); @@ -82,7 +82,7 @@ public class PAComet /// public (double cometRAHour, double cometRAMin, double cometRASec, double cometDecDeg, double cometDecMin, double cometDecSec, double cometDistEarth) PositionOfParabolicComet(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear, string cometName) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var greenwichDateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var greenwichDateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); diff --git a/PALib/PACoordinates.cs b/PALib/PACoordinates.cs index 9fe4acc..bfe132a 100644 --- a/PALib/PACoordinates.cs +++ b/PALib/PACoordinates.cs @@ -46,7 +46,7 @@ public double AngleToDecimalDegrees(double degrees, double minutes, double secon /// Tuple (hourAngleHours, hourAngleMinutes, hourAngleSeconds) public (double hourAngleHours, double hourAngleMinutes, double hourAngleSeconds) RightAscensionToHourAngle(double raHours, double raMinutes, double raSeconds, double lctHours, double lctMinutes, double lctSeconds, bool isDaylightSavings, int zoneCorrection, double localDay, int localMonth, int localYear, double geographicalLongitude) { - var daylightSaving = (isDaylightSavings) ? 1 : 0; + var daylightSaving = isDaylightSavings ? 1 : 0; var hourAngle = PAMacros.RightAscensionToHourAngle(raHours, raMinutes, raSeconds, lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear, geographicalLongitude); @@ -63,7 +63,7 @@ public double AngleToDecimalDegrees(double degrees, double minutes, double secon /// Tuple (rightAscensionHours, rightAscensionMinutes, rightAscensionSeconds) public (double raHours, double raMinutes, double raSeconds) HourAngleToRightAscension(double hourAngleHours, double hourAngleMinutes, double hourAngleSeconds, double lctHours, double lctMinutes, double lctSeconds, bool isDaylightSaving, int zoneCorrection, double localDay, int localMonth, int localYear, double geographicalLongitude) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var rightAscension = PAMacros.HourAngleToRightAscension(hourAngleHours, hourAngleMinutes, hourAngleSeconds, lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear, geographicalLongitude); @@ -203,11 +203,11 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth var decDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDegrees, decMinutes, decSeconds); var raRad = raDeg.ToRadians(); var decRad = decDeg.ToRadians(); - var sinB = decRad.Cosine() * (27.4).ToRadians().Cosine() * (raRad - (192.25).ToRadians()).Cosine() + decRad.Sine() * (27.4).ToRadians().Sine(); + var sinB = decRad.Cosine() * 27.4.ToRadians().Cosine() * (raRad - 192.25.ToRadians()).Cosine() + decRad.Sine() * 27.4.ToRadians().Sine(); var bRadians = sinB.ASine(); var bDeg = PAMacros.Degrees(bRadians); - var y = decRad.Sine() - sinB * (27.4).ToRadians().Sine(); - var x = decRad.Cosine() * (raRad - (192.25).ToRadians()).Sine() * (27.4).ToRadians().Cosine(); + var y = decRad.Sine() - sinB * 27.4.ToRadians().Sine(); + var x = decRad.Cosine() * (raRad - 192.25.ToRadians()).Sine() * 27.4.ToRadians().Cosine(); var longDeg1 = PAMacros.Degrees(y.AngleTangent2(x)) + 33; var longDeg2 = longDeg1 - 360 * (longDeg1 / 360).Floor(); @@ -231,11 +231,11 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth var glatDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(galLatDeg, galLatMin, galLatSec); var glongRad = glongDeg.ToRadians(); var glatRad = glatDeg.ToRadians(); - var sinDec = glatRad.Cosine() * (27.4).ToRadians().Cosine() * (glongRad - (33.0).ToRadians()).Sine() + glatRad.Sine() * (27.4).ToRadians().Sine(); + var sinDec = glatRad.Cosine() * 27.4.ToRadians().Cosine() * (glongRad - 33.0.ToRadians()).Sine() + glatRad.Sine() * 27.4.ToRadians().Sine(); var decRadians = sinDec.ASine(); var decDeg = PAMacros.Degrees(decRadians); - var y = glatRad.Cosine() * (glongRad - (33.0).ToRadians()).Cosine(); - var x = glatRad.Sine() * ((27.4).ToRadians()).Cosine() - (glatRad).Cosine() * ((27.4).ToRadians()).Sine() * (glongRad - (33.0).ToRadians()).Sine(); + var y = glatRad.Cosine() * (glongRad - 33.0.ToRadians()).Cosine(); + var x = glatRad.Sine() * 27.4.ToRadians().Cosine() - glatRad.Cosine() * 27.4.ToRadians().Sine() * (glongRad - 33.0.ToRadians()).Sine(); var raDeg1 = PAMacros.Degrees(y.AngleTangent2(x)) + 192.25; var raDeg2 = raDeg1 - 360 * (raDeg1 / 360).Floor(); @@ -294,11 +294,11 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth var geoLatRadians = geogLatDeg.ToRadians(); var cosH = -(verticalDisplRadians.Sine() + geoLatRadians.Sine() * decRad.Sine()) / (geoLatRadians.Cosine() * decRad.Cosine()); var hHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.Degrees(cosH.ACosine())); - var lstRiseHours = (raHours1 - hHours) - 24 * ((raHours1 - hHours) / 24).Floor(); - var lstSetHours = (raHours1 + hHours) - 24 * ((raHours1 + hHours) / 24).Floor(); - var aDeg = PAMacros.Degrees((((decRad).Sine() + (verticalDisplRadians).Sine() * (geoLatRadians).Sine()) / ((verticalDisplRadians).Cosine() * (geoLatRadians).Cosine())).ACosine()); + var lstRiseHours = raHours1 - hHours - 24 * ((raHours1 - hHours) / 24).Floor(); + var lstSetHours = raHours1 + hHours - 24 * ((raHours1 + hHours) / 24).Floor(); + var aDeg = PAMacros.Degrees(((decRad.Sine() + verticalDisplRadians.Sine() * geoLatRadians.Sine()) / (verticalDisplRadians.Cosine() * geoLatRadians.Cosine())).ACosine()); var azRiseDeg = aDeg - 360 * (aDeg / 360).Floor(); - var azSetDeg = (360 - aDeg) - 360 * ((360 - aDeg) / 360).Floor(); + var azSetDeg = 360 - aDeg - 360 * ((360 - aDeg) / 360).Floor(); var utRiseHours1 = PAMacros.GreenwichSiderealTimeToUniversalTime(PAMacros.LocalSiderealTimeToGreenwichSiderealTime(lstRiseHours, 0, 0, geogLongDeg), 0, 0, gwDateDay, gwDateMonth, gwDateYear); var utSetHours1 = PAMacros.GreenwichSiderealTimeToUniversalTime(PAMacros.LocalSiderealTimeToGreenwichSiderealTime(lstSetHours, 0, 0, geogLongDeg), 0, 0, gwDateDay, gwDateMonth, gwDateYear); var utRiseAdjustedHours = utRiseHours1 + 0.008333; @@ -326,15 +326,15 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// Tuple (correctedRAHour, correctedRAMinutes, correctedRASeconds, correctedDecDeg, correctedDecMinutes, correctedDecSeconds) public (double correctedRAHour, double correctedRAMinutes, double correctedRASeconds, double correctedDecDeg, double correctedDecMinutes, double correctedDecSeconds) CorrectForPrecession(double raHour, double raMinutes, double raSeconds, double decDeg, double decMinutes, double decSeconds, double epoch1Day, int epoch1Month, int epoch1Year, double epoch2Day, int epoch2Month, int epoch2Year) { - var ra1Rad = (PAMacros.DegreeHoursToDecimalDegrees(PAMacros.HMStoDH(raHour, raMinutes, raSeconds))).ToRadians(); - var dec1Rad = (PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDeg, decMinutes, decSeconds)).ToRadians(); + var ra1Rad = PAMacros.DegreeHoursToDecimalDegrees(PAMacros.HMStoDH(raHour, raMinutes, raSeconds)).ToRadians(); + var dec1Rad = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDeg, decMinutes, decSeconds).ToRadians(); var tCenturies = (PAMacros.CivilDateToJulianDate(epoch1Day, epoch1Month, epoch1Year) - 2415020) / 36525; var mSec = 3.07234 + (0.00186 * tCenturies); var nArcsec = 20.0468 - (0.0085 * tCenturies); var nYears = (PAMacros.CivilDateToJulianDate(epoch2Day, epoch2Month, epoch2Year) - PAMacros.CivilDateToJulianDate(epoch1Day, epoch1Month, epoch1Year)) / 365.25; - var s1Hours = ((mSec + (nArcsec * (ra1Rad).Sine() * (dec1Rad).Tangent() / 15)) * nYears) / 3600; + var s1Hours = (mSec + (nArcsec * ra1Rad.Sine() * dec1Rad.Tangent() / 15)) * nYears / 3600; var ra2Hours = PAMacros.HMStoDH(raHour, raMinutes, raSeconds) + s1Hours; - var s2Deg = (nArcsec * (ra1Rad).Cosine() * nYears) / 3600; + var s2Deg = nArcsec * ra1Rad.Cosine() * nYears / 3600; var dec2Deg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDeg, decMinutes, decSeconds) + s2Deg; var correctedRAHour = PAMacros.DecimalHoursHour(ra2Hours); @@ -362,7 +362,7 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth var lRad = lDeg2.ToRadians(); var bDeg = 5.372617 * tCenturies; var nDeg1 = 259.1833 - 360 * (bDeg - bDeg.Floor()); - var nDeg2 = nDeg1 - 360 * ((nDeg1 / 360).Floor()); + var nDeg2 = nDeg1 - 360 * (nDeg1 / 360).Floor(); var nRad = nDeg2.ToRadians(); var nutInLongArcsec = -17.2 * nRad.Sine() - 1.3 * (2 * lRad).Sine(); var nutInOblArcsec = 9.2 * nRad.Cosine() + 0.5 * (2 * lRad).Cosine(); @@ -385,8 +385,8 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth var trueLongDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(trueEclLongDeg, trueEclLongMin, trueEclLongSec); var trueLatDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(trueEclLatDeg, trueEclLatMin, trueEclLatSec); var sunTrueLongDeg = PAMacros.SunLong(utHour, utMinutes, utSeconds, 0, 0, gwDay, gwMonth, gwYear); - var dlongArcsec = -20.5 * ((sunTrueLongDeg - trueLongDeg).ToRadians()).Cosine() / ((trueLatDeg).ToRadians()).Cosine(); - var dlatArcsec = -20.5 * ((sunTrueLongDeg - trueLongDeg).ToRadians()).Sine() * ((trueLatDeg).ToRadians()).Sine(); + var dlongArcsec = -20.5 * (sunTrueLongDeg - trueLongDeg).ToRadians().Cosine() / trueLatDeg.ToRadians().Cosine(); + var dlatArcsec = -20.5 * (sunTrueLongDeg - trueLongDeg).ToRadians().Sine() * trueLatDeg.ToRadians().Sine(); var apparentLongDeg = trueLongDeg + (dlongArcsec / 3600); var apparentLatDeg = trueLatDeg + (dlatArcsec / 3600); @@ -467,21 +467,21 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth var tCenturies = (julianDateDays - 2415020) / 36525; var longAscNodeDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(74, 22, 0) + (84 * tCenturies / 60); var sunLongDeg = PAMacros.SunLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); - var y = ((longAscNodeDeg - sunLongDeg).ToRadians()).Sine() * ((PAMacros.DegreesMinutesSecondsToDecimalDegrees(7, 15, 0)).ToRadians()).Cosine(); - var x = -((longAscNodeDeg - sunLongDeg).ToRadians()).Cosine(); + var y = (longAscNodeDeg - sunLongDeg).ToRadians().Sine() * PAMacros.DegreesMinutesSecondsToDecimalDegrees(7, 15, 0).ToRadians().Cosine(); + var x = -(longAscNodeDeg - sunLongDeg).ToRadians().Cosine(); var aDeg = PAMacros.Degrees(y.AngleTangent2(x)); var mDeg1 = 360 - (360 * (julianDateDays - 2398220) / 25.38); var mDeg2 = mDeg1 - 360 * (mDeg1 / 360).Floor(); var l0Deg1 = mDeg2 + aDeg; - var b0Rad = (((sunLongDeg - longAscNodeDeg).ToRadians()).Sine() * ((PAMacros.DegreesMinutesSecondsToDecimalDegrees(7, 15, 0)).ToRadians()).Sine()).ASine(); - var theta1Rad = (-((sunLongDeg).ToRadians()).Cosine() * ((PAMacros.Obliq(gwdateDay, gwdateMonth, gwdateYear)).ToRadians()).Tangent()).AngleTangent(); - var theta2Rad = (-((longAscNodeDeg - sunLongDeg).ToRadians()).Cosine() * ((PAMacros.DegreesMinutesSecondsToDecimalDegrees(7, 15, 0)).ToRadians()).Tangent()).AngleTangent(); + var b0Rad = ((sunLongDeg - longAscNodeDeg).ToRadians().Sine() * PAMacros.DegreesMinutesSecondsToDecimalDegrees(7, 15, 0).ToRadians().Sine()).ASine(); + var theta1Rad = (-sunLongDeg.ToRadians().Cosine() * PAMacros.Obliq(gwdateDay, gwdateMonth, gwdateYear).ToRadians().Tangent()).AngleTangent(); + var theta2Rad = (-(longAscNodeDeg - sunLongDeg).ToRadians().Cosine() * PAMacros.DegreesMinutesSecondsToDecimalDegrees(7, 15, 0).ToRadians().Tangent()).AngleTangent(); var pDeg = PAMacros.Degrees(theta1Rad + theta2Rad); var rho1Deg = helioDisplacementArcmin / 60; - var rhoRad = (2 * rho1Deg / PAMacros.SunDia(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear)).ASine() - (rho1Deg).ToRadians(); - var bRad = ((b0Rad).Sine() * (rhoRad).Cosine() + (b0Rad).Cosine() * (rhoRad).Sine() * ((pDeg - helioPositionAngleDeg).ToRadians()).Cosine()).ASine(); + var rhoRad = (2 * rho1Deg / PAMacros.SunDia(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear)).ASine() - rho1Deg.ToRadians(); + var bRad = (b0Rad.Sine() * rhoRad.Cosine() + b0Rad.Cosine() * rhoRad.Sine() * (pDeg - helioPositionAngleDeg).ToRadians().Cosine()).ASine(); var bDeg = PAMacros.Degrees(bRad); - var lDeg1 = PAMacros.Degrees(((rhoRad).Sine() * ((pDeg - helioPositionAngleDeg).ToRadians()).Sine() / (bRad).Cosine()).ASine()) + l0Deg1; + var lDeg1 = PAMacros.Degrees((rhoRad.Sine() * (pDeg - helioPositionAngleDeg).ToRadians().Sine() / bRad.Cosine()).ASine()) + l0Deg1; var lDeg2 = lDeg1 - 360 * (lDeg1 / 360).Floor(); var helioLongDeg = Math.Round(lDeg2, 2); @@ -515,19 +515,19 @@ public int CarringtonRotationNumber(double gwdateDay, int gwdateMonth, int gwdat var f1 = 93.27191 + 483202.0175 * tCenturies; var f2 = f1 - 360 * (f1 / 360).Floor(); var geocentricMoonLongDeg = PAMacros.MoonLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); - var geocentricMoonLatRad = (PAMacros.MoonLat(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear)).ToRadians(); - var inclinationRad = (PAMacros.DegreesMinutesSecondsToDecimalDegrees(1, 32, 32.7)).ToRadians(); + var geocentricMoonLatRad = PAMacros.MoonLat(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear).ToRadians(); + var inclinationRad = PAMacros.DegreesMinutesSecondsToDecimalDegrees(1, 32, 32.7).ToRadians(); var nodeLongRad = (longAscNodeDeg - geocentricMoonLongDeg).ToRadians(); - var sinBe = -(inclinationRad).Cosine() * (geocentricMoonLatRad).Sine() + (inclinationRad).Sine() * (geocentricMoonLatRad).Cosine() * (nodeLongRad).Sine(); - var subEarthLatDeg = PAMacros.Degrees((sinBe).ASine()); - var aRad = (-(geocentricMoonLatRad).Sine() * (inclinationRad).Sine() - (geocentricMoonLatRad).Cosine() * (inclinationRad).Cosine() * (nodeLongRad).Sine()).AngleTangent2((geocentricMoonLatRad).Cosine() * (nodeLongRad).Cosine()); + var sinBe = -inclinationRad.Cosine() * geocentricMoonLatRad.Sine() + inclinationRad.Sine() * geocentricMoonLatRad.Cosine() * nodeLongRad.Sine(); + var subEarthLatDeg = PAMacros.Degrees(sinBe.ASine()); + var aRad = (-geocentricMoonLatRad.Sine() * inclinationRad.Sine() - geocentricMoonLatRad.Cosine() * inclinationRad.Cosine() * nodeLongRad.Sine()).AngleTangent2(geocentricMoonLatRad.Cosine() * nodeLongRad.Cosine()); var aDeg = PAMacros.Degrees(aRad); var subEarthLongDeg1 = aDeg - f2; var subEarthLongDeg2 = subEarthLongDeg1 - 360 * (subEarthLongDeg1 / 360).Floor(); var subEarthLongDeg3 = (subEarthLongDeg2 > 180) ? subEarthLongDeg2 - 360 : subEarthLongDeg2; - var c1Rad = ((nodeLongRad).Cosine() * (inclinationRad).Sine() / ((geocentricMoonLatRad).Cosine() * (inclinationRad).Cosine() + (geocentricMoonLatRad).Sine() * (inclinationRad).Sine() * (nodeLongRad).Sine())).AngleTangent(); - var obliquityRad = (PAMacros.Obliq(gwdateDay, gwdateMonth, gwdateYear)).ToRadians(); - var c2Rad = ((obliquityRad).Sine() * ((geocentricMoonLongDeg).ToRadians()).Cosine() / ((obliquityRad).Sine() * (geocentricMoonLatRad).Sine() * ((geocentricMoonLongDeg).ToRadians()).Sine() - (obliquityRad).Cosine() * (geocentricMoonLatRad).Cosine())).AngleTangent(); + var c1Rad = (nodeLongRad.Cosine() * inclinationRad.Sine() / (geocentricMoonLatRad.Cosine() * inclinationRad.Cosine() + geocentricMoonLatRad.Sine() * inclinationRad.Sine() * nodeLongRad.Sine())).AngleTangent(); + var obliquityRad = PAMacros.Obliq(gwdateDay, gwdateMonth, gwdateYear).ToRadians(); + var c2Rad = (obliquityRad.Sine() * geocentricMoonLongDeg.ToRadians().Cosine() / (obliquityRad.Sine() * geocentricMoonLatRad.Sine() * geocentricMoonLongDeg.ToRadians().Sine() - obliquityRad.Cosine() * geocentricMoonLatRad.Cosine())).AngleTangent(); var cDeg = PAMacros.Degrees(c1Rad + c2Rad); var subEarthLongitude = Math.Round(subEarthLongDeg3, 2); @@ -551,15 +551,15 @@ public int CarringtonRotationNumber(double gwdateDay, int gwdateMonth, int gwdat var sunGeocentricLongDeg = PAMacros.SunLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); var moonEquHorParallaxArcMin = PAMacros.MoonHP(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear) * 60; var sunEarthDistAU = PAMacros.SunDist(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); - var geocentricMoonLatRad = (PAMacros.MoonLat(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear)).ToRadians(); + var geocentricMoonLatRad = PAMacros.MoonLat(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear).ToRadians(); var geocentricMoonLongDeg = PAMacros.MoonLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); - var adjustedMoonLongDeg = sunGeocentricLongDeg + 180 + (26.4 * (geocentricMoonLatRad).Cosine() * ((sunGeocentricLongDeg - geocentricMoonLongDeg).ToRadians()).Sine() / (moonEquHorParallaxArcMin * sunEarthDistAU)); + var adjustedMoonLongDeg = sunGeocentricLongDeg + 180 + (26.4 * geocentricMoonLatRad.Cosine() * (sunGeocentricLongDeg - geocentricMoonLongDeg).ToRadians().Sine() / (moonEquHorParallaxArcMin * sunEarthDistAU)); var adjustedMoonLatRad = 0.14666 * geocentricMoonLatRad / (moonEquHorParallaxArcMin * sunEarthDistAU); - var inclinationRad = (PAMacros.DegreesMinutesSecondsToDecimalDegrees(1, 32, 32.7)).ToRadians(); + var inclinationRad = PAMacros.DegreesMinutesSecondsToDecimalDegrees(1, 32, 32.7).ToRadians(); var nodeLongRad = (longAscNodeDeg - adjustedMoonLongDeg).ToRadians(); - var sinBs = -(inclinationRad).Cosine() * (adjustedMoonLatRad).Sine() + (inclinationRad).Sine() * (adjustedMoonLatRad).Cosine() * (nodeLongRad).Sine(); - var subSolarLatDeg = PAMacros.Degrees((sinBs).ASine()); - var aRad = (-(adjustedMoonLatRad).Sine() * (inclinationRad).Sine() - (adjustedMoonLatRad).Cosine() * (inclinationRad).Cosine() * (nodeLongRad).Sine()).AngleTangent2((adjustedMoonLatRad).Cosine() * (nodeLongRad).Cosine()); + var sinBs = -inclinationRad.Cosine() * adjustedMoonLatRad.Sine() + inclinationRad.Sine() * adjustedMoonLatRad.Cosine() * nodeLongRad.Sine(); + var subSolarLatDeg = PAMacros.Degrees(sinBs.ASine()); + var aRad = (-adjustedMoonLatRad.Sine() * inclinationRad.Sine() - adjustedMoonLatRad.Cosine() * inclinationRad.Cosine() * nodeLongRad.Sine()).AngleTangent2(adjustedMoonLatRad.Cosine() * nodeLongRad.Cosine()); var aDeg = PAMacros.Degrees(aRad); var subSolarLongDeg1 = aDeg - f2; var subSolarLongDeg2 = subSolarLongDeg1 - 360 * (subSolarLongDeg1 / 360).Floor(); diff --git a/PALib/PADateTime.cs b/PALib/PADateTime.cs index e1678d1..6405111 100644 --- a/PALib/PADateTime.cs +++ b/PALib/PADateTime.cs @@ -45,13 +45,13 @@ public int CivilDateToDayNumber(int month, int day, int year) if (month <= 2) { month = month - 1; - month = (year.IsLeapYear()) ? month * 62 : month * 63; + month = year.IsLeapYear() ? month * 62 : month * 63; month = (int)((double)month / 2).Floor(); } else { month = (int)(((double)month + 1) * 30.6).Floor(); - month = (year.IsLeapYear()) ? month - 62 : month - 63; + month = year.IsLeapYear() ? month - 62 : month - 63; } return month + day; @@ -86,7 +86,7 @@ public double CivilTimeToDecimalHours(double hours, double minutes, double secon { var lct = CivilTimeToDecimalHours(lctHours, lctMinutes, lctSeconds); - var daylightSavingsOffset = (isDaylightSavings) ? 1 : 0; + var daylightSavingsOffset = isDaylightSavings ? 1 : 0; var utInterim = lct - daylightSavingsOffset - zoneCorrection; var gdayInterim = localDay + (utInterim / 24); @@ -115,7 +115,7 @@ public double CivilTimeToDecimalHours(double hours, double minutes, double secon /// Tuple (int lctHours, int lctMinutes, int lctSeconds, int localDay, int localMonth, int localYear) public (int lctHours, int lctMinutes, int lctSeconds, int localDay, int localMonth, int localYear) UniversalTimeToLocalCivilTime(double utHours, double utMinutes, double utSeconds, bool isDaylightSavings, int zoneCorrection, int gwDay, int gwMonth, int gwYear) { - var dstValue = (isDaylightSavings) ? 1 : 0; + var dstValue = isDaylightSavings ? 1 : 0; var ut = PAMacros.HMStoDH(utHours, utMinutes, utSeconds); var zoneTime = ut + zoneCorrection; var localTime = zoneTime + dstValue; diff --git a/PALib/PAEclipses.cs b/PALib/PAEclipses.cs index cd34205..9ef4094 100644 --- a/PALib/PAEclipses.cs +++ b/PALib/PAEclipses.cs @@ -19,12 +19,12 @@ public class PAEclipses /// public (string status, double eventDateDay, int eventDateMonth, int eventDateYear) LunarEclipseOccurrence(double localDateDay, int localDateMonth, int localDateYear, bool isDaylightSaving, int zoneCorrectionHours) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var julianDateOfFullMoon = PAMacros.FullMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var gDateOfFullMoonDay = PAMacros.JulianDateDay(julianDateOfFullMoon); - var integerDay = (gDateOfFullMoonDay).Floor(); + var integerDay = gDateOfFullMoonDay.Floor(); var gDateOfFullMoonMonth = PAMacros.JulianDateMonth(julianDateOfFullMoon); var gDateOfFullMoonYear = PAMacros.JulianDateYear(julianDateOfFullMoon); var utOfFullMoonHours = gDateOfFullMoonDay - integerDay; @@ -68,7 +68,7 @@ public class PAEclipses /// public (double lunarEclipseCertainDateDay, double lunarEclipseCertainDateMonth, double lunarEclipseCertainDateYear, double utStartPenPhaseHour, double utStartPenPhaseMinutes, double utStartUmbralPhaseHour, double utStartUmbralPhaseMinutes, double utStartTotalPhaseHour, double utStartTotalPhaseMinutes, double utMidEclipseHour, double utMidEclipseMinutes, double utEndTotalPhaseHour, double utEndTotalPhaseMinutes, double utEndUmbralPhaseHour, double utEndUmbralPhaseMinutes, double utEndPenPhaseHour, double utEndPenPhaseMinutes, double eclipseMagnitude) LunarEclipseCircumstances(double localDateDay, int localDateMonth, int localDateYear, bool isDaylightSaving, int zoneCorrectionHours) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var julianDateOfFullMoon = PAMacros.FullMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var gDateOfFullMoonDay = PAMacros.JulianDateDay(julianDateOfFullMoon); @@ -132,11 +132,11 @@ public class PAEclipses /// public (string status, double eventDateDay, int eventDateMonth, int eventDateYear) SolarEclipseOccurrence(double localDateDay, int localDateMonth, int localDateYear, bool isDaylightSaving, int zoneCorrectionHours) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var julianDateOfNewMoon = PAMacros.NewMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var gDateOfNewMoonDay = PAMacros.JulianDateDay(julianDateOfNewMoon); - var integerDay = (gDateOfNewMoonDay).Floor(); + var integerDay = gDateOfNewMoonDay.Floor(); var gDateOfNewMoonMonth = PAMacros.JulianDateMonth(julianDateOfNewMoon); var gDateOfNewMoonYear = PAMacros.JulianDateYear(julianDateOfNewMoon); var utOfNewMoonHours = gDateOfNewMoonDay - integerDay; @@ -172,11 +172,11 @@ public class PAEclipses /// public (double solarEclipseCertainDateDay, int solarEclipseCertainDateMonth, int solarEclipseCertainDateYear, double utFirstContactHour, double utFirstContactMinutes, double utMidEclipseHour, double utMidEclipseMinutes, double utLastContactHour, double utLastContactMinutes, double eclipseMagnitude) SolarEclipseCircumstances(double localDateDay, int localDateMonth, int localDateYear, bool isDaylightSaving, int zoneCorrectionHours, double geogLongitudeDeg, double geogLatitudeDeg) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var julianDateOfNewMoon = PAMacros.NewMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var gDateOfNewMoonDay = PAMacros.JulianDateDay(julianDateOfNewMoon); - var integerDay = (gDateOfNewMoonDay).Floor(); + var integerDay = gDateOfNewMoonDay.Floor(); var gDateOfNewMoonMonth = PAMacros.JulianDateMonth(julianDateOfNewMoon); var gDateOfNewMoonYear = PAMacros.JulianDateYear(julianDateOfNewMoon); var utOfNewMoonHours = gDateOfNewMoonDay - integerDay; diff --git a/PALib/PAMacros.cs b/PALib/PAMacros.cs index 094635a..240c105 100644 --- a/PALib/PAMacros.cs +++ b/PALib/PAMacros.cs @@ -43,7 +43,7 @@ public static int DecimalHoursHour(double decimalHours) var c = Math.Round(b - 60 * (b / 60).Floor(), 2); var e = (c == 60) ? b + 60 : b; - return (decimalHours < 0) ? (int)-((e / 3600).Floor()) : (int)(e / 3600).Floor(); + return (decimalHours < 0) ? (int)-(e / 3600).Floor() : (int)(e / 3600).Floor(); } /// @@ -119,7 +119,7 @@ public static double CivilDateToJulianDate(double day, double month, double year } } - var c = (y < 0) ? (((365.25 * y) - 0.75)).Floor() : (365.25 * y).Floor(); + var c = (y < 0) ? ((365.25 * y) - 0.75).Floor() : (365.25 * y).Floor(); var d = (30.6001 * (m + 1.0)).Floor(); return b + c + d + fDay + 1720994.5; @@ -478,7 +478,7 @@ public static double DecimalDegreesDegrees(double decimalDegrees) var c = Math.Round(b - 60 * (b / 60).Floor(), 2); var e = (c == 60) ? 60 : b; - return (decimalDegrees < 0) ? -((e / 3600).Floor()) : (e / 3600).Floor(); + return (decimalDegrees < 0) ? -(e / 3600).Floor() : (e / 3600).Floor(); } /// @@ -636,9 +636,9 @@ public static double NutatLong(double gd, int gm, int gy) var n2 = 2.0 * n1; var dp = (-17.2327 - 0.01737 * t) * n1.Sine(); - dp = dp + (-1.2729 - 0.00013 * t) * (l2).Sine() + 0.2088 * (n2).Sine(); - dp = dp - 0.2037 * (d2).Sine() + (0.1261 - 0.00031 * t) * (m1).Sine(); - dp = dp + 0.0675 * (m2).Sine() - (0.0497 - 0.00012 * t) * (l2 + m1).Sine(); + dp = dp + (-1.2729 - 0.00013 * t) * l2.Sine() + 0.2088 * n2.Sine(); + dp = dp - 0.2037 * d2.Sine() + (0.1261 - 0.00031 * t) * m1.Sine(); + dp = dp + 0.0675 * m2.Sine() - (0.0497 - 0.00012 * t) * (l2 + m1).Sine(); dp = dp - 0.0342 * (d2 - n1).Sine() - 0.0261 * (d2 + m2).Sine(); dp = dp + 0.0214 * (l2 - m1).Sine() - 0.0149 * (l2 - d2 + m2).Sine(); dp = dp + 0.0124 * (l2 - n1).Sine() + 0.0114 * (d2 - m2).Sine(); @@ -827,12 +827,12 @@ public static double TrueAnomaly(double am, double ec) while (1 == 1) { - var d = ae - (ec * (ae).Sine()) - m; + var d = ae - (ec * ae.Sine()) - m; if (Math.Abs(d) < 0.000001) { break; } - d = d / (1.0 - (ec * (ae).Cosine())); + d = d / (1.0 - (ec * ae.Cosine())); ae = ae - d; } var a = ((1 + ec) / (1 - ec)).SquareRoot() * (ae / 2).Tangent(); @@ -855,7 +855,7 @@ public static double EccentricAnomaly(double am, double ec) while (1 == 1) { - var d = ae - (ec * (ae).Sine()) - m; + var d = ae - (ec * ae.Sine()) - m; if (Math.Abs(d) < 0.000001) { @@ -935,7 +935,7 @@ public static double RefractL3035(double pr, double tr, double y, double d) return (-(a / b) * d).ToRadians(); } - return -d * 0.00007888888 * pr / ((273.0 + tr) * (y).Tangent()); + return -d * 0.00007888888 * pr / ((273.0 + tr) * y.Tangent()); } /// @@ -962,12 +962,12 @@ public static double ParallaxHA(double hh, double hm, double hs, double dd, doub var rp = 1.0 / hp.ToRadians().Sine(); - var x = (DegreeHoursToDecimalDegrees(HMStoDH(hh, hm, hs))).ToRadians(); + var x = DegreeHoursToDecimalDegrees(HMStoDH(hh, hm, hs)).ToRadians(); var x1 = x; - var y = (DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds)).ToRadians(); + var y = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); var y1 = y; - var d = (sw.Equals(PACoordinateType.True)) ? 1.0 : -1.0; + var d = sw.Equals(PACoordinateType.True) ? 1.0 : -1.0; if (d == 1) { @@ -1014,7 +1014,7 @@ public static (double p, double q) ParallaxHAL2870(double x, double y, double rc var sy = y.Sine(); var cy = y.Cosine(); - var aa = (rc * x.Sine()) / ((rp * cy) - (rc * cx)); + var aa = rc * x.Sine() / ((rp * cy) - (rc * cx)); var dx = aa.AngleTangent(); var p = x + dx; @@ -1055,13 +1055,13 @@ public static double ParallaxDec(double hh, double hm, double hs, double dd, dou var rp = 1.0 / hp.ToRadians().Sine(); - var x = (DegreeHoursToDecimalDegrees(HMStoDH(hh, hm, hs))).ToRadians(); + var x = DegreeHoursToDecimalDegrees(HMStoDH(hh, hm, hs)).ToRadians(); var x1 = x; - var y = (DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds)).ToRadians(); + var y = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); var y1 = y; - var d = (sw.Equals(PACoordinateType.True)) ? 1.0 : -1.0; + var d = sw.Equals(PACoordinateType.True) ? 1.0 : -1.0; if (d == 1) { @@ -1107,7 +1107,7 @@ public static (double p, double q) ParallaxDecL2870(double x, double y, double r var sy = y.Sine(); var cy = y.Cosine(); - var aa = (rc * x.Sine()) / ((rp * cy) - (rc * cx)); + var aa = rc * x.Sine() / ((rp * cy) - (rc * cx)); var dx = aa.AngleTangent(); var p = x + dx; var cp = p.Cosine(); @@ -1175,7 +1175,7 @@ public static double SunDist(double lch, double lcm, double lcs, int ds, int zc, b = 360 * (a - a.Floor()); var h1 = (353.4 + b).ToRadians(); - var d3 = (0.00000543 * a1.Sine() + 0.00001575 * b1.Sine()) + (0.00001627 * c1.Sine() + 0.00003076 * d1.Cosine()) + (0.00000927 * h1.Sine()); + var d3 = 0.00000543 * a1.Sine() + 0.00001575 * b1.Sine() + (0.00001627 * c1.Sine() + 0.00003076 * d1.Cosine()) + (0.00000927 * h1.Sine()); return 1.0000002 * (1 - ec * ae.Cosine()) + d3; } @@ -1208,12 +1208,12 @@ public static double MoonLong(double lh, double lm, double ls, int ds, int zc, d m4 = q / m4; m5 = q / m5; m6 = q / m6; - m1 = 360 * (m1 - (m1).Floor()); - m2 = 360 * (m2 - (m2).Floor()); - m3 = 360 * (m3 - (m3).Floor()); - m4 = 360 * (m4 - (m4).Floor()); - m5 = 360 * (m5 - (m5).Floor()); - m6 = 360 * (m6 - (m6).Floor()); + m1 = 360 * (m1 - m1.Floor()); + m2 = 360 * (m2 - m2.Floor()); + m3 = 360 * (m3 - m3.Floor()); + m4 = 360 * (m4 - m4.Floor()); + m5 = 360 * (m5 - m5.Floor()); + m6 = 360 * (m6 - m6.Floor()); var ml = 270.434164 + m1 - (0.001133 - 0.0000019 * t) * t2; var ms = 358.475833 + m2 - (0.00015 + 0.0000033 * t) * t2; @@ -1223,9 +1223,9 @@ public static double MoonLong(double lh, double lm, double ls, int ds, int zc, d var na = 259.183275 - m6 + (0.002078 + 0.0000022 * t) * t2; var a = (51.2 + 20.2 * t).ToRadians(); var s1 = a.Sine(); - var s2 = ((na).ToRadians()).Sine(); + var s2 = na.ToRadians().Sine(); var b = 346.56 + (132.87 - 0.0091731 * t) * t; - var s3 = 0.003964 * ((b).ToRadians()).Sine(); + var s3 = 0.003964 * b.ToRadians().Sine(); var c = (na + 275.05 - 2.3 * t).ToRadians(); var s4 = c.Sine(); ml = ml + 0.000233 * s1 + s3 + 0.001964 * s2; @@ -1235,19 +1235,19 @@ public static double MoonLong(double lh, double lm, double ls, int ds, int zc, d me1 = me1 + 0.002011 * s1 + s3 + 0.001964 * s2; var e = 1.0 - (0.002495 + 0.00000752 * t) * t; var e2 = e * e; - ml = (ml).ToRadians(); + ml = ml.ToRadians(); ms = ms.ToRadians(); me1 = me1.ToRadians(); mf = mf.ToRadians(); md = md.ToRadians(); - var l = 6.28875 * (md).Sine() + 1.274018 * (2.0 * me1 - md).Sine(); + var l = 6.28875 * md.Sine() + 1.274018 * (2.0 * me1 - md).Sine(); l = l + 0.658309 * (2.0 * me1).Sine() + 0.213616 * (2.0 * md).Sine(); - l = l - e * 0.185596 * (ms).Sine() - 0.114336 * (2.0 * mf).Sine(); + l = l - e * 0.185596 * ms.Sine() - 0.114336 * (2.0 * mf).Sine(); l = l + 0.058793 * (2.0 * (me1 - md)).Sine(); l = l + 0.057212 * e * (2.0 * me1 - ms - md).Sine() + 0.05332 * (2.0 * me1 + md).Sine(); l = l + 0.045874 * e * (2.0 * me1 - ms).Sine() + 0.041024 * e * (md - ms).Sine(); - l = l - 0.034718 * (me1).Sine() - e * 0.030465 * (ms + md).Sine(); + l = l - 0.034718 * me1.Sine() - e * 0.030465 * (ms + md).Sine(); l = l + 0.015326 * (2.0 * (me1 - mf)).Sine() - 0.012528 * (2.0 * mf + md).Sine(); l = l - 0.01098 * (2.0 * mf - md).Sine() + 0.010674 * (4.0 * me1 - md).Sine(); l = l + 0.010034 * (3.0 * md).Sine() + 0.008548 * (4.0 * me1 - 2.0 * md).Sine(); @@ -1302,12 +1302,12 @@ public static double MoonLat(double lh, double lm, double ls, int ds, int zc, do m4 = q / m4; m5 = q / m5; m6 = q / m6; - m1 = 360 * (m1 - (m1).Floor()); - m2 = 360 * (m2 - (m2).Floor()); - m3 = 360 * (m3 - (m3).Floor()); - m4 = 360 * (m4 - (m4).Floor()); - m5 = 360 * (m5 - (m5).Floor()); - m6 = 360 * (m6 - (m6).Floor()); + m1 = 360 * (m1 - m1.Floor()); + m2 = 360 * (m2 - m2.Floor()); + m3 = 360 * (m3 - m3.Floor()); + m4 = 360 * (m4 - m4.Floor()); + m5 = 360 * (m5 - m5.Floor()); + m6 = 360 * (m6 - m6.Floor()); var ml = 270.434164 + m1 - (0.001133 - 0.0000019 * t) * t2; var ms = 358.475833 + m2 - (0.00015 + 0.0000033 * t) * t2; @@ -1316,12 +1316,12 @@ public static double MoonLat(double lh, double lm, double ls, int ds, int zc, do var mf = 11.250889 + m5 - (0.003211 + 0.0000003 * t) * t2; var na = 259.183275 - m6 + (0.002078 + 0.0000022 * t) * t2; var a = (51.2 + 20.2 * t).ToRadians(); - var s1 = (a).Sine(); + var s1 = a.Sine(); var s2 = na.ToRadians().Sine(); var b = 346.56 + (132.87 - 0.0091731 * t) * t; var s3 = 0.003964 * b.ToRadians().Sine(); var c = (na + 275.05 - 2.3 * t).ToRadians(); - var s4 = (c).Sine(); + var s4 = c.Sine(); ml = ml + 0.000233 * s1 + s3 + 0.001964 * s2; ms = ms - 0.001778 * s1; md = md + 0.000817 * s1 + s3 + 0.002541 * s2; @@ -1329,13 +1329,13 @@ public static double MoonLat(double lh, double lm, double ls, int ds, int zc, do me1 = me1 + 0.002011 * s1 + s3 + 0.001964 * s2; var e = 1.0 - (0.002495 + 0.00000752 * t) * t; var e2 = e * e; - ms = (ms).ToRadians(); - na = (na).ToRadians(); - me1 = (me1).ToRadians(); - mf = (mf).ToRadians(); - md = (md).ToRadians(); + ms = ms.ToRadians(); + na = na.ToRadians(); + me1 = me1.ToRadians(); + mf = mf.ToRadians(); + md = md.ToRadians(); - var g = 5.128189 * (mf).Sine() + 0.280606 * (md + mf).Sine(); + var g = 5.128189 * mf.Sine() + 0.280606 * (md + mf).Sine(); g = g + 0.277693 * (md - mf).Sine() + 0.173238 * (2.0 * me1 - mf).Sine(); g = g + 0.055413 * (2.0 * me1 + mf - md).Sine() + 0.046272 * (2.0 * me1 - mf - md).Sine(); g = g + 0.032573 * (2.0 * me1 + mf).Sine() + 0.017198 * (2.0 * md + mf).Sine(); @@ -1360,9 +1360,9 @@ public static double MoonLat(double lh, double lm, double ls, int ds, int zc, do g = g - e * 0.000353 * (ms + mf + 2.0 * me1).Sine() + 0.000331 * (mf + 4.0 * me1).Sine(); g = g + e * 0.000317 * (2.0 * me1 + mf - ms + md).Sine(); g = g + e2 * 0.000306 * (2.0 * (me1 - ms) - mf).Sine() - 0.000283 * (md + 3.0 * mf).Sine(); - var w1 = 0.0004664 * (na).Cosine(); - var w2 = 0.0000754 * (c).Cosine(); - var bm = (g).ToRadians() * (1.0 - w1 - w2); + var w1 = 0.0004664 * na.Cosine(); + var w2 = 0.0000754 * c.Cosine(); + var bm = g.ToRadians() * (1.0 - w1 - w2); return Degrees(bm); } @@ -1395,12 +1395,12 @@ public static double MoonHP(double lh, double lm, double ls, int ds, int zc, dou m4 = q / m4; m5 = q / m5; m6 = q / m6; - m1 = 360 * (m1 - (m1).Floor()); - m2 = 360 * (m2 - (m2).Floor()); - m3 = 360 * (m3 - (m3).Floor()); - m4 = 360 * (m4 - (m4).Floor()); - m5 = 360 * (m5 - (m5).Floor()); - m6 = 360 * (m6 - (m6).Floor()); + m1 = 360 * (m1 - m1.Floor()); + m2 = 360 * (m2 - m2.Floor()); + m3 = 360 * (m3 - m3.Floor()); + m4 = 360 * (m4 - m4.Floor()); + m5 = 360 * (m5 - m5.Floor()); + m6 = 360 * (m6 - m6.Floor()); var ml = 270.434164 + m1 - (0.001133 - 0.0000019 * t) * t2; var ms = 358.475833 + m2 - (0.00015 + 0.0000033 * t) * t2; @@ -1422,19 +1422,19 @@ public static double MoonHP(double lh, double lm, double ls, int ds, int zc, dou me1 = me1 + 0.002011 * s1 + s3 + 0.001964 * s2; var e = 1.0 - (0.002495 + 0.00000752 * t) * t; var e2 = e * e; - ms = (ms).ToRadians(); - me1 = (me1).ToRadians(); - mf = (mf).ToRadians(); - md = (md).ToRadians(); + ms = ms.ToRadians(); + me1 = me1.ToRadians(); + mf = mf.ToRadians(); + md = md.ToRadians(); - var pm = 0.950724 + 0.051818 * (md).Cosine() + 0.009531 * (2.0 * me1 - md).Cosine(); + var pm = 0.950724 + 0.051818 * md.Cosine() + 0.009531 * (2.0 * me1 - md).Cosine(); pm = pm + 0.007843 * (2.0 * me1).Cosine() + 0.002824 * (2.0 * md).Cosine(); pm = pm + 0.000857 * (2.0 * me1 + md).Cosine() + e * 0.000533 * (2.0 * me1 - ms).Cosine(); pm = pm + e * 0.000401 * (2.0 * me1 - md - ms).Cosine(); - pm = pm + e * 0.00032 * (md - ms).Cosine() - 0.000271 * (me1).Cosine(); + pm = pm + e * 0.00032 * (md - ms).Cosine() - 0.000271 * me1.Cosine(); pm = pm - e * 0.000264 * (ms + md).Cosine() - 0.000198 * (2.0 * mf - md).Cosine(); pm = pm + 0.000173 * (3.0 * md).Cosine() + 0.000167 * (4.0 * me1 - md).Cosine(); - pm = pm - e * 0.000111 * (ms).Cosine() + 0.000103 * (4.0 * me1 - 2.0 * md).Cosine(); + pm = pm - e * 0.000111 * ms.Cosine() + 0.000103 * (4.0 * me1 - 2.0 * md).Cosine(); pm = pm - 0.000084 * (2.0 * md - 2.0 * me1).Cosine() - e * 0.000083 * (2.0 * me1 + ms).Cosine(); pm = pm + 0.000079 * (2.0 * me1 + 2.0 * md).Cosine() + 0.000072 * (4.0 * me1).Cosine(); pm = pm + e * 0.000064 * (2.0 * me1 - ms + md).Cosine() - e * 0.000063 * (2.0 * me1 + ms - md).Cosine(); @@ -1455,7 +1455,7 @@ public static double MoonHP(double lh, double lm, double ls, int ds, int zc, dou /// public static double MoonDist(double lh, double lm, double ls, int ds, int zc, double dy, int mn, int yr) { - var hp = (MoonHP(lh, lm, ls, ds, zc, dy, mn, yr)).ToRadians(); + var hp = MoonHP(lh, lm, ls, ds, zc, dy, mn, yr).ToRadians(); var r = 6378.14 / hp.Sine(); return r; @@ -1469,7 +1469,7 @@ public static double MoonDist(double lh, double lm, double ls, int ds, int zc, d /// public static double MoonSize(double lh, double lm, double ls, int ds, int zc, double dy, int mn, int yr) { - var hp = (MoonHP(lh, lm, ls, ds, zc, dy, mn, yr)).ToRadians(); + var hp = MoonHP(lh, lm, ls, ds, zc, dy, mn, yr).ToRadians(); var r = 6378.14 / hp.Sine(); var th = 384401.0 * 0.5181 / r; @@ -1550,9 +1550,9 @@ public static double SunEcc(double gd, int gm, int gy) /// public static double EcDec(double eld, double elm, double els, double bd, double bm, double bs, double gd, int gm, int gy) { - var a = (DegreesMinutesSecondsToDecimalDegrees(eld, elm, els)).ToRadians(); - var b = (DegreesMinutesSecondsToDecimalDegrees(bd, bm, bs)).ToRadians(); - var c = (Obliq(gd, gm, gy)).ToRadians(); + var a = DegreesMinutesSecondsToDecimalDegrees(eld, elm, els).ToRadians(); + var b = DegreesMinutesSecondsToDecimalDegrees(bd, bm, bs).ToRadians(); + var c = Obliq(gd, gm, gy).ToRadians(); var d = b.Sine() * c.Cosine() + b.Cosine() * c.Sine() * a.Sine(); return Degrees(d.ASine()); @@ -1566,9 +1566,9 @@ public static double EcDec(double eld, double elm, double els, double bd, double /// public static double EcRA(double eld, double elm, double els, double bd, double bm, double bs, double gd, int gm, int gy) { - var a = (DegreesMinutesSecondsToDecimalDegrees(eld, elm, els)).ToRadians(); - var b = (DegreesMinutesSecondsToDecimalDegrees(bd, bm, bs)).ToRadians(); - var c = (Obliq(gd, gm, gy)).ToRadians(); + var a = DegreesMinutesSecondsToDecimalDegrees(eld, elm, els).ToRadians(); + var b = DegreesMinutesSecondsToDecimalDegrees(bd, bm, bs).ToRadians(); + var c = Obliq(gd, gm, gy).ToRadians(); var d = a.Sine() * c.Cosine() - b.Tangent() * c.Sine(); var e = a.Cosine(); var f = Degrees(d.AngleTangent2(e)); @@ -1622,7 +1622,7 @@ public static double SunMeanAnomaly(double lch, double lcm, double lcs, int ds, var a = 100.0021359 * t; var b = 360 * (a - a.Floor()); var m1 = 358.47583 - (0.00015 + 0.0000033 * t) * t2 + b; - var am = Unwind((m1).ToRadians()); + var am = Unwind(m1.ToRadians()); return am; } @@ -1762,11 +1762,11 @@ public static (double a, double x, double y, double la, string s) SunsetLCTL3710 public static double RiseSetLocalSiderealTimeRise(double rah, double ram, double ras, double dd, double dm, double ds, double vd, double g) { var a = HMStoDH(rah, ram, ras); - var b = (DegreeHoursToDecimalDegrees(a)).ToRadians(); - var c = (DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds)).ToRadians(); - var d = (vd).ToRadians(); - var e = (g).ToRadians(); - var f = -((d).Sine() + (e).Sine() * (c).Sine()) / ((e).Cosine() * (c).Cosine()); + var b = DegreeHoursToDecimalDegrees(a).ToRadians(); + var c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); + var d = vd.ToRadians(); + var e = g.ToRadians(); + var f = -(d.Sine() + e.Sine() * c.Sine()) / (e.Cosine() * c.Cosine()); var h = (Math.Abs(f) < 1) ? f.ACosine() : 0; var i = DecimalDegreesToDegreeHours(Degrees(b - h)); @@ -1782,8 +1782,8 @@ public static double RiseSetLocalSiderealTimeRise(double rah, double ram, double public static double RiseSetLocalSiderealTimeSet(double rah, double ram, double ras, double dd, double dm, double ds, double vd, double g) { var a = HMStoDH(rah, ram, ras); - var b = (DegreeHoursToDecimalDegrees(a)).ToRadians(); - var c = (DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds)).ToRadians(); + var b = DegreeHoursToDecimalDegrees(a).ToRadians(); + var c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); var d = vd.ToRadians(); var e = g.ToRadians(); var f = -(d.Sine() + e.Sine() * c.Sine()) / (e.Cosine() * c.Cosine()); @@ -1802,11 +1802,11 @@ public static double RiseSetLocalSiderealTimeSet(double rah, double ram, double public static double RiseSetAzimuthRise(double rah, double ram, double ras, double dd, double dm, double ds, double vd, double g) { var a = HMStoDH(rah, ram, ras); - var c = (DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds)).ToRadians(); + var c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); var d = vd.ToRadians(); var e = g.ToRadians(); var f = (c.Sine() + d.Sine() * e.Sine()) / (d.Cosine() * e.Cosine()); - var h = (ERS(rah, ram, ras, dd, dm, ds, vd, g).Equals("OK")) ? f.ACosine() : 0; + var h = ERS(rah, ram, ras, dd, dm, ds, vd, g).Equals("OK") ? f.ACosine() : 0; var i = Degrees(h); return i - 360 * (i / 360).Floor(); @@ -1821,11 +1821,11 @@ public static double RiseSetAzimuthRise(double rah, double ram, double ras, doub public static double RiseSetAzimuthSet(double rah, double ram, double ras, double dd, double dm, double ds, double vd, double g) { var a = HMStoDH(rah, ram, ras); - var c = (DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds)).ToRadians(); + var c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); var d = vd.ToRadians(); var e = g.ToRadians(); var f = (c.Sine() + d.Sine() * e.Sine()) / (d.Cosine() * e.Cosine()); - var h = (ERS(rah, ram, ras, dd, dm, ds, vd, g).Equals("OK")) ? f.ACosine() : 0; + var h = ERS(rah, ram, ras, dd, dm, ds, vd, g).Equals("OK") ? f.ACosine() : 0; var i = 360 - Degrees(h); return i - 360 * (i / 360).Floor(); @@ -1841,7 +1841,7 @@ public static double RiseSetAzimuthSet(double rah, double ram, double ras, doubl public static string ERS(double rah, double ram, double ras, double dd, double dm, double ds, double vd, double g) { var a = HMStoDH(rah, ram, ras); - var c = (DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds)).ToRadians(); + var c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); var d = vd.ToRadians(); var e = g.ToRadians(); var f = -(d.Sine() + e.Sine() * c.Sine()) / (e.Cosine() * c.Cosine()); @@ -2213,11 +2213,11 @@ public static (double a, double x, double y, double la, string s) ETwilight_L371 public static double Angle(double xx1, double xm1, double xs1, double dd1, double dm1, double ds1, double xx2, double xm2, double xs2, double dd2, double dm2, double ds2, PAAngleMeasure s ) { - var a = (s.Equals(PAAngleMeasure.Hours)) ? DegreeHoursToDecimalDegrees(HMStoDH(xx1, xm1, xs1)) : DegreesMinutesSecondsToDecimalDegrees(xx1, xm1, xs1); + var a = s.Equals(PAAngleMeasure.Hours) ? DegreeHoursToDecimalDegrees(HMStoDH(xx1, xm1, xs1)) : DegreesMinutesSecondsToDecimalDegrees(xx1, xm1, xs1); var b = a.ToRadians(); var c = DegreesMinutesSecondsToDecimalDegrees(dd1, dm1, ds1); var d = c.ToRadians(); - var e = (s.Equals(PAAngleMeasure.Hours)) ? DegreeHoursToDecimalDegrees(HMStoDH(xx2, xm2, xs2)) : DegreesMinutesSecondsToDecimalDegrees(xx2, xm2, xs2); + var e = s.Equals(PAAngleMeasure.Hours) ? DegreeHoursToDecimalDegrees(HMStoDH(xx2, xm2, xs2)) : DegreesMinutesSecondsToDecimalDegrees(xx2, xm2, xs2); var f = e.ToRadians(); var g = DegreesMinutesSecondsToDecimalDegrees(dd2, dm2, ds2); var h = g.ToRadians(); @@ -2497,7 +2497,7 @@ public static (double planetLongitude, double planetLatitude, double planetDista g = b62; h = b63; aa = a1 * t; - b = 360.0 * (aa - (aa).Floor()); + b = 360.0 * (aa - aa.Floor()); c = a0 + b + (a3 * t + a2) * t * t; pl.Add(new PlanetDataPrecise() @@ -2539,7 +2539,7 @@ public static (double planetLongitude, double planetLatitude, double planetDista h = c63; aa = a1 * t; - b = 360.0 * (aa - (aa).Floor()); + b = 360.0 * (aa - aa.Floor()); c = a0 + b + (a3 * t + a2) * t * t; pl.Add(new PlanetDataPrecise() @@ -2581,7 +2581,7 @@ public static (double planetLongitude, double planetLatitude, double planetDista h = d63; aa = a1 * t; - b = 360.0 * (aa - (aa).Floor()); + b = 360.0 * (aa - aa.Floor()); c = a0 + b + (a3 * t + a2) * t * t; pl.Add(new PlanetDataPrecise() @@ -2623,7 +2623,7 @@ public static (double planetLongitude, double planetLatitude, double planetDista h = e63; aa = a1 * t; - b = 360.0 * (aa - (aa).Floor()); + b = 360.0 * (aa - aa.Floor()); c = a0 + b + (a3 * t + a2) * t * t; pl.Add(new PlanetDataPrecise() @@ -2665,7 +2665,7 @@ public static (double planetLongitude, double planetLatitude, double planetDista h = f63; aa = a1 * t; - b = 360.0 * (aa - (aa).Floor()); + b = 360.0 * (aa - aa.Floor()); c = a0 + b + (a3 * t + a2) * t * t; pl.Add(new PlanetDataPrecise() @@ -2707,7 +2707,7 @@ public static (double planetLongitude, double planetLatitude, double planetDista h = g63; aa = a1 * t; - b = 360.0 * (aa - (aa).Floor()); + b = 360.0 * (aa - aa.Floor()); c = a0 + b + (a3 * t + a2) * t * t; pl.Add(new PlanetDataPrecise() @@ -2730,7 +2730,7 @@ public static (double planetLongitude, double planetLatitude, double planetDista var li = 0.0; var ms = SunMeanAnomaly(lh, lm, ls, ds, zc, dy, mn, yr); - var sr = (SunLong(lh, lm, ls, ds, zc, dy, mn, yr)).ToRadians(); + var sr = SunLong(lh, lm, ls, ds, zc, dy, mn, yr).ToRadians(); var re = SunDist(lh, lm, ls, ds, zc, dy, mn, yr); var lg = sr + Math.PI; @@ -2782,7 +2782,7 @@ public static (double planetLongitude, double planetLatitude, double planetDista var ec = matchPlanet.Value4 + qd; var am = matchPlanet.APValue + qe; var at = TrueAnomaly(am, ec); - var pvv = (matchPlanet.Value7 + qf) * (1.0 - ec * ec) / (1.0 + ec * (at).Cosine()); + var pvv = (matchPlanet.Value7 + qf) * (1.0 - ec * ec) / (1.0 + ec * at.Cosine()); var lp = Degrees(at) + matchPlanet.Value3 + Degrees(qc - qe); lp = lp.ToRadians(); var om = matchPlanet.Value6.ToRadians(); @@ -2795,7 +2795,7 @@ public static (double planetLongitude, double planetLatitude, double planetDista var y = so * inn.Cosine(); var ps = sp.ASine() + qg; sp = ps.Sine(); - pd = y.AngleTangent2(co) + om + (qa).ToRadians(); + pd = y.AngleTangent2(co) + om + qa.ToRadians(); pd = Unwind(pd); ci = ps.Cosine(); rd = pvv * ci; @@ -2946,16 +2946,16 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, if (new string[] { "Jupiter", "Saturn" }.Contains(planet.Name)) { var j7 = j3 - j2; - var u1 = (j3).Sine(); - var u2 = (j3).Cosine(); + var u1 = j3.Sine(); + var u2 = j3.Cosine(); var u3 = (2.0 * j3).Sine(); var u4 = (2.0 * j3).Cosine(); - var u5 = (j5).Sine(); - var u6 = (j5).Cosine(); + var u5 = j5.Sine(); + var u6 = j5.Cosine(); var u7 = (2.0 * j5).Sine(); - var u8a = (j6).Sine(); - var u9 = (j7).Sine(); - var ua = (j7).Cosine(); + var u8a = j6.Sine(); + var u9 = j7.Sine(); + var ua = j7.Cosine(); var ub = (2.0 * j7).Sine(); var uc = (2.0 * j7).Cosine(); var ud = (3.0 * j7).Sine(); @@ -3091,8 +3091,8 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, { var j8 = Unwind(1.46205 + 3.81337 * t); var j9 = 2.0 * j8 - j4; - var vj = (j9).Sine(); - var uu = (j9).Cosine(); + var vj = j9.Sine(); + var uu = j9.Cosine(); var uv = (2.0 * j9).Sine(); var uw = (2.0 * j9).Cosine(); @@ -3117,16 +3117,16 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, var vd = (2.0 * jc).Sine(); var ve = (2.0 * jc).Cosine(); - var vf = (j8).Sine(); - var vg = (j8).Cosine(); - qa = -0.009556 * (ja).Sine() - 0.005178 * (jb).Sine(); + var vf = j8.Sine(); + var vg = j8.Cosine(); + qa = -0.009556 * ja.Sine() - 0.005178 * jb.Sine(); qa = qa + 0.002572 * vd - 0.002972 * ve * vf - 0.002833 * vd * vg; qg = 0.000336 * ve * vf + 0.000364 * vd * vg; qg = qg.ToRadians(); - qb = -40596.0 + 4992.0 * (ja).Cosine() + 2744.0 * (jb).Cosine(); - qb = qb + 2044.0 * (jc).Cosine() + 1051.0 * ve; + qb = -40596.0 + 4992.0 * ja.Cosine() + 2744.0 * jb.Cosine(); + qb = qb + 2044.0 * jc.Cosine() + 1051.0 * ve; qb = qb * 0.000001; return (qa, qb, qc, qd, qe, qf, qg); @@ -3137,7 +3137,7 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, jc = j8 - j4; qc = (0.864319 - 0.001583 * j1) * vj; qc = qc + (0.082222 - 0.006833 * j1) * uu + 0.036017 * uv; - qc = qc - 0.003019 * uw + 0.008122 * (j6).Sine(); + qc = qc - 0.003019 * uw + 0.008122 * j6.Sine(); qc = qc.ToRadians(); vk = 0.120303 * vj + 0.006197 * uv; @@ -3152,9 +3152,9 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, qa = (-0.038581 + (0.002031 - 0.00191 * j1) * j1) * (j4 + jb).Cosine(); qa = qa + (0.010122 - 0.000988 * j1) * (j4 + jb).Sine(); var a = (0.034964 - (0.001038 - 0.000868 * j1) * j1) * (2.0 * j4 + jb).Cosine(); - qa = a + qa + 0.005594 * (j4 + 3.0 * jc).Sine() - 0.014808 * (ja).Sine(); - qa = qa - 0.005794 * (jb).Sine() + 0.002347 * (jb).Cosine(); - qa = qa + 0.009872 * (jc).Sine() + 0.008803 * (2.0 * jc).Sine(); + qa = a + qa + 0.005594 * (j4 + 3.0 * jc).Sine() - 0.014808 * ja.Sine(); + qa = qa - 0.005794 * jb.Sine() + 0.002347 * jb.Cosine(); + qa = qa + 0.009872 * jc.Sine() + 0.008803 * (2.0 * jc).Sine(); qa = qa - 0.004308 * (3.0 * jc).Sine(); var ux = jb.Sine(); @@ -3168,8 +3168,8 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, qg = qg + 0.000403 * ((2.0 * jc).Cosine() * vb + (2.0 * jc).Sine() * vc); qg = qg.ToRadians(); - qb = -25948.0 + 4985.0 * (ja).Cosine() - 1230.0 * va + 3354.0 * uy; - qb = qb + 904.0 * (2.0 * jc).Cosine() + 894.0 * ((jc).Cosine() - (3.0 * jc).Cosine()); + qb = -25948.0 + 4985.0 * ja.Cosine() - 1230.0 * va + 3354.0 * uy; + qb = qb + 904.0 * (2.0 * jc).Cosine() + 894.0 * (jc.Cosine() - (3.0 * jc).Cosine()); qb = qb + (5795.0 * va - 1165.0 * uz + 1388.0 * vc) * ux; qb = qb + (1351.0 * va + 5702.0 * uz + 1388.0 * vb) * uy; qb = qb * 0.000001; @@ -3250,7 +3250,7 @@ public static (double cometLongDeg, double cometLatDeg, double cometDistAU) PCom for (int k = 1; k < 3; k++) { - var s = SolveCubic(0.0364911624 * tpe / (q * (q).SquareRoot())); + var s = SolveCubic(0.0364911624 * tpe / (q * q.SquareRoot())); var nu = 2.0 * s.AngleTangent(); var r = q * (1.0 + s * s); var l = nu + p.ToRadians(); @@ -3266,19 +3266,19 @@ public static (double cometLongDeg, double cometLatDeg, double cometDistAU) PCom var ll = lc - lg; c3 = ll.Cosine(); s3 = ll.Sine(); - var rh = ((re * re) + (r * r) - (2.0 * re * rd * c3 * (ps).Cosine())).SquareRoot(); + var rh = ((re * re) + (r * r) - (2.0 * re * rd * c3 * ps.Cosine())).SquareRoot(); if (k == 1) { - rh2 = ((re * re) + (r * r) - (2.0 * re * r * (ps).Cosine() * (l + (n).ToRadians() - lg).Cosine())).SquareRoot(); + rh2 = ((re * re) + (r * r) - (2.0 * re * r * ps.Cosine() * (l + n.ToRadians() - lg).Cosine())).SquareRoot(); } } double ep; - ep = (rd < re) ? ((-rd * s3) / (re - (rd * c3))).AngleTangent() + lg + 3.141592654 : ((re * s3) / (rd - (re * c3))).AngleTangent() + lc; + ep = (rd < re) ? (-rd * s3 / (re - (rd * c3))).AngleTangent() + lg + 3.141592654 : (re * s3 / (rd - (re * c3))).AngleTangent() + lc; ep = Unwind(ep); - var tb = (rd * s2 * (ep - lc).Sine()) / (c2 * re * s3); + var tb = rd * s2 * (ep - lc).Sine() / (c2 * re * s3); var bp = tb.AngleTangent(); var cometLongDeg = Degrees(ep); @@ -3459,13 +3459,13 @@ public static double MoonPhase(double lh, double lm, double ls, int ds, int zc, { var moonResult = MoonLongLatHP(lh, lm, ls, ds, zc, dy, mn, yr); - var cd = ((moonResult.moonLongDeg - SunLong(lh, lm, ls, ds, zc, dy, mn, yr)).ToRadians()).Cosine() * ((moonResult.moonLatDeg).ToRadians()).Cosine(); + var cd = (moonResult.moonLongDeg - SunLong(lh, lm, ls, ds, zc, dy, mn, yr)).ToRadians().Cosine() * moonResult.moonLatDeg.ToRadians().Cosine(); var d = cd.ACosine(); var sd = d.Sine(); - var i = 0.1468 * sd * (1.0 - 0.0549 * (MoonMeanAnomaly(lh, lm, ls, ds, zc, dy, mn, yr)).Sine()); - i = i / (1.0 - 0.0167 * (SunMeanAnomaly(lh, lm, ls, ds, zc, dy, mn, yr)).Sine()); + var i = 0.1468 * sd * (1.0 - 0.0549 * MoonMeanAnomaly(lh, lm, ls, ds, zc, dy, mn, yr).Sine()); + i = i / (1.0 - 0.0167 * SunMeanAnomaly(lh, lm, ls, ds, zc, dy, mn, yr).Sine()); i = 3.141592654 - d - i.ToRadians(); - var k = (1.0 + (i).Cosine()) / 2.0; + var k = (1.0 + i.Cosine()) / 2.0; return Math.Round(k, 2); } @@ -3696,9 +3696,9 @@ public static double FPart(double w) /// public static double EQELat(double rah, double ram, double ras, double dd, double dm, double ds, double gd, int gm, int gy) { - var a = (DegreeHoursToDecimalDegrees(HMStoDH(rah, ram, ras))).ToRadians(); - var b = (DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds)).ToRadians(); - var c = (Obliq(gd, gm, gy)).ToRadians(); + var a = DegreeHoursToDecimalDegrees(HMStoDH(rah, ram, ras)).ToRadians(); + var b = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); + var c = Obliq(gd, gm, gy).ToRadians(); var d = b.Sine() * c.Cosine() - b.Cosine() * c.Sine() * a.Sine(); return Degrees(d.ASine()); @@ -3709,9 +3709,9 @@ public static double EQELat(double rah, double ram, double ras, double dd, doubl /// public static double EQELong(double rah, double ram, double ras, double dd, double dm, double ds, double gd, int gm, int gy) { - var a = (DegreeHoursToDecimalDegrees(HMStoDH(rah, ram, ras))).ToRadians(); - var b = (DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds)).ToRadians(); - var c = (Obliq(gd, gm, gy)).ToRadians(); + var a = DegreeHoursToDecimalDegrees(HMStoDH(rah, ram, ras)).ToRadians(); + var b = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); + var c = Obliq(gd, gm, gy).ToRadians(); var d = a.Sine() * c.Cosine() + b.Tangent() * c.Sine(); var e = a.Cosine(); var f = Degrees(d.AngleTangent2(e)); @@ -3821,7 +3821,7 @@ public static (double mm, double bm, double pm, double dp, double th, double di, { var mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); var bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var pm = (MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1)).ToRadians(); + var pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); var dp = NutatLong(gdy, gmn, gyr); var th = 0.27249 * pm.Sine(); var di = th + 0.0098902 - pm; @@ -3943,7 +3943,7 @@ public static (double mm, double bm, double pm, double dp, double th, double di, { var mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); var bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var pm = (MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1)).ToRadians(); + var pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); var dp = NutatLong(gdy, gmn, gyr); var th = 0.27249 * pm.Sine(); var di = th + 0.0098902 - pm; @@ -4051,7 +4051,7 @@ public static (double mm, double bm, double pm, double dp, double th, double di, { var mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); var bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var pm = (MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1)).ToRadians(); + var pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); var dp = NutatLong(gdy, gmn, gyr); var th = 0.27249 * pm.Sine(); var di = th + 0.0098902 - pm; @@ -4164,7 +4164,7 @@ public static (double mm, double bm, double pm, double dp, double th, double di, { var mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); var bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var pm = (MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1)).ToRadians(); + var pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); var dp = NutatLong(gdy, gmn, gyr); var th = 0.27249 * pm.Sine(); var di = th + 0.0098902 - pm; @@ -4285,7 +4285,7 @@ public static (double mm, double bm, double pm, double dp, double th, double di, { var mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); var bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var pm = (MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1)).ToRadians(); + var pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); var dp = NutatLong(gdy, gmn, gyr); var th = 0.27249 * pm.Sine(); var di = th + 0.0098902 - pm; @@ -4394,7 +4394,7 @@ public static (double mm, double bm, double pm, double dp, double th, double di, { var mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); var bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var pm = (MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1)).ToRadians(); + var pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); var dp = NutatLong(gdy, gmn, gyr); var th = 0.27249 * pm.Sine(); var di = th + 0.0098902 - pm; @@ -4508,15 +4508,15 @@ public static double UTMaxLunarEclipse(double dy, int mn, int yr, int ds, int zc var xi = gday - igday; var utfm = xi * 24.0; var ut = utfm - 1.0; - var ly = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var my = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var by = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hy = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians() - ly; - var mz = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var bz = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hz = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; @@ -4533,7 +4533,7 @@ public static double UTMaxLunarEclipse(double dy, int mn, int yr, int ds, int zc var mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; @@ -4582,15 +4582,15 @@ public static double UTFirstContactLunarEclipse(double dy, int mn, int yr, int d var xi = gday - igday; var utfm = xi * 24.0; var ut = utfm - 1.0; - var ly = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var my = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var by = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hy = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians() - ly; - var mz = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var bz = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hz = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; @@ -4607,7 +4607,7 @@ public static double UTFirstContactLunarEclipse(double dy, int mn, int yr, int d var mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; @@ -4662,15 +4662,15 @@ public static double UTLastContactLunarEclipse(double dy, int mn, int yr, int ds var xi = gday - igday; var utfm = xi * 24.0; var ut = utfm - 1.0; - var ly = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var my = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var by = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hy = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians() - ly; - var mz = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var bz = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hz = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; @@ -4687,7 +4687,7 @@ public static double UTLastContactLunarEclipse(double dy, int mn, int yr, int ds var mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; @@ -4739,15 +4739,15 @@ public static double UTStartUmbraLunarEclipse(double dy, int mn, int yr, int ds, var xi = gday - igday; var utfm = xi * 24.0; var ut = utfm - 1.0; - var ly = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var my = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var by = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hy = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians() - ly; - var mz = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var bz = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hz = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; @@ -4764,7 +4764,7 @@ public static double UTStartUmbraLunarEclipse(double dy, int mn, int yr, int ds, var mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; @@ -4831,15 +4831,15 @@ public static double UTEndUmbraLunarEclipse(double dy, int mn, int yr, int ds, i var xi = gday - igday; var utfm = xi * 24.0; var ut = utfm - 1.0; - var ly = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var my = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var by = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hy = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians() - ly; - var mz = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var bz = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hz = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; @@ -4856,7 +4856,7 @@ public static double UTEndUmbraLunarEclipse(double dy, int mn, int yr, int ds, i var mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; @@ -4920,15 +4920,15 @@ public static double UTStartTotalLunarEclipse(double dy, int mn, int yr, int ds, var xi = gday - igday; var utfm = xi * 24.0; var ut = utfm - 1.0; - var ly = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var my = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var by = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hy = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians() - ly; - var mz = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var bz = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hz = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; @@ -4945,7 +4945,7 @@ public static double UTStartTotalLunarEclipse(double dy, int mn, int yr, int ds, var mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; @@ -4972,7 +4972,7 @@ public static double UTStartTotalLunarEclipse(double dy, int mn, int yr, int ds, if (dd < 0.0) return -99.0; - var zd = (dd).SquareRoot(); + var zd = dd.SquareRoot(); var z6 = z1 - zd; r = rm + ru; @@ -4982,7 +4982,7 @@ public static double UTStartTotalLunarEclipse(double dy, int mn, int yr, int ds, if (dd < 0.0) return -99.0; - zd = (dd).SquareRoot(); + zd = dd.SquareRoot(); var z8 = z1 - zd; r = ru - rm; @@ -4992,7 +4992,7 @@ public static double UTStartTotalLunarEclipse(double dy, int mn, int yr, int ds, if (dd < 0.0) return -99.0; - zd = (dd).SquareRoot(); + zd = dd.SquareRoot(); var zcc = z1 - zd; if (zcc < 0.0) @@ -5022,15 +5022,15 @@ public static double UTEndTotalLunarEclipse(double dy, int mn, int yr, int ds, i var xi = gday - igday; var utfm = xi * 24.0; var ut = utfm - 1.0; - var ly = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var my = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var by = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hy = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians() - ly; - var mz = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var bz = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hz = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; @@ -5047,7 +5047,7 @@ public static double UTEndTotalLunarEclipse(double dy, int mn, int yr, int ds, i var mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; @@ -5121,15 +5121,15 @@ public static double MagLunarEclipse(double dy, int mn, int yr, int ds, int zc) var xi = gday - igday; var utfm = xi * 24.0; var ut = utfm - 1.0; - var ly = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var my = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var by = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hy = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians() - ly; - var mz = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var bz = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hz = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; @@ -5146,7 +5146,7 @@ public static double MagLunarEclipse(double dy, int mn, int yr, int ds, int zc) var mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; @@ -5260,8 +5260,8 @@ public static (double f, double dd, double e1, double b1, double a, double b) So a2 = a2.ToRadians(); f = f.ToRadians(); - var dd = (0.1734 - 0.000393 * t) * (a1).Sine() + 0.0021 * (2.0 * a1).Sine(); - dd = dd - 0.4068 * (a2).Sine() + 0.0161 * (2.0 * a2).Sine() - 0.0004 * (3.0 * a2).Sine(); + var dd = (0.1734 - 0.000393 * t) * a1.Sine() + 0.0021 * (2.0 * a1).Sine(); + dd = dd - 0.4068 * a2.Sine() + 0.0161 * (2.0 * a2).Sine() - 0.0004 * (3.0 * a2).Sine(); dd = dd + 0.0104 * (2.0 * f).Sine() - 0.0051 * (a1 + a2).Sine(); dd = dd - 0.0074 * (a1 - a2).Sine() + 0.0004 * (2.0 * f + a1).Sine(); dd = dd - 0.0004 * (2.0 * f - a1).Sine() - 0.0006 * (2.0 * f + a2).Sine() + 0.001 * (2.0 * f - a2).Sine(); @@ -5296,15 +5296,15 @@ public static double UTMaxSolarEclipse(double dy, int mn, int yr, int ds, int zc var xi = gday - igday; var utnm = xi * 24.0; var ut = utnm - 1.0; - var ly = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var my = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var by = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hy = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utnm + 1.0; - var sb = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians() - ly; - var mz = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var bz = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hz = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; @@ -5335,7 +5335,7 @@ public static double UTMaxSolarEclipse(double dy, int mn, int yr, int ds, int zc var mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); x = sr; y = 0.0; @@ -5384,8 +5384,8 @@ public static (double paa, double qaa, double xaa, double pbb, double qbb, doubl var pbb = ParallaxHA(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); var qbb = ParallaxDec(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); var xbb = HourAngleToRightAscension(pbb, 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); - var p = (EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear)).ToRadians(); - var q = (EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear)).ToRadians(); + var p = EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); + var q = EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); return (paa, qaa, xaa, pbb, qbb, xbb, p, q); } @@ -5411,15 +5411,15 @@ public static double UTFirstContactSolarEclipse(double dy, int mn, int yr, int d var xi = gday - igday; var utnm = xi * 24.0; var ut = utnm - 1.0; - var ly = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var my = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var by = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hy = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utnm + 1.0; - var sb = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians() - ly; - var mz = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var bz = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hz = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; @@ -5450,7 +5450,7 @@ public static double UTFirstContactSolarEclipse(double dy, int mn, int yr, int d var mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); x = sr; y = 0.0; @@ -5502,8 +5502,8 @@ public static (double paa, double qaa, double xaa, double pbb, double qbb, doubl var pbb = ParallaxHA(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); var qbb = ParallaxDec(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); var xbb = HourAngleToRightAscension(pbb, 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); - var p = (EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear)).ToRadians(); - var q = (EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear)).ToRadians(); + var p = EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); + var q = EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); return (paa, qaa, xaa, pbb, qbb, xbb, p, q); } @@ -5529,15 +5529,15 @@ public static double UTLastContactSolarEclipse(double dy, int mn, int yr, int ds var xi = gday - igday; var utnm = xi * 24.0; var ut = utnm - 1.0; - var ly = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var my = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var by = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hy = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utnm + 1.0; - var sb = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians() - ly; - var mz = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var bz = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hz = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; @@ -5568,7 +5568,7 @@ public static double UTLastContactSolarEclipse(double dy, int mn, int yr, int ds var mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); x = sr; y = 0.0; @@ -5617,8 +5617,8 @@ public static (double paa, double qaa, double xaa, double pbb, double qbb, doubl var pbb = ParallaxHA(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); var qbb = ParallaxDec(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); var xbb = HourAngleToRightAscension(pbb, 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); - var p = (EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear)).ToRadians(); - var q = (EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear)).ToRadians(); + var p = EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); + var q = EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); return (paa, qaa, xaa, pbb, qbb, xbb, p, q); } @@ -5644,15 +5644,15 @@ public static double MagSolarEclipse(double dy, int mn, int yr, int ds, int zc, var xi = gday - igday; var utnm = xi * 24.0; var ut = utnm - 1.0; - var ly = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var my = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var by = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hy = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utnm + 1.0; - var sb = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians() - ly; - var mz = (MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var bz = (MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); - var hz = (MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; @@ -5683,7 +5683,7 @@ public static double MagSolarEclipse(double dy, int mn, int yr, int ds, int zc, var mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = (SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear)).ToRadians(); + var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); x = sr; y = 0.0; @@ -5733,8 +5733,8 @@ public static (double paa, double qaa, double xaa, double pbb, double qbb, doubl var pbb = ParallaxHA(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); var qbb = ParallaxDec(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); var xbb = HourAngleToRightAscension(pbb, 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); - var p = (EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear)).ToRadians(); - var q = (EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear)).ToRadians(); + var p = EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); + var q = EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); return (paa, qaa, xaa, pbb, qbb, xbb, p, q); } diff --git a/PALib/PAMoon.cs b/PALib/PAMoon.cs index 979d6f4..09bc73b 100644 --- a/PALib/PAMoon.cs +++ b/PALib/PAMoon.cs @@ -21,7 +21,7 @@ public class PAMoon /// public (double moonRAHour, double moonRAMin, double moonRASec, double moonDecDeg, double moonDecMin, double moonDecSec) ApproximatePositionOfMoon(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var l0 = 91.9293359879052; var p0 = 130.143076320618; @@ -39,17 +39,17 @@ public class PAMoon var lmDeg = PAMacros.UnwindDeg(13.1763966 * dDays + l0); var mmDeg = PAMacros.UnwindDeg(lmDeg - 0.1114041 * dDays - p0); var nDeg = PAMacros.UnwindDeg(n0 - (0.0529539 * dDays)); - var evDeg = 1.2739 * ((2.0 * (lmDeg - sunLongDeg) - mmDeg).ToRadians()).Sine(); - var aeDeg = 0.1858 * (sunMeanAnomalyRad).Sine(); - var a3Deg = 0.37 * (sunMeanAnomalyRad).Sine(); + var evDeg = 1.2739 * (2.0 * (lmDeg - sunLongDeg) - mmDeg).ToRadians().Sine(); + var aeDeg = 0.1858 * sunMeanAnomalyRad.Sine(); + var a3Deg = 0.37 * sunMeanAnomalyRad.Sine(); var mmdDeg = mmDeg + evDeg - aeDeg - a3Deg; var ecDeg = 6.2886 * mmdDeg.ToRadians().Sine(); - var a4Deg = 0.214 * (2.0 * (mmdDeg).ToRadians()).Sine(); + var a4Deg = 0.214 * (2.0 * mmdDeg.ToRadians()).Sine(); var ldDeg = lmDeg + evDeg + ecDeg - aeDeg + a4Deg; var vDeg = 0.6583 * (2.0 * (ldDeg - sunLongDeg).ToRadians()).Sine(); var lddDeg = ldDeg + vDeg; - var ndDeg = nDeg - 0.16 * (sunMeanAnomalyRad).Sine(); - var y = ((lddDeg - ndDeg).ToRadians()).Sine() * i.ToRadians().Cosine(); + var ndDeg = nDeg - 0.16 * sunMeanAnomalyRad.Sine(); + var y = (lddDeg - ndDeg).ToRadians().Sine() * i.ToRadians().Cosine(); var x = (lddDeg - ndDeg).ToRadians().Cosine(); var moonLongDeg = PAMacros.UnwindDeg(PAMacros.Degrees(y.AngleTangent2(x)) + ndDeg); @@ -82,7 +82,7 @@ public class PAMoon /// public (double moonRAHour, double moonRAMin, double moonRASec, double moonDecDeg, double moonDecMin, double moonDecSec, double earthMoonDistKM, double moonHorParallaxDeg) PrecisePositionOfMoon(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var gdateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var gdateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); @@ -117,7 +117,7 @@ public class PAMoon /// public (double moonPhase, double paBrightLimbDeg) MoonPhase(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear, PAAccuracyLevel accuracyLevel) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var gdateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var gdateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); @@ -127,15 +127,15 @@ public class PAMoon var moonResult = PAMacros.MoonLongLatHP(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var dRad = (moonResult.moonLongDeg - sunLongDeg).ToRadians(); - var moonPhase1 = (accuracyLevel == PAAccuracyLevel.Precise) ? PAMacros.MoonPhase(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear) : (1.0 - (dRad).Cosine()) / 2.0; + var moonPhase1 = (accuracyLevel == PAAccuracyLevel.Precise) ? PAMacros.MoonPhase(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear) : (1.0 - dRad.Cosine()) / 2.0; - var sunRARad = (PAMacros.EcRA(sunLongDeg, 0, 0, 0, 0, 0, gdateDay, gdateMonth, gdateYear)).ToRadians(); - var moonRARad = (PAMacros.EcRA(moonResult.moonLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear)).ToRadians(); - var sunDecRad = (PAMacros.EcDec(sunLongDeg, 0, 0, 0, 0, 0, gdateDay, gdateMonth, gdateYear)).ToRadians(); - var moonDecRad = (PAMacros.EcDec(moonResult.moonLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear)).ToRadians(); + var sunRARad = PAMacros.EcRA(sunLongDeg, 0, 0, 0, 0, 0, gdateDay, gdateMonth, gdateYear).ToRadians(); + var moonRARad = PAMacros.EcRA(moonResult.moonLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear).ToRadians(); + var sunDecRad = PAMacros.EcDec(sunLongDeg, 0, 0, 0, 0, 0, gdateDay, gdateMonth, gdateYear).ToRadians(); + var moonDecRad = PAMacros.EcDec(moonResult.moonLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear).ToRadians(); - var y = (sunDecRad).Cosine() * (sunRARad - moonRARad).Sine(); - var x = (moonDecRad).Cosine() * (sunDecRad).Sine() - (moonDecRad).Sine() * (sunDecRad).Cosine() * (sunRARad - moonRARad).Cosine(); + var y = sunDecRad.Cosine() * (sunRARad - moonRARad).Sine(); + var x = moonDecRad.Cosine() * sunDecRad.Sine() - moonDecRad.Sine() * sunDecRad.Cosine() * (sunRARad - moonRARad).Cosine(); var chiDeg = PAMacros.Degrees(y.AngleTangent2(x)); @@ -162,7 +162,7 @@ public class PAMoon /// public (double nmLocalTimeHour, double nmLocalTimeMin, double nmLocalDateDay, int nmLocalDateMonth, int nmLocalDateYear, double fmLocalTimeHour, double fmLocalTimeMin, double fmLocalDateDay, int fmLocalDateMonth, int fmLocalDateYear) TimesOfNewMoonAndFullMoon(bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var jdOfNewMoonDays = PAMacros.NewMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var jdOfFullMoonDays = PAMacros.FullMoon(3, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); @@ -209,7 +209,7 @@ public class PAMoon /// public (double earthMoonDist, double angDiameterDeg, double angDiameterMin, double horParallaxDeg, double horParallaxMin, double horParallaxSec) MoonDistAngDiamHorParallax(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var moonDistance = PAMacros.MoonDist(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var moonAngularDiameter = PAMacros.MoonSize(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); @@ -244,7 +244,7 @@ public class PAMoon /// public (double mrLTHour, double mrLTMin, double mrLocalDateDay, int mrLocalDateMonth, int mrLocalDateYear, double mrAzimuthDeg, double msLTHour, double msLTMin, double msLocalDateDay, int msLocalDateMonth, int msLocalDateYear, double msAzimuthDeg) MoonriseAndMoonset(double localDateDay, int localDateMonth, int localDateYear, bool isDaylightSaving, int zoneCorrectionHours, double geogLongDeg, double geogLatDeg) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var localTimeOfMoonriseHours = PAMacros.MoonRiseLCT(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); var moonRiseLCResult = PAMacros.MoonRiseLcDMY(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); diff --git a/PALib/PAPlanet.cs b/PALib/PAPlanet.cs index 7881a26..b13e02e 100644 --- a/PALib/PAPlanet.cs +++ b/PALib/PAPlanet.cs @@ -14,7 +14,7 @@ public class PAPlanet /// public (double planetRAHour, double planetRAMin, double planetRASec, double planetDecDeg, double planetDecMin, double planetDecSec) ApproximatePositionOfPlanet(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear, string planetName) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var planetInfo = PlanetInfo.GetPlanetInfo(planetName); @@ -42,7 +42,7 @@ public class PAPlanet var earthTrueAnomalyDeg = leDeg2 - earthInfo.peri_LongitudePerihelion; var rAU2 = earthInfo.axis_AxisOrbit * (1 - Math.Pow(earthInfo.ecc_EccentricityOrbit, 2)) / (1 + earthInfo.ecc_EccentricityOrbit * earthTrueAnomalyDeg.ToRadians().Cosine()); var lpNodeRad = (lpDeg2 - planetInfo.node_LongitudeAscendingNode).ToRadians(); - var psiRad = ((lpNodeRad).Sine() * planetInfo.incl_OrbitalInclination.ToRadians().Sine()).ASine(); + var psiRad = (lpNodeRad.Sine() * planetInfo.incl_OrbitalInclination.ToRadians().Sine()).ASine(); var y = lpNodeRad.Sine() * planetInfo.incl_OrbitalInclination.ToRadians().Cosine(); var x = lpNodeRad.Cosine(); var ldDeg = PAMacros.Degrees(y.AngleTangent2(x)) + planetInfo.node_LongitudeAscendingNode; @@ -53,7 +53,7 @@ public class PAPlanet var aRad = (rdAU < 1) ? atan2Type1 : atan2Type2; var lamdaDeg1 = (rdAU < 1) ? 180 + leDeg2 + PAMacros.Degrees(aRad) : PAMacros.Degrees(aRad) + ldDeg; var lamdaDeg2 = lamdaDeg1 - 360 * (lamdaDeg1 / 360).Floor(); - var betaDeg = PAMacros.Degrees((rdAU * psiRad.Tangent() * ((lamdaDeg2 - ldDeg).ToRadians()).Sine() / (rAU2 * (-leLdRad).Sine())).AngleTangent()); + var betaDeg = PAMacros.Degrees((rdAU * psiRad.Tangent() * (lamdaDeg2 - ldDeg).ToRadians().Sine() / (rAU2 * (-leLdRad).Sine())).AngleTangent()); var raHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(lamdaDeg2, 0, 0, betaDeg, 0, 0, gdateDay, gdateMonth, gdateYear)); var decDeg = PAMacros.EcDec(lamdaDeg2, 0, 0, betaDeg, 0, 0, gdateDay, gdateMonth, gdateYear); @@ -72,7 +72,7 @@ public class PAPlanet /// public (double planetRAHour, double planetRAMin, double planetRASec, double planetDecDeg, double planetDecMin, double planetDecSec) PrecisePositionOfPlanet(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear, string planetName) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var coordinateResults = PAMacros.PlanetCoordinates(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear, planetName); @@ -104,7 +104,7 @@ public class PAPlanet /// public (double distanceAU, double angDiaArcsec, double phase, double lightTimeHour, double lightTimeMinutes, double lightTimeSeconds, double posAngleBrightLimbDeg, double approximateMagnitude) VisualAspectsOfAPlanet(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear, string planetName) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var greenwichDateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var greenwichDateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); @@ -112,24 +112,24 @@ public class PAPlanet var planetCoordInfo = PAMacros.PlanetCoordinates(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear, planetName); - var planetRARad = (PAMacros.EcRA(planetCoordInfo.planetLongitude, 0, 0, planetCoordInfo.planetLatitude, 0, 0, localDateDay, localDateMonth, localDateYear)).ToRadians(); - var planetDecRad = (PAMacros.EcDec(planetCoordInfo.planetLongitude, 0, 0, planetCoordInfo.planetLatitude, 0, 0, localDateDay, localDateMonth, localDateYear)).ToRadians(); + var planetRARad = PAMacros.EcRA(planetCoordInfo.planetLongitude, 0, 0, planetCoordInfo.planetLatitude, 0, 0, localDateDay, localDateMonth, localDateYear).ToRadians(); + var planetDecRad = PAMacros.EcDec(planetCoordInfo.planetLongitude, 0, 0, planetCoordInfo.planetLatitude, 0, 0, localDateDay, localDateMonth, localDateYear).ToRadians(); var lightTravelTimeHours = planetCoordInfo.planetDistanceAU * 0.1386; var planetInfo = PlanetInfo.GetPlanetInfo(planetName); var angularDiameterArcsec = planetInfo.theta0_AngularDiameter / planetCoordInfo.planetDistanceAU; - var phase1 = 0.5 * (1.0 + ((planetCoordInfo.planetLongitude - planetCoordInfo.planetHLong1).ToRadians()).Cosine()); + var phase1 = 0.5 * (1.0 + (planetCoordInfo.planetLongitude - planetCoordInfo.planetHLong1).ToRadians().Cosine()); var sunEclLongDeg = PAMacros.SunLong(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var sunRARad = (PAMacros.EcRA(sunEclLongDeg, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear)).ToRadians(); - var sunDecRad = (PAMacros.EcDec(sunEclLongDeg, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear)).ToRadians(); + var sunRARad = PAMacros.EcRA(sunEclLongDeg, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear).ToRadians(); + var sunDecRad = PAMacros.EcDec(sunEclLongDeg, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear).ToRadians(); - var y = (sunDecRad).Cosine() * (sunRARad - planetRARad).Sine(); - var x = (planetDecRad).Cosine() * (sunDecRad).Sine() - (planetDecRad).Sine() * (sunDecRad).Cosine() * (sunRARad - planetRARad).Cosine(); + var y = sunDecRad.Cosine() * (sunRARad - planetRARad).Sine(); + var x = planetDecRad.Cosine() * sunDecRad.Sine() - planetDecRad.Sine() * sunDecRad.Cosine() * (sunRARad - planetRARad).Cosine(); var chiDeg = PAMacros.Degrees(y.AngleTangent2(x)); var radiusVectorAU = planetCoordInfo.planetRVect; - var approximateMagnitude1 = 5.0 * (radiusVectorAU * planetCoordInfo.planetDistanceAU / (phase1).SquareRoot()).Log10() + planetInfo.v0_VisualMagnitude; + var approximateMagnitude1 = 5.0 * (radiusVectorAU * planetCoordInfo.planetDistanceAU / phase1.SquareRoot()).Log10() + planetInfo.v0_VisualMagnitude; var distanceAU = Math.Round(planetCoordInfo.planetDistanceAU, 5); var angDiaArcsec = Math.Round(angularDiameterArcsec, 1); diff --git a/PALib/PASun.cs b/PALib/PASun.cs index 5c11192..c05dd12 100644 --- a/PALib/PASun.cs +++ b/PALib/PASun.cs @@ -94,7 +94,7 @@ public class PASun /// public (double sunDistKm, double sunAngSizeDeg, double sunAngSizeMin, double sunAngSizeSec) SunDistanceAndAngularSize(double lctHours, double lctMinutes, double lctSeconds, double localDay, int localMonth, int localYear, bool isDaylightSaving, int zoneCorrection) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var gDay = PAMacros.LocalCivilTimeGreenwichDay(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); var gMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); @@ -128,7 +128,7 @@ public class PASun /// public (double localSunriseHour, double localSunriseMinute, double localSunsetHour, double localSunsetMinute, double azimuthOfSunriseDeg, double azimuthOfSunsetDeg, string status) SunriseAndSunset(double localDay, int localMonth, int localYear, bool isDaylightSaving, int zoneCorrection, double geographicalLongDeg, double geographicalLatDeg) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var localSunriseHours = PAMacros.SunriseLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); var localSunsetHours = PAMacros.SunsetLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); @@ -141,14 +141,14 @@ public class PASun var azimuthOfSunriseDeg1 = PAMacros.SunriseAZ(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); var azimuthOfSunsetDeg1 = PAMacros.SunsetAZ(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); - var localSunriseHour = (sunRiseSetStatus.Equals("OK")) ? PAMacros.DecimalHoursHour(adjustedSunriseHours) : 0; - var localSunriseMinute = (sunRiseSetStatus.Equals("OK")) ? PAMacros.DecimalHoursMinute(adjustedSunriseHours) : 0; + var localSunriseHour = sunRiseSetStatus.Equals("OK") ? PAMacros.DecimalHoursHour(adjustedSunriseHours) : 0; + var localSunriseMinute = sunRiseSetStatus.Equals("OK") ? PAMacros.DecimalHoursMinute(adjustedSunriseHours) : 0; - var localSunsetHour = (sunRiseSetStatus.Equals("OK")) ? PAMacros.DecimalHoursHour(adjustedSunsetHours) : 0; - var localSunsetMinute = (sunRiseSetStatus.Equals("OK")) ? PAMacros.DecimalHoursMinute(adjustedSunsetHours) : 0; + var localSunsetHour = sunRiseSetStatus.Equals("OK") ? PAMacros.DecimalHoursHour(adjustedSunsetHours) : 0; + var localSunsetMinute = sunRiseSetStatus.Equals("OK") ? PAMacros.DecimalHoursMinute(adjustedSunsetHours) : 0; - var azimuthOfSunriseDeg = (sunRiseSetStatus.Equals("OK")) ? Math.Round(azimuthOfSunriseDeg1, 2) : 0; - var azimuthOfSunsetDeg = (sunRiseSetStatus.Equals("OK")) ? Math.Round(azimuthOfSunsetDeg1, 2) : 0; + var azimuthOfSunriseDeg = sunRiseSetStatus.Equals("OK") ? Math.Round(azimuthOfSunriseDeg1, 2) : 0; + var azimuthOfSunsetDeg = sunRiseSetStatus.Equals("OK") ? Math.Round(azimuthOfSunsetDeg1, 2) : 0; var status = sunRiseSetStatus; @@ -175,7 +175,7 @@ public class PASun /// public (double amTwilightBeginsHour, double amTwilightBeginsMin, double pmTwilightEndsHour, double pmTwilightEndsMin, string status) MorningAndEveningTwilight(double localDay, int localMonth, int localYear, bool isDaylightSaving, int zoneCorrection, double geographicalLongDeg, double geographicalLatDeg, PATwilightType twilightType) { - var daylightSaving = (isDaylightSaving) ? 1 : 0; + var daylightSaving = isDaylightSaving ? 1 : 0; var startOfAMTwilightHours = PAMacros.TwilightAMLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg, twilightType); @@ -186,11 +186,11 @@ public class PASun var adjustedAMStartTime = startOfAMTwilightHours + 0.008333; var adjustedPMStartTime = endOfPMTwilightHours + 0.008333; - double amTwilightBeginsHour = (twilightStatus.Equals("OK")) ? PAMacros.DecimalHoursHour(adjustedAMStartTime) : -99; - double amTwilightBeginsMin = (twilightStatus.Equals("OK")) ? PAMacros.DecimalHoursMinute(adjustedAMStartTime) : -99; + double amTwilightBeginsHour = twilightStatus.Equals("OK") ? PAMacros.DecimalHoursHour(adjustedAMStartTime) : -99; + double amTwilightBeginsMin = twilightStatus.Equals("OK") ? PAMacros.DecimalHoursMinute(adjustedAMStartTime) : -99; - double pmTwilightEndsHour = (twilightStatus.Equals("OK")) ? PAMacros.DecimalHoursHour(adjustedPMStartTime) : -99; - double pmTwilightEndsMin = (twilightStatus.Equals("OK")) ? PAMacros.DecimalHoursMinute(adjustedPMStartTime) : -99; + double pmTwilightEndsHour = twilightStatus.Equals("OK") ? PAMacros.DecimalHoursHour(adjustedPMStartTime) : -99; + double pmTwilightEndsMin = twilightStatus.Equals("OK") ? PAMacros.DecimalHoursMinute(adjustedPMStartTime) : -99; var status = twilightStatus; From 058164b16964f34c5a7ee810ab069330a1dc53c9 Mon Sep 17 00:00:00 2001 From: Jim Carr Date: Sun, 28 Apr 2024 13:13:37 -0400 Subject: [PATCH 2/4] Explicit types --- PALib.Tests/PACoordinates.cs | 4 +- PALib/Data/BinaryData.cs | 2 +- PALib/Data/CometData.cs | 4 +- PALib/Data/PlanetData.cs | 2 +- PALib/PABinary.cs | 32 +- PALib/PAComet.cs | 122 +- PALib/PACoordinates.cs | 620 +++--- PALib/PADateTime.cs | 166 +- PALib/PAEclipses.cs | 180 +- PALib/PAMacros.cs | 3868 +++++++++++++++++----------------- PALib/PAMoon.cs | 278 +-- PALib/PAPlanet.cs | 172 +- PALib/PASun.cs | 178 +- 13 files changed, 2814 insertions(+), 2814 deletions(-) diff --git a/PALib.Tests/PACoordinates.cs b/PALib.Tests/PACoordinates.cs index b4b4391..996d5c5 100644 --- a/PALib.Tests/PACoordinates.cs +++ b/PALib.Tests/PACoordinates.cs @@ -99,7 +99,7 @@ public void CorrectForPrecession() [Fact] public void NutationInEclipticLongitudeAndObliquity() { - var result = _paCoordinates.NutationInEclipticLongitudeAndObliquity(1, 9, 1988); + (double nutInLongDeg, double nutInOblDeg) result = _paCoordinates.NutationInEclipticLongitudeAndObliquity(1, 9, 1988); Assert.Equal((0.001525808, 0.0025671), (Math.Round(result.nutInLongDeg, 9), Math.Round(result.nutInOblDeg, 7))); } @@ -119,7 +119,7 @@ public void AtmosphericRefraction() [Fact] public void CorrectionsForGeocentricParallax() { - var result = _paCoordinates.CorrectionsForGeocentricParallax(22, 35, 19, -7, 41, 13, PACoordinateType.True, 1.019167, -100, 50, 60, 0, -6, 26, 2, 1979, 10, 45, 0); + (double correctedRAHour, double correctedRAMin, double correctedRASec, double correctedDecDeg, double correctedDecMin, double correctedDecSec) result = _paCoordinates.CorrectionsForGeocentricParallax(22, 35, 19, -7, 41, 13, PACoordinateType.True, 1.019167, -100, 50, 60, 0, -6, 26, 2, 1979, 10, 45, 0); Assert.Equal((22, 36, 43.22, -8, 32, 17.4), result); } diff --git a/PALib/Data/BinaryData.cs b/PALib/Data/BinaryData.cs index 2f5900a..902ff17 100644 --- a/PALib/Data/BinaryData.cs +++ b/PALib/Data/BinaryData.cs @@ -169,7 +169,7 @@ static BinaryInfo() /// public static BinaryData GetBinaryInfo(string name) { - var returnValue = _binaryData + BinaryData returnValue = _binaryData .Where(x => x.Name == name) .Select(x => x) .FirstOrDefault(); diff --git a/PALib/Data/CometData.cs b/PALib/Data/CometData.cs index 3bb2cb5..0fef9f3 100644 --- a/PALib/Data/CometData.cs +++ b/PALib/Data/CometData.cs @@ -264,7 +264,7 @@ static CometInfoElliptical() /// public static CometDataElliptical GetCometEllipticalInfo(string name) { - var returnValue = _cometDataElliptical + CometDataElliptical returnValue = _cometDataElliptical .Where(x => x.Name == name) .Select(x => x) .FirstOrDefault(); @@ -301,7 +301,7 @@ static CometInfoParabolic() /// public static CometDataParabolic GetCometParabolicInfo(string name) { - var returnValue = _cometDataParabolic + CometDataParabolic returnValue = _cometDataParabolic .Where(x => x.Name == name) .Select(x => x) .FirstOrDefault(); diff --git a/PALib/Data/PlanetData.cs b/PALib/Data/PlanetData.cs index 3fdaa81..57deff5 100644 --- a/PALib/Data/PlanetData.cs +++ b/PALib/Data/PlanetData.cs @@ -270,7 +270,7 @@ static PlanetInfo() /// public static PlanetData GetPlanetInfo(string name) { - var returnValue = _planetData + PlanetData returnValue = _planetData .Where(x => x.Name == name) .Select(x => x) .FirstOrDefault(); diff --git a/PALib/PABinary.cs b/PALib/PABinary.cs index 0472a28..6dca3b7 100644 --- a/PALib/PABinary.cs +++ b/PALib/PABinary.cs @@ -18,25 +18,25 @@ public class PABinary /// public (double positionAngleDeg, double separationArcsec) BinaryStarOrbit(double greenwichDateDay, int greenwichDateMonth, int greenwichDateYear, string binaryName) { - var binaryInfo = BinaryInfo.GetBinaryInfo(binaryName); + BinaryData binaryInfo = BinaryInfo.GetBinaryInfo(binaryName); - var yYears = greenwichDateYear + (PAMacros.CivilDateToJulianDate(greenwichDateDay, greenwichDateMonth, greenwichDateYear) - PAMacros.CivilDateToJulianDate(0, 1, greenwichDateYear)) / 365.242191 - binaryInfo.EpochPeri; - var mDeg = 360 * yYears / binaryInfo.Period; - var mRad = (mDeg - 360 * (mDeg / 360).Floor()).ToRadians(); - var eccentricity = binaryInfo.Ecc; - var trueAnomalyRad = PAMacros.TrueAnomaly(mRad, eccentricity); - var rArcsec = (1 - eccentricity * PAMacros.EccentricAnomaly(mRad, eccentricity).Cosine()) * binaryInfo.Axis; - var taPeriRad = trueAnomalyRad + binaryInfo.LongPeri.ToRadians(); + double yYears = greenwichDateYear + (PAMacros.CivilDateToJulianDate(greenwichDateDay, greenwichDateMonth, greenwichDateYear) - PAMacros.CivilDateToJulianDate(0, 1, greenwichDateYear)) / 365.242191 - binaryInfo.EpochPeri; + double mDeg = 360 * yYears / binaryInfo.Period; + double mRad = (mDeg - 360 * (mDeg / 360).Floor()).ToRadians(); + double eccentricity = binaryInfo.Ecc; + double trueAnomalyRad = PAMacros.TrueAnomaly(mRad, eccentricity); + double rArcsec = (1 - eccentricity * PAMacros.EccentricAnomaly(mRad, eccentricity).Cosine()) * binaryInfo.Axis; + double taPeriRad = trueAnomalyRad + binaryInfo.LongPeri.ToRadians(); - var y = taPeriRad.Sine() * binaryInfo.Incl.ToRadians().Cosine(); - var x = taPeriRad.Cosine(); - var aDeg = PAMacros.Degrees(y.AngleTangent2(x)); - var thetaDeg1 = aDeg + binaryInfo.PANode; - var thetaDeg2 = thetaDeg1 - 360 * (thetaDeg1 / 360).Floor(); - var rhoArcsec = rArcsec * taPeriRad.Cosine() / (thetaDeg2 - binaryInfo.PANode).ToRadians().Cosine(); + double y = taPeriRad.Sine() * binaryInfo.Incl.ToRadians().Cosine(); + double x = taPeriRad.Cosine(); + double aDeg = PAMacros.Degrees(y.AngleTangent2(x)); + double thetaDeg1 = aDeg + binaryInfo.PANode; + double thetaDeg2 = thetaDeg1 - 360 * (thetaDeg1 / 360).Floor(); + double rhoArcsec = rArcsec * taPeriRad.Cosine() / (thetaDeg2 - binaryInfo.PANode).ToRadians().Cosine(); - var positionAngleDeg = Math.Round(thetaDeg2, 1); - var separationArcsec = Math.Round(rhoArcsec, 2); + double positionAngleDeg = Math.Round(thetaDeg2, 1); + double separationArcsec = Math.Round(rhoArcsec, 2); return (positionAngleDeg, separationArcsec); } diff --git a/PALib/PAComet.cs b/PALib/PAComet.cs index 2293866..6410e09 100644 --- a/PALib/PAComet.cs +++ b/PALib/PAComet.cs @@ -21,48 +21,48 @@ public class PAComet /// public (double cometRAHour, double cometRAMin, double cometDecDeg, double cometDecMin, double cometDistEarth) PositionOfEllipticalComet(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear, string cometName) { - var daylightSaving = isDaylightSaving ? 1 : 0; + int daylightSaving = isDaylightSaving ? 1 : 0; - var greenwichDateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var greenwichDateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var greenwichDateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double greenwichDateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int greenwichDateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int greenwichDateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var cometInfo = CometInfoElliptical.GetCometEllipticalInfo(cometName); + CometDataElliptical cometInfo = CometInfoElliptical.GetCometEllipticalInfo(cometName); - var timeSinceEpochYears = (PAMacros.CivilDateToJulianDate(greenwichDateDay, greenwichDateMonth, greenwichDateYear) - PAMacros.CivilDateToJulianDate(0.0, 1, greenwichDateYear)) / 365.242191 + greenwichDateYear - cometInfo.epoch_EpochOfPerihelion; - var mcDeg = 360 * timeSinceEpochYears / cometInfo.period_PeriodOfOrbit; - var mcRad = (mcDeg - 360 * (mcDeg / 360).Floor()).ToRadians(); - var eccentricity = cometInfo.ecc_EccentricityOfOrbit; - var trueAnomalyDeg = PAMacros.Degrees(PAMacros.TrueAnomaly(mcRad, eccentricity)); - var lcDeg = trueAnomalyDeg + cometInfo.peri_LongitudeOfPerihelion; - var rAU = cometInfo.axis_SemiMajorAxisOfOrbit * (1 - eccentricity * eccentricity) / (1 + eccentricity * trueAnomalyDeg.ToRadians().Cosine()); - var lcNodeRad = (lcDeg - cometInfo.node_LongitudeOfAscendingNode).ToRadians(); - var psiRad = (lcNodeRad.Sine() * cometInfo.incl_InclinationOfOrbit.ToRadians().Sine()).ASine(); + double timeSinceEpochYears = (PAMacros.CivilDateToJulianDate(greenwichDateDay, greenwichDateMonth, greenwichDateYear) - PAMacros.CivilDateToJulianDate(0.0, 1, greenwichDateYear)) / 365.242191 + greenwichDateYear - cometInfo.epoch_EpochOfPerihelion; + double mcDeg = 360 * timeSinceEpochYears / cometInfo.period_PeriodOfOrbit; + double mcRad = (mcDeg - 360 * (mcDeg / 360).Floor()).ToRadians(); + double eccentricity = cometInfo.ecc_EccentricityOfOrbit; + double trueAnomalyDeg = PAMacros.Degrees(PAMacros.TrueAnomaly(mcRad, eccentricity)); + double lcDeg = trueAnomalyDeg + cometInfo.peri_LongitudeOfPerihelion; + double rAU = cometInfo.axis_SemiMajorAxisOfOrbit * (1 - eccentricity * eccentricity) / (1 + eccentricity * trueAnomalyDeg.ToRadians().Cosine()); + double lcNodeRad = (lcDeg - cometInfo.node_LongitudeOfAscendingNode).ToRadians(); + double psiRad = (lcNodeRad.Sine() * cometInfo.incl_InclinationOfOrbit.ToRadians().Sine()).ASine(); - var y = lcNodeRad.Sine() * cometInfo.incl_InclinationOfOrbit.ToRadians().Cosine(); - var x = lcNodeRad.Cosine(); + double y = lcNodeRad.Sine() * cometInfo.incl_InclinationOfOrbit.ToRadians().Cosine(); + double x = lcNodeRad.Cosine(); - var ldDeg = PAMacros.Degrees(y.AngleTangent2(x)) + cometInfo.node_LongitudeOfAscendingNode; - var rdAU = rAU * psiRad.Cosine(); + double ldDeg = PAMacros.Degrees(y.AngleTangent2(x)) + cometInfo.node_LongitudeOfAscendingNode; + double rdAU = rAU * psiRad.Cosine(); - var earthLongitudeLeDeg = PAMacros.SunLong(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear) + 180.0; - var earthRadiusVectorAU = PAMacros.SunDist(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double earthLongitudeLeDeg = PAMacros.SunLong(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear) + 180.0; + double earthRadiusVectorAU = PAMacros.SunDist(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var leLdRad = (earthLongitudeLeDeg - ldDeg).ToRadians(); - var aRad = (rdAU < earthRadiusVectorAU) ? (rdAU * leLdRad.Sine()).AngleTangent2(earthRadiusVectorAU - rdAU * leLdRad.Cosine()) : (earthRadiusVectorAU * (-leLdRad).Sine()).AngleTangent2(rdAU - earthRadiusVectorAU * leLdRad.Cosine()); + double leLdRad = (earthLongitudeLeDeg - ldDeg).ToRadians(); + double aRad = (rdAU < earthRadiusVectorAU) ? (rdAU * leLdRad.Sine()).AngleTangent2(earthRadiusVectorAU - rdAU * leLdRad.Cosine()) : (earthRadiusVectorAU * (-leLdRad).Sine()).AngleTangent2(rdAU - earthRadiusVectorAU * leLdRad.Cosine()); - var cometLongDeg1 = (rdAU < earthRadiusVectorAU) ? 180.0 + earthLongitudeLeDeg + PAMacros.Degrees(aRad) : PAMacros.Degrees(aRad) + ldDeg; - var cometLongDeg = cometLongDeg1 - 360 * (cometLongDeg1 / 360).Floor(); - var cometLatDeg = PAMacros.Degrees((rdAU * psiRad.Tangent() * (cometLongDeg1 - ldDeg).ToRadians().Sine() / (earthRadiusVectorAU * (-leLdRad).Sine())).AngleTangent()); - var cometRAHours1 = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(cometLongDeg, 0, 0, cometLatDeg, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear)); - var cometDecDeg1 = PAMacros.EcDec(cometLongDeg, 0, 0, cometLatDeg, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear); - var cometDistanceAU = (Math.Pow(earthRadiusVectorAU, 2) + Math.Pow(rAU, 2) - 2.0 * earthRadiusVectorAU * rAU * (lcDeg - earthLongitudeLeDeg).ToRadians().Cosine() * psiRad.Cosine()).SquareRoot(); + double cometLongDeg1 = (rdAU < earthRadiusVectorAU) ? 180.0 + earthLongitudeLeDeg + PAMacros.Degrees(aRad) : PAMacros.Degrees(aRad) + ldDeg; + double cometLongDeg = cometLongDeg1 - 360 * (cometLongDeg1 / 360).Floor(); + double cometLatDeg = PAMacros.Degrees((rdAU * psiRad.Tangent() * (cometLongDeg1 - ldDeg).ToRadians().Sine() / (earthRadiusVectorAU * (-leLdRad).Sine())).AngleTangent()); + double cometRAHours1 = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(cometLongDeg, 0, 0, cometLatDeg, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear)); + double cometDecDeg1 = PAMacros.EcDec(cometLongDeg, 0, 0, cometLatDeg, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear); + double cometDistanceAU = (Math.Pow(earthRadiusVectorAU, 2) + Math.Pow(rAU, 2) - 2.0 * earthRadiusVectorAU * rAU * (lcDeg - earthLongitudeLeDeg).ToRadians().Cosine() * psiRad.Cosine()).SquareRoot(); - var cometRAHour = PAMacros.DecimalHoursHour(cometRAHours1 + 0.008333); - var cometRAMin = PAMacros.DecimalHoursMinute(cometRAHours1 + 0.008333); - var cometDecDeg = PAMacros.DecimalDegreesDegrees(cometDecDeg1 + 0.008333); - var cometDecMin = PAMacros.DecimalDegreesMinutes(cometDecDeg1 + 0.008333); - var cometDistEarth = Math.Round(cometDistanceAU, 2); + int cometRAHour = PAMacros.DecimalHoursHour(cometRAHours1 + 0.008333); + int cometRAMin = PAMacros.DecimalHoursMinute(cometRAHours1 + 0.008333); + double cometDecDeg = PAMacros.DecimalDegreesDegrees(cometDecDeg1 + 0.008333); + double cometDecMin = PAMacros.DecimalDegreesMinutes(cometDecDeg1 + 0.008333); + double cometDistEarth = Math.Round(cometDistanceAU, 2); return (cometRAHour, cometRAMin, cometDecDeg, cometDecMin, cometDistEarth); } @@ -82,34 +82,34 @@ public class PAComet /// public (double cometRAHour, double cometRAMin, double cometRASec, double cometDecDeg, double cometDecMin, double cometDecSec, double cometDistEarth) PositionOfParabolicComet(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear, string cometName) { - var daylightSaving = isDaylightSaving ? 1 : 0; - - var greenwichDateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var greenwichDateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var greenwichDateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - - var cometInfo = CometInfoParabolic.GetCometParabolicInfo(cometName); - - var perihelionEpochDay = cometInfo.EpochPeriDay; - var perihelionEpochMonth = cometInfo.EpochPeriMonth; - var perihelionEpochYear = cometInfo.EpochPeriYear; - var qAU = cometInfo.PeriDist; - var inclinationDeg = cometInfo.Incl; - var perihelionDeg = cometInfo.ArgPeri; - var nodeDeg = cometInfo.Node; - - var cometLongLatDist = PAMacros.PCometLongLatDist(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear, perihelionEpochDay, perihelionEpochMonth, perihelionEpochYear, qAU, inclinationDeg, perihelionDeg, nodeDeg); - - var cometRAHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(cometLongLatDist.cometLongDeg, 0, 0, cometLongLatDist.cometLatDeg, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear)); - var cometDecDeg1 = PAMacros.EcDec(cometLongLatDist.cometLongDeg, 0, 0, cometLongLatDist.cometLatDeg, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear); - - var cometRAHour = PAMacros.DecimalHoursHour(cometRAHours); - var cometRAMin = PAMacros.DecimalHoursMinute(cometRAHours); - var cometRASec = PAMacros.DecimalHoursSecond(cometRAHours); - var cometDecDeg = PAMacros.DecimalDegreesDegrees(cometDecDeg1); - var cometDecMin = PAMacros.DecimalDegreesMinutes(cometDecDeg1); - var cometDecSec = PAMacros.DecimalDegreesSeconds(cometDecDeg1); - var cometDistEarth = Math.Round(cometLongLatDist.cometDistAU, 2); + int daylightSaving = isDaylightSaving ? 1 : 0; + + double greenwichDateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int greenwichDateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int greenwichDateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + + CometDataParabolic cometInfo = CometInfoParabolic.GetCometParabolicInfo(cometName); + + double perihelionEpochDay = cometInfo.EpochPeriDay; + int perihelionEpochMonth = cometInfo.EpochPeriMonth; + int perihelionEpochYear = cometInfo.EpochPeriYear; + double qAU = cometInfo.PeriDist; + double inclinationDeg = cometInfo.Incl; + double perihelionDeg = cometInfo.ArgPeri; + double nodeDeg = cometInfo.Node; + + (double cometLongDeg, double cometLatDeg, double cometDistAU) cometLongLatDist = PAMacros.PCometLongLatDist(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear, perihelionEpochDay, perihelionEpochMonth, perihelionEpochYear, qAU, inclinationDeg, perihelionDeg, nodeDeg); + + double cometRAHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(cometLongLatDist.cometLongDeg, 0, 0, cometLongLatDist.cometLatDeg, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear)); + double cometDecDeg1 = PAMacros.EcDec(cometLongLatDist.cometLongDeg, 0, 0, cometLongLatDist.cometLatDeg, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear); + + int cometRAHour = PAMacros.DecimalHoursHour(cometRAHours); + int cometRAMin = PAMacros.DecimalHoursMinute(cometRAHours); + double cometRASec = PAMacros.DecimalHoursSecond(cometRAHours); + double cometDecDeg = PAMacros.DecimalDegreesDegrees(cometDecDeg1); + double cometDecMin = PAMacros.DecimalDegreesMinutes(cometDecDeg1); + double cometDecSec = PAMacros.DecimalDegreesSeconds(cometDecDeg1); + double cometDistEarth = Math.Round(cometLongLatDist.cometDistAU, 2); return (cometRAHour, cometRAMin, cometRASec, cometDecDeg, cometDecMin, cometDecSec, cometDistEarth); } diff --git a/PALib/PACoordinates.cs b/PALib/PACoordinates.cs index bfe132a..0b54469 100644 --- a/PALib/PACoordinates.cs +++ b/PALib/PACoordinates.cs @@ -14,10 +14,10 @@ public class PACoordinates /// Decimal Degrees (double) public double AngleToDecimalDegrees(double degrees, double minutes, double seconds) { - var a = Math.Abs(seconds) / 60; - var b = (Math.Abs(minutes) + a) / 60; - var c = Math.Abs(degrees) + b; - var d = (degrees < 0 || minutes < 0 || seconds < 0) ? -c : c; + double a = Math.Abs(seconds) / 60; + double b = (Math.Abs(minutes) + a) / 60; + double c = Math.Abs(degrees) + b; + double d = (degrees < 0 || minutes < 0 || seconds < 0) ? -c : c; return d; } @@ -28,14 +28,14 @@ public double AngleToDecimalDegrees(double degrees, double minutes, double secon /// Tuple (degrees, minutes, seconds) public (double degrees, double minutes, double seconds) DecimalDegreesToAngle(double decimalDegrees) { - var unsignedDecimal = Math.Abs(decimalDegrees); - var totalSeconds = unsignedDecimal * 3600; - var seconds2DP = Math.Round(totalSeconds % 60, 2); - var correctedSeconds = (seconds2DP == 60) ? 0 : seconds2DP; - var correctedRemainder = (seconds2DP == 60) ? totalSeconds + 60 : totalSeconds; - var minutes = (correctedRemainder / 60).Floor() % 60; - var unsignedDegrees = (correctedRemainder / 3600).Floor(); - var signedDegrees = (decimalDegrees < 0) ? -1 * unsignedDegrees : unsignedDegrees; + double unsignedDecimal = Math.Abs(decimalDegrees); + double totalSeconds = unsignedDecimal * 3600; + double seconds2DP = Math.Round(totalSeconds % 60, 2); + double correctedSeconds = (seconds2DP == 60) ? 0 : seconds2DP; + double correctedRemainder = (seconds2DP == 60) ? totalSeconds + 60 : totalSeconds; + double minutes = (correctedRemainder / 60).Floor() % 60; + double unsignedDegrees = (correctedRemainder / 3600).Floor(); + double signedDegrees = (decimalDegrees < 0) ? -1 * unsignedDegrees : unsignedDegrees; return (signedDegrees, minutes, correctedSeconds.Floor()); } @@ -46,13 +46,13 @@ public double AngleToDecimalDegrees(double degrees, double minutes, double secon /// Tuple (hourAngleHours, hourAngleMinutes, hourAngleSeconds) public (double hourAngleHours, double hourAngleMinutes, double hourAngleSeconds) RightAscensionToHourAngle(double raHours, double raMinutes, double raSeconds, double lctHours, double lctMinutes, double lctSeconds, bool isDaylightSavings, int zoneCorrection, double localDay, int localMonth, int localYear, double geographicalLongitude) { - var daylightSaving = isDaylightSavings ? 1 : 0; + int daylightSaving = isDaylightSavings ? 1 : 0; - var hourAngle = PAMacros.RightAscensionToHourAngle(raHours, raMinutes, raSeconds, lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear, geographicalLongitude); + double hourAngle = PAMacros.RightAscensionToHourAngle(raHours, raMinutes, raSeconds, lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear, geographicalLongitude); - var hourAngleHours = PAMacros.DecimalHoursHour(hourAngle); - var hourAngleMinutes = PAMacros.DecimalHoursMinute(hourAngle); - var hourAngleSeconds = PAMacros.DecimalHoursSecond(hourAngle); + int hourAngleHours = PAMacros.DecimalHoursHour(hourAngle); + int hourAngleMinutes = PAMacros.DecimalHoursMinute(hourAngle); + double hourAngleSeconds = PAMacros.DecimalHoursSecond(hourAngle); return (hourAngleHours, hourAngleMinutes, hourAngleSeconds); } @@ -63,13 +63,13 @@ public double AngleToDecimalDegrees(double degrees, double minutes, double secon /// Tuple (rightAscensionHours, rightAscensionMinutes, rightAscensionSeconds) public (double raHours, double raMinutes, double raSeconds) HourAngleToRightAscension(double hourAngleHours, double hourAngleMinutes, double hourAngleSeconds, double lctHours, double lctMinutes, double lctSeconds, bool isDaylightSaving, int zoneCorrection, double localDay, int localMonth, int localYear, double geographicalLongitude) { - var daylightSaving = isDaylightSaving ? 1 : 0; + int daylightSaving = isDaylightSaving ? 1 : 0; - var rightAscension = PAMacros.HourAngleToRightAscension(hourAngleHours, hourAngleMinutes, hourAngleSeconds, lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear, geographicalLongitude); + double rightAscension = PAMacros.HourAngleToRightAscension(hourAngleHours, hourAngleMinutes, hourAngleSeconds, lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear, geographicalLongitude); - var rightAscensionHours = PAMacros.DecimalHoursHour(rightAscension); - var rightAscensionMinutes = PAMacros.DecimalHoursMinute(rightAscension); - var rightAscensionSeconds = PAMacros.DecimalHoursSecond(rightAscension); + int rightAscensionHours = PAMacros.DecimalHoursHour(rightAscension); + int rightAscensionMinutes = PAMacros.DecimalHoursMinute(rightAscension); + double rightAscensionSeconds = PAMacros.DecimalHoursSecond(rightAscension); return (rightAscensionHours, rightAscensionMinutes, rightAscensionSeconds); } @@ -80,17 +80,17 @@ public double AngleToDecimalDegrees(double degrees, double minutes, double secon /// Tuple (azimuthDegrees, azimuthMinutes, azimuthSeconds, altitudeDegrees, altitudeMinutes, altitudeSeconds) public (double azimuthDegrees, double azimuthMinutes, double azimuthSeconds, double altitudeDegrees, double altitudeMinutes, double altitudeSeconds) EquatorialCoordinatesToHorizonCoordinates(double hourAngleHours, double hourAngleMinutes, double hourAngleSeconds, double declinationDegrees, double declinationMinutes, double declinationSeconds, double geographicalLatitude) { - var azimuthInDecimalDegrees = PAMacros.EquatorialCoordinatesToAzimuth(hourAngleHours, hourAngleMinutes, hourAngleSeconds, declinationDegrees, declinationMinutes, declinationSeconds, geographicalLatitude); + double azimuthInDecimalDegrees = PAMacros.EquatorialCoordinatesToAzimuth(hourAngleHours, hourAngleMinutes, hourAngleSeconds, declinationDegrees, declinationMinutes, declinationSeconds, geographicalLatitude); - var altitudeInDecimalDegrees = PAMacros.EquatorialCoordinatesToAltitude(hourAngleHours, hourAngleMinutes, hourAngleSeconds, declinationDegrees, declinationMinutes, declinationSeconds, geographicalLatitude); + double altitudeInDecimalDegrees = PAMacros.EquatorialCoordinatesToAltitude(hourAngleHours, hourAngleMinutes, hourAngleSeconds, declinationDegrees, declinationMinutes, declinationSeconds, geographicalLatitude); - var azimuthDegrees = PAMacros.DecimalDegreesDegrees(azimuthInDecimalDegrees); - var azimuthMinutes = PAMacros.DecimalDegreesMinutes(azimuthInDecimalDegrees); - var azimuthSeconds = PAMacros.DecimalDegreesSeconds(azimuthInDecimalDegrees); + double azimuthDegrees = PAMacros.DecimalDegreesDegrees(azimuthInDecimalDegrees); + double azimuthMinutes = PAMacros.DecimalDegreesMinutes(azimuthInDecimalDegrees); + double azimuthSeconds = PAMacros.DecimalDegreesSeconds(azimuthInDecimalDegrees); - var altitudeDegrees = PAMacros.DecimalDegreesDegrees(altitudeInDecimalDegrees); - var altitudeMinutes = PAMacros.DecimalDegreesMinutes(altitudeInDecimalDegrees); - var altitudeSeconds = PAMacros.DecimalDegreesSeconds(altitudeInDecimalDegrees); + double altitudeDegrees = PAMacros.DecimalDegreesDegrees(altitudeInDecimalDegrees); + double altitudeMinutes = PAMacros.DecimalDegreesMinutes(altitudeInDecimalDegrees); + double altitudeSeconds = PAMacros.DecimalDegreesSeconds(altitudeInDecimalDegrees); return (azimuthDegrees, azimuthMinutes, azimuthSeconds, altitudeDegrees, altitudeMinutes, altitudeSeconds); } @@ -101,17 +101,17 @@ public double AngleToDecimalDegrees(double degrees, double minutes, double secon /// Tuple (hourAngleHours, hourAngleMinutes, hourAngleSeconds, declinationDegrees, declinationMinutes, declinationSeconds) public (double hour_angle_hours, double hour_angle_minutes, double hour_angle_seconds, double declination_degrees, double declination_minutes, double declinationseconds) HorizonCoordinatesToEquatorialCoordinates(double azimuthDegrees, double azimuthMinutes, double azimuthSeconds, double altitudeDegrees, double altitudeMinutes, double altitudeSeconds, double geographicalLatitude) { - var hourAngleInDecimalDegrees = PAMacros.HorizonCoordinatesToHourAngle(azimuthDegrees, azimuthMinutes, azimuthSeconds, altitudeDegrees, altitudeMinutes, altitudeSeconds, geographicalLatitude); + double hourAngleInDecimalDegrees = PAMacros.HorizonCoordinatesToHourAngle(azimuthDegrees, azimuthMinutes, azimuthSeconds, altitudeDegrees, altitudeMinutes, altitudeSeconds, geographicalLatitude); - var declinationInDecimalDegrees = PAMacros.HorizonCoordinatesToDeclination(azimuthDegrees, azimuthMinutes, azimuthSeconds, altitudeDegrees, altitudeMinutes, altitudeSeconds, geographicalLatitude); + double declinationInDecimalDegrees = PAMacros.HorizonCoordinatesToDeclination(azimuthDegrees, azimuthMinutes, azimuthSeconds, altitudeDegrees, altitudeMinutes, altitudeSeconds, geographicalLatitude); - var hourAngleHours = PAMacros.DecimalHoursHour(hourAngleInDecimalDegrees); - var hourAngleMinutes = PAMacros.DecimalHoursMinute(hourAngleInDecimalDegrees); - var hourAngleSeconds = PAMacros.DecimalHoursSecond(hourAngleInDecimalDegrees); + int hourAngleHours = PAMacros.DecimalHoursHour(hourAngleInDecimalDegrees); + int hourAngleMinutes = PAMacros.DecimalHoursMinute(hourAngleInDecimalDegrees); + double hourAngleSeconds = PAMacros.DecimalHoursSecond(hourAngleInDecimalDegrees); - var declinationDegrees = PAMacros.DecimalDegreesDegrees(declinationInDecimalDegrees); - var declinationMinutes = PAMacros.DecimalDegreesMinutes(declinationInDecimalDegrees); - var declinationSeconds = PAMacros.DecimalDegreesSeconds(declinationInDecimalDegrees); + double declinationDegrees = PAMacros.DecimalDegreesDegrees(declinationInDecimalDegrees); + double declinationMinutes = PAMacros.DecimalDegreesMinutes(declinationInDecimalDegrees); + double declinationSeconds = PAMacros.DecimalDegreesSeconds(declinationInDecimalDegrees); return (hourAngleHours, hourAngleMinutes, hourAngleSeconds, declinationDegrees, declinationMinutes, declinationSeconds); } @@ -121,11 +121,11 @@ public double AngleToDecimalDegrees(double degrees, double minutes, double secon /// public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth, int greenwichYear) { - var jd = PAMacros.CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear); - var mjd = jd - 2451545; - var t = mjd / 36525; - var de1 = t * (46.815 + t * (0.0006 - (t * 0.00181))); - var de2 = de1 / 3600; + double jd = PAMacros.CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear); + double mjd = jd - 2451545; + double t = mjd / 36525; + double de1 = t * (46.815 + t * (0.0006 - (t * 0.00181))); + double de2 = de1 / 3600; return 23.439292 - de2; } @@ -136,28 +136,28 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// Tuple (outRAHours, outRAMinutes, outRASeconds, outDecDegrees, outDecMinutes, outDecSeconds) public (double outRAHours, double outRAMinutes, double outRASeconds, double outDecDegrees, double outDecMinutes, double outDecSeconds) EclipticCoordinateToEquatorialCoordinate(double eclipticLongitudeDegrees, double eclipticLongitudeMinutes, double eclipticLongitudeSeconds, double eclipticLatitudeDegrees, double eclipticLatitudeMinutes, double eclipticLatitudeSeconds, double greenwichDay, int greenwichMonth, int greenwichYear) { - var eclonDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(eclipticLongitudeDegrees, eclipticLongitudeMinutes, eclipticLongitudeSeconds); - var eclatDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(eclipticLatitudeDegrees, eclipticLatitudeMinutes, eclipticLatitudeSeconds); - var eclonRad = eclonDeg.ToRadians(); - var eclatRad = eclatDeg.ToRadians(); - var obliqDeg = PAMacros.Obliq(greenwichDay, greenwichMonth, greenwichYear); - var obliqRad = obliqDeg.ToRadians(); - var sinDec = eclatRad.Sine() * obliqRad.Cosine() + eclatRad.Cosine() * obliqRad.Sine() * eclonRad.Sine(); - var decRad = sinDec.ASine(); - var decDeg = PAMacros.Degrees(decRad); - var y = eclonRad.Sine() * obliqRad.Cosine() - eclatRad.Tangent() * obliqRad.Sine(); - var x = eclonRad.Cosine(); - var raRad = y.AngleTangent2(x); - var raDeg1 = PAMacros.Degrees(raRad); - var raDeg2 = raDeg1 - 360 * (raDeg1 / 360).Floor(); - var raHours = PAMacros.DecimalDegreesToDegreeHours(raDeg2); - - var outRAHours = PAMacros.DecimalHoursHour(raHours); - var outRAMinutes = PAMacros.DecimalHoursMinute(raHours); - var outRASeconds = PAMacros.DecimalHoursSecond(raHours); - var outDecDegrees = PAMacros.DecimalDegreesDegrees(decDeg); - var outDecMinutes = PAMacros.DecimalDegreesMinutes(decDeg); - var outDecSeconds = PAMacros.DecimalDegreesSeconds(decDeg); + double eclonDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(eclipticLongitudeDegrees, eclipticLongitudeMinutes, eclipticLongitudeSeconds); + double eclatDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(eclipticLatitudeDegrees, eclipticLatitudeMinutes, eclipticLatitudeSeconds); + double eclonRad = eclonDeg.ToRadians(); + double eclatRad = eclatDeg.ToRadians(); + double obliqDeg = PAMacros.Obliq(greenwichDay, greenwichMonth, greenwichYear); + double obliqRad = obliqDeg.ToRadians(); + double sinDec = eclatRad.Sine() * obliqRad.Cosine() + eclatRad.Cosine() * obliqRad.Sine() * eclonRad.Sine(); + double decRad = sinDec.ASine(); + double decDeg = PAMacros.Degrees(decRad); + double y = eclonRad.Sine() * obliqRad.Cosine() - eclatRad.Tangent() * obliqRad.Sine(); + double x = eclonRad.Cosine(); + double raRad = y.AngleTangent2(x); + double raDeg1 = PAMacros.Degrees(raRad); + double raDeg2 = raDeg1 - 360 * (raDeg1 / 360).Floor(); + double raHours = PAMacros.DecimalDegreesToDegreeHours(raDeg2); + + int outRAHours = PAMacros.DecimalHoursHour(raHours); + int outRAMinutes = PAMacros.DecimalHoursMinute(raHours); + double outRASeconds = PAMacros.DecimalHoursSecond(raHours); + double outDecDegrees = PAMacros.DecimalDegreesDegrees(decDeg); + double outDecMinutes = PAMacros.DecimalDegreesMinutes(decDeg); + double outDecSeconds = PAMacros.DecimalDegreesSeconds(decDeg); return (outRAHours, outRAMinutes, outRASeconds, outDecDegrees, outDecMinutes, outDecSeconds); } @@ -168,27 +168,27 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// Tuple (outEclLongDeg, outEclLongMin, outEclLongSec, outEclLatDeg, outEclLatMin, outEclLatSec) public (double outEclLongDeg, double outEclLongMin, double outEclLongSec, double outEclLatDeg, double outEclLatMin, double outEclLatSec) EquatorialCoordinateToEclipticCoordinate(double raHours, double raMinutes, double raSeconds, double decDegrees, double decMinutes, double decSeconds, double gwDay, int gwMonth, int gwYear) { - var raDeg = PAMacros.DegreeHoursToDecimalDegrees(PAMacros.HMStoDH(raHours, raMinutes, raSeconds)); - var decDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDegrees, decMinutes, decSeconds); - var raRad = raDeg.ToRadians(); - var decRad = decDeg.ToRadians(); - var obliqDeg = PAMacros.Obliq(gwDay, gwMonth, gwYear); - var obliqRad = obliqDeg.ToRadians(); - var sinEclLat = decRad.Sine() * obliqRad.Cosine() - decRad.Cosine() * obliqRad.Sine() * raRad.Sine(); - var eclLatRad = sinEclLat.ASine(); - var eclLatDeg = PAMacros.Degrees(eclLatRad); - var y = raRad.Sine() * obliqRad.Cosine() + decRad.Tangent() * obliqRad.Sine(); - var x = raRad.Cosine(); - var eclLongRad = y.AngleTangent2(x); - var eclLongDeg1 = PAMacros.Degrees(eclLongRad); - var eclLongDeg2 = eclLongDeg1 - 360 * (eclLongDeg1 / 360).Floor(); - - var outEclLongDeg = PAMacros.DecimalDegreesDegrees(eclLongDeg2); - var outEclLongMin = PAMacros.DecimalDegreesMinutes(eclLongDeg2); - var outEclLongSec = PAMacros.DecimalDegreesSeconds(eclLongDeg2); - var outEclLatDeg = PAMacros.DecimalDegreesDegrees(eclLatDeg); - var outEclLatMin = PAMacros.DecimalDegreesMinutes(eclLatDeg); - var outEclLatSec = PAMacros.DecimalDegreesSeconds(eclLatDeg); + double raDeg = PAMacros.DegreeHoursToDecimalDegrees(PAMacros.HMStoDH(raHours, raMinutes, raSeconds)); + double decDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDegrees, decMinutes, decSeconds); + double raRad = raDeg.ToRadians(); + double decRad = decDeg.ToRadians(); + double obliqDeg = PAMacros.Obliq(gwDay, gwMonth, gwYear); + double obliqRad = obliqDeg.ToRadians(); + double sinEclLat = decRad.Sine() * obliqRad.Cosine() - decRad.Cosine() * obliqRad.Sine() * raRad.Sine(); + double eclLatRad = sinEclLat.ASine(); + double eclLatDeg = PAMacros.Degrees(eclLatRad); + double y = raRad.Sine() * obliqRad.Cosine() + decRad.Tangent() * obliqRad.Sine(); + double x = raRad.Cosine(); + double eclLongRad = y.AngleTangent2(x); + double eclLongDeg1 = PAMacros.Degrees(eclLongRad); + double eclLongDeg2 = eclLongDeg1 - 360 * (eclLongDeg1 / 360).Floor(); + + double outEclLongDeg = PAMacros.DecimalDegreesDegrees(eclLongDeg2); + double outEclLongMin = PAMacros.DecimalDegreesMinutes(eclLongDeg2); + double outEclLongSec = PAMacros.DecimalDegreesSeconds(eclLongDeg2); + double outEclLatDeg = PAMacros.DecimalDegreesDegrees(eclLatDeg); + double outEclLatMin = PAMacros.DecimalDegreesMinutes(eclLatDeg); + double outEclLatSec = PAMacros.DecimalDegreesSeconds(eclLatDeg); return (outEclLongDeg, outEclLongMin, outEclLongSec, outEclLatDeg, outEclLatMin, outEclLatSec); } @@ -199,24 +199,24 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// Tuple (galLongDeg, galLongMin, galLongSec, galLatDeg, galLatMin, galLatSec) public (double galLongDeg, double galLongMin, double galLongSec, double galLatDeg, double galLatMin, double galLatSec) EquatorialCoordinateToGalacticCoordinate(double raHours, double raMinutes, double raSeconds, double decDegrees, double decMinutes, double decSeconds) { - var raDeg = PAMacros.DegreeHoursToDecimalDegrees(PAMacros.HMStoDH(raHours, raMinutes, raSeconds)); - var decDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDegrees, decMinutes, decSeconds); - var raRad = raDeg.ToRadians(); - var decRad = decDeg.ToRadians(); - var sinB = decRad.Cosine() * 27.4.ToRadians().Cosine() * (raRad - 192.25.ToRadians()).Cosine() + decRad.Sine() * 27.4.ToRadians().Sine(); - var bRadians = sinB.ASine(); - var bDeg = PAMacros.Degrees(bRadians); - var y = decRad.Sine() - sinB * 27.4.ToRadians().Sine(); - var x = decRad.Cosine() * (raRad - 192.25.ToRadians()).Sine() * 27.4.ToRadians().Cosine(); - var longDeg1 = PAMacros.Degrees(y.AngleTangent2(x)) + 33; - var longDeg2 = longDeg1 - 360 * (longDeg1 / 360).Floor(); - - var galLongDeg = PAMacros.DecimalDegreesDegrees(longDeg2); - var galLongMin = PAMacros.DecimalDegreesMinutes(longDeg2); - var galLongSec = PAMacros.DecimalDegreesSeconds(longDeg2); - var galLatDeg = PAMacros.DecimalDegreesDegrees(bDeg); - var galLatMin = PAMacros.DecimalDegreesMinutes(bDeg); - var galLatSec = PAMacros.DecimalDegreesSeconds(bDeg); + double raDeg = PAMacros.DegreeHoursToDecimalDegrees(PAMacros.HMStoDH(raHours, raMinutes, raSeconds)); + double decDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDegrees, decMinutes, decSeconds); + double raRad = raDeg.ToRadians(); + double decRad = decDeg.ToRadians(); + double sinB = decRad.Cosine() * 27.4.ToRadians().Cosine() * (raRad - 192.25.ToRadians()).Cosine() + decRad.Sine() * 27.4.ToRadians().Sine(); + double bRadians = sinB.ASine(); + double bDeg = PAMacros.Degrees(bRadians); + double y = decRad.Sine() - sinB * 27.4.ToRadians().Sine(); + double x = decRad.Cosine() * (raRad - 192.25.ToRadians()).Sine() * 27.4.ToRadians().Cosine(); + double longDeg1 = PAMacros.Degrees(y.AngleTangent2(x)) + 33; + double longDeg2 = longDeg1 - 360 * (longDeg1 / 360).Floor(); + + double galLongDeg = PAMacros.DecimalDegreesDegrees(longDeg2); + double galLongMin = PAMacros.DecimalDegreesMinutes(longDeg2); + double galLongSec = PAMacros.DecimalDegreesSeconds(longDeg2); + double galLatDeg = PAMacros.DecimalDegreesDegrees(bDeg); + double galLatMin = PAMacros.DecimalDegreesMinutes(bDeg); + double galLatSec = PAMacros.DecimalDegreesSeconds(bDeg); return (galLongDeg, galLongMin, galLongSec, galLatDeg, galLatMin, galLatSec); } @@ -227,26 +227,26 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// Tuple (raHours, raMinutes, raSeconds, decDegrees, decMinutes, decSeconds) public (double raHours, double raMinutes, double raSeconds, double decDegrees, double decMinutes, double decSeconds) GalacticCoordinateToEquatorialCoordinate(double galLongDeg, double galLongMin, double galLongSec, double galLatDeg, double galLatMin, double galLatSec) { - var glongDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(galLongDeg, galLongMin, galLongSec); - var glatDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(galLatDeg, galLatMin, galLatSec); - var glongRad = glongDeg.ToRadians(); - var glatRad = glatDeg.ToRadians(); - var sinDec = glatRad.Cosine() * 27.4.ToRadians().Cosine() * (glongRad - 33.0.ToRadians()).Sine() + glatRad.Sine() * 27.4.ToRadians().Sine(); - var decRadians = sinDec.ASine(); - var decDeg = PAMacros.Degrees(decRadians); - var y = glatRad.Cosine() * (glongRad - 33.0.ToRadians()).Cosine(); - var x = glatRad.Sine() * 27.4.ToRadians().Cosine() - glatRad.Cosine() * 27.4.ToRadians().Sine() * (glongRad - 33.0.ToRadians()).Sine(); - - var raDeg1 = PAMacros.Degrees(y.AngleTangent2(x)) + 192.25; - var raDeg2 = raDeg1 - 360 * (raDeg1 / 360).Floor(); - var raHours1 = PAMacros.DecimalDegreesToDegreeHours(raDeg2); - - var raHours = PAMacros.DecimalHoursHour(raHours1); - var raMinutes = PAMacros.DecimalHoursMinute(raHours1); - var raSeconds = PAMacros.DecimalHoursSecond(raHours1); - var decDegrees = PAMacros.DecimalDegreesDegrees(decDeg); - var decMinutes = PAMacros.DecimalDegreesMinutes(decDeg); - var decSeconds = PAMacros.DecimalDegreesSeconds(decDeg); + double glongDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(galLongDeg, galLongMin, galLongSec); + double glatDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(galLatDeg, galLatMin, galLatSec); + double glongRad = glongDeg.ToRadians(); + double glatRad = glatDeg.ToRadians(); + double sinDec = glatRad.Cosine() * 27.4.ToRadians().Cosine() * (glongRad - 33.0.ToRadians()).Sine() + glatRad.Sine() * 27.4.ToRadians().Sine(); + double decRadians = sinDec.ASine(); + double decDeg = PAMacros.Degrees(decRadians); + double y = glatRad.Cosine() * (glongRad - 33.0.ToRadians()).Cosine(); + double x = glatRad.Sine() * 27.4.ToRadians().Cosine() - glatRad.Cosine() * 27.4.ToRadians().Sine() * (glongRad - 33.0.ToRadians()).Sine(); + + double raDeg1 = PAMacros.Degrees(y.AngleTangent2(x)) + 192.25; + double raDeg2 = raDeg1 - 360 * (raDeg1 / 360).Floor(); + double raHours1 = PAMacros.DecimalDegreesToDegreeHours(raDeg2); + + int raHours = PAMacros.DecimalHoursHour(raHours1); + int raMinutes = PAMacros.DecimalHoursMinute(raHours1); + double raSeconds = PAMacros.DecimalHoursSecond(raHours1); + double decDegrees = PAMacros.DecimalDegreesDegrees(decDeg); + double decMinutes = PAMacros.DecimalDegreesMinutes(decDeg); + double decSeconds = PAMacros.DecimalDegreesSeconds(decDeg); return (raHours, raMinutes, raSeconds, decDegrees, decMinutes, decSeconds); } @@ -257,26 +257,26 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// Tuple (angleDeg, angleMin, angleSec) public (double angleDeg, double angleMin, double angleSec) AngleBetweenTwoObjects(double raLong1HourDeg, double raLong1Min, double raLong1Sec, double decLat1Deg, double decLat1Min, double decLat1Sec, double raLong2HourDeg, double raLong2Min, double raLong2Sec, double decLat2Deg, double decLat2Min, double decLat2Sec, PAAngleMeasure hourOrDegree) { - var raLong1Decimal = (hourOrDegree == PAAngleMeasure.Hours) ? PAMacros.HMStoDH(raLong1HourDeg, raLong1Min, raLong1Sec) : PAMacros.DegreesMinutesSecondsToDecimalDegrees(raLong1HourDeg, raLong1Min, raLong1Sec); - var raLong1Deg = (hourOrDegree == PAAngleMeasure.Hours) ? PAMacros.DegreeHoursToDecimalDegrees(raLong1Decimal) : raLong1Decimal; + double raLong1Decimal = (hourOrDegree == PAAngleMeasure.Hours) ? PAMacros.HMStoDH(raLong1HourDeg, raLong1Min, raLong1Sec) : PAMacros.DegreesMinutesSecondsToDecimalDegrees(raLong1HourDeg, raLong1Min, raLong1Sec); + double raLong1Deg = (hourOrDegree == PAAngleMeasure.Hours) ? PAMacros.DegreeHoursToDecimalDegrees(raLong1Decimal) : raLong1Decimal; - var raLong1Rad = raLong1Deg.ToRadians(); - var decLat1Deg1 = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decLat1Deg, decLat1Min, decLat1Sec); - var decLat1Rad = decLat1Deg1.ToRadians(); + double raLong1Rad = raLong1Deg.ToRadians(); + double decLat1Deg1 = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decLat1Deg, decLat1Min, decLat1Sec); + double decLat1Rad = decLat1Deg1.ToRadians(); - var raLong2Decimal = (hourOrDegree == PAAngleMeasure.Hours) ? PAMacros.HMStoDH(raLong2HourDeg, raLong2Min, raLong2Sec) : PAMacros.DegreesMinutesSecondsToDecimalDegrees(raLong2HourDeg, raLong2Min, raLong2Sec); - var raLong2Deg = (hourOrDegree == PAAngleMeasure.Hours) ? PAMacros.DegreeHoursToDecimalDegrees(raLong2Decimal) : raLong2Decimal; - var raLong2Rad = raLong2Deg.ToRadians(); - var decLat2Deg1 = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decLat2Deg, decLat2Min, decLat2Sec); - var decLat2Rad = decLat2Deg1.ToRadians(); + double raLong2Decimal = (hourOrDegree == PAAngleMeasure.Hours) ? PAMacros.HMStoDH(raLong2HourDeg, raLong2Min, raLong2Sec) : PAMacros.DegreesMinutesSecondsToDecimalDegrees(raLong2HourDeg, raLong2Min, raLong2Sec); + double raLong2Deg = (hourOrDegree == PAAngleMeasure.Hours) ? PAMacros.DegreeHoursToDecimalDegrees(raLong2Decimal) : raLong2Decimal; + double raLong2Rad = raLong2Deg.ToRadians(); + double decLat2Deg1 = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decLat2Deg, decLat2Min, decLat2Sec); + double decLat2Rad = decLat2Deg1.ToRadians(); - var cosD = decLat1Rad.Sine() * decLat2Rad.Sine() + decLat1Rad.Cosine() * decLat2Rad.Cosine() * (raLong1Rad - raLong2Rad).Cosine(); - var dRad = cosD.ACosine(); - var dDeg = PAMacros.Degrees(dRad); + double cosD = decLat1Rad.Sine() * decLat2Rad.Sine() + decLat1Rad.Cosine() * decLat2Rad.Cosine() * (raLong1Rad - raLong2Rad).Cosine(); + double dRad = cosD.ACosine(); + double dDeg = PAMacros.Degrees(dRad); - var angleDeg = PAMacros.DecimalDegreesDegrees(dDeg); - var angleMin = PAMacros.DecimalDegreesMinutes(dDeg); - var angleSec = PAMacros.DecimalDegreesSeconds(dDeg); + double angleDeg = PAMacros.DecimalDegreesDegrees(dDeg); + double angleMin = PAMacros.DecimalDegreesMinutes(dDeg); + double angleSec = PAMacros.DecimalDegreesSeconds(dDeg); return (angleDeg, angleMin, angleSec); } @@ -288,34 +288,34 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// Tuple (riseSetStatus, utRiseHour, utRiseMin, utSetHour, utSetMin, azRise, azSet) public (string riseSetStatus, double utRiseHour, double utRiseMin, double utSetHour, double utSetMin, double azRise, double azSet) RisingAndSetting(double raHours, double raMinutes, double raSeconds, double decDeg, double decMin, double decSec, double gwDateDay, int gwDateMonth, int gwDateYear, double geogLongDeg, double geogLatDeg, double vertShiftDeg) { - var raHours1 = PAMacros.HMStoDH(raHours, raMinutes, raSeconds); - var decRad = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDeg, decMin, decSec).ToRadians(); - var verticalDisplRadians = vertShiftDeg.ToRadians(); - var geoLatRadians = geogLatDeg.ToRadians(); - var cosH = -(verticalDisplRadians.Sine() + geoLatRadians.Sine() * decRad.Sine()) / (geoLatRadians.Cosine() * decRad.Cosine()); - var hHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.Degrees(cosH.ACosine())); - var lstRiseHours = raHours1 - hHours - 24 * ((raHours1 - hHours) / 24).Floor(); - var lstSetHours = raHours1 + hHours - 24 * ((raHours1 + hHours) / 24).Floor(); - var aDeg = PAMacros.Degrees(((decRad.Sine() + verticalDisplRadians.Sine() * geoLatRadians.Sine()) / (verticalDisplRadians.Cosine() * geoLatRadians.Cosine())).ACosine()); - var azRiseDeg = aDeg - 360 * (aDeg / 360).Floor(); - var azSetDeg = 360 - aDeg - 360 * ((360 - aDeg) / 360).Floor(); - var utRiseHours1 = PAMacros.GreenwichSiderealTimeToUniversalTime(PAMacros.LocalSiderealTimeToGreenwichSiderealTime(lstRiseHours, 0, 0, geogLongDeg), 0, 0, gwDateDay, gwDateMonth, gwDateYear); - var utSetHours1 = PAMacros.GreenwichSiderealTimeToUniversalTime(PAMacros.LocalSiderealTimeToGreenwichSiderealTime(lstSetHours, 0, 0, geogLongDeg), 0, 0, gwDateDay, gwDateMonth, gwDateYear); - var utRiseAdjustedHours = utRiseHours1 + 0.008333; - var utSetAdjustedHours = utSetHours1 + 0.008333; - - var riseSetStatus = "OK"; + double raHours1 = PAMacros.HMStoDH(raHours, raMinutes, raSeconds); + double decRad = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDeg, decMin, decSec).ToRadians(); + double verticalDisplRadians = vertShiftDeg.ToRadians(); + double geoLatRadians = geogLatDeg.ToRadians(); + double cosH = -(verticalDisplRadians.Sine() + geoLatRadians.Sine() * decRad.Sine()) / (geoLatRadians.Cosine() * decRad.Cosine()); + double hHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.Degrees(cosH.ACosine())); + double lstRiseHours = raHours1 - hHours - 24 * ((raHours1 - hHours) / 24).Floor(); + double lstSetHours = raHours1 + hHours - 24 * ((raHours1 + hHours) / 24).Floor(); + double aDeg = PAMacros.Degrees(((decRad.Sine() + verticalDisplRadians.Sine() * geoLatRadians.Sine()) / (verticalDisplRadians.Cosine() * geoLatRadians.Cosine())).ACosine()); + double azRiseDeg = aDeg - 360 * (aDeg / 360).Floor(); + double azSetDeg = 360 - aDeg - 360 * ((360 - aDeg) / 360).Floor(); + double utRiseHours1 = PAMacros.GreenwichSiderealTimeToUniversalTime(PAMacros.LocalSiderealTimeToGreenwichSiderealTime(lstRiseHours, 0, 0, geogLongDeg), 0, 0, gwDateDay, gwDateMonth, gwDateYear); + double utSetHours1 = PAMacros.GreenwichSiderealTimeToUniversalTime(PAMacros.LocalSiderealTimeToGreenwichSiderealTime(lstSetHours, 0, 0, geogLongDeg), 0, 0, gwDateDay, gwDateMonth, gwDateYear); + double utRiseAdjustedHours = utRiseHours1 + 0.008333; + double utSetAdjustedHours = utSetHours1 + 0.008333; + + string riseSetStatus = "OK"; if (cosH > 1) riseSetStatus = "never rises"; if (cosH < -1) riseSetStatus = "circumpolar"; - var utRiseHour = (riseSetStatus == "OK") ? PAMacros.DecimalHoursHour(utRiseAdjustedHours) : 0; - var utRiseMin = (riseSetStatus == "OK") ? PAMacros.DecimalHoursMinute(utRiseAdjustedHours) : 0; - var utSetHour = (riseSetStatus == "OK") ? PAMacros.DecimalHoursHour(utSetAdjustedHours) : 0; - var utSetMin = (riseSetStatus == "OK") ? PAMacros.DecimalHoursMinute(utSetAdjustedHours) : 0; - var azRise = (riseSetStatus == "OK") ? Math.Round(azRiseDeg, 2) : 0; - var azSet = (riseSetStatus == "OK") ? Math.Round(azSetDeg, 2) : 0; + int utRiseHour = (riseSetStatus == "OK") ? PAMacros.DecimalHoursHour(utRiseAdjustedHours) : 0; + int utRiseMin = (riseSetStatus == "OK") ? PAMacros.DecimalHoursMinute(utRiseAdjustedHours) : 0; + int utSetHour = (riseSetStatus == "OK") ? PAMacros.DecimalHoursHour(utSetAdjustedHours) : 0; + int utSetMin = (riseSetStatus == "OK") ? PAMacros.DecimalHoursMinute(utSetAdjustedHours) : 0; + double azRise = (riseSetStatus == "OK") ? Math.Round(azRiseDeg, 2) : 0; + double azSet = (riseSetStatus == "OK") ? Math.Round(azSetDeg, 2) : 0; return (riseSetStatus, utRiseHour, utRiseMin, utSetHour, utSetMin, azRise, azSet); } @@ -326,23 +326,23 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// Tuple (correctedRAHour, correctedRAMinutes, correctedRASeconds, correctedDecDeg, correctedDecMinutes, correctedDecSeconds) public (double correctedRAHour, double correctedRAMinutes, double correctedRASeconds, double correctedDecDeg, double correctedDecMinutes, double correctedDecSeconds) CorrectForPrecession(double raHour, double raMinutes, double raSeconds, double decDeg, double decMinutes, double decSeconds, double epoch1Day, int epoch1Month, int epoch1Year, double epoch2Day, int epoch2Month, int epoch2Year) { - var ra1Rad = PAMacros.DegreeHoursToDecimalDegrees(PAMacros.HMStoDH(raHour, raMinutes, raSeconds)).ToRadians(); - var dec1Rad = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDeg, decMinutes, decSeconds).ToRadians(); - var tCenturies = (PAMacros.CivilDateToJulianDate(epoch1Day, epoch1Month, epoch1Year) - 2415020) / 36525; - var mSec = 3.07234 + (0.00186 * tCenturies); - var nArcsec = 20.0468 - (0.0085 * tCenturies); - var nYears = (PAMacros.CivilDateToJulianDate(epoch2Day, epoch2Month, epoch2Year) - PAMacros.CivilDateToJulianDate(epoch1Day, epoch1Month, epoch1Year)) / 365.25; - var s1Hours = (mSec + (nArcsec * ra1Rad.Sine() * dec1Rad.Tangent() / 15)) * nYears / 3600; - var ra2Hours = PAMacros.HMStoDH(raHour, raMinutes, raSeconds) + s1Hours; - var s2Deg = nArcsec * ra1Rad.Cosine() * nYears / 3600; - var dec2Deg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDeg, decMinutes, decSeconds) + s2Deg; - - var correctedRAHour = PAMacros.DecimalHoursHour(ra2Hours); - var correctedRAMinutes = PAMacros.DecimalHoursMinute(ra2Hours); - var correctedRASeconds = PAMacros.DecimalHoursSecond(ra2Hours); - var correctedDecDeg = PAMacros.DecimalDegreesDegrees(dec2Deg); - var correctedDecMinutes = PAMacros.DecimalDegreesMinutes(dec2Deg); - var correctedDecSeconds = PAMacros.DecimalDegreesSeconds(dec2Deg); + double ra1Rad = PAMacros.DegreeHoursToDecimalDegrees(PAMacros.HMStoDH(raHour, raMinutes, raSeconds)).ToRadians(); + double dec1Rad = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDeg, decMinutes, decSeconds).ToRadians(); + double tCenturies = (PAMacros.CivilDateToJulianDate(epoch1Day, epoch1Month, epoch1Year) - 2415020) / 36525; + double mSec = 3.07234 + (0.00186 * tCenturies); + double nArcsec = 20.0468 - (0.0085 * tCenturies); + double nYears = (PAMacros.CivilDateToJulianDate(epoch2Day, epoch2Month, epoch2Year) - PAMacros.CivilDateToJulianDate(epoch1Day, epoch1Month, epoch1Year)) / 365.25; + double s1Hours = (mSec + (nArcsec * ra1Rad.Sine() * dec1Rad.Tangent() / 15)) * nYears / 3600; + double ra2Hours = PAMacros.HMStoDH(raHour, raMinutes, raSeconds) + s1Hours; + double s2Deg = nArcsec * ra1Rad.Cosine() * nYears / 3600; + double dec2Deg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decDeg, decMinutes, decSeconds) + s2Deg; + + int correctedRAHour = PAMacros.DecimalHoursHour(ra2Hours); + int correctedRAMinutes = PAMacros.DecimalHoursMinute(ra2Hours); + double correctedRASeconds = PAMacros.DecimalHoursSecond(ra2Hours); + double correctedDecDeg = PAMacros.DecimalDegreesDegrees(dec2Deg); + double correctedDecMinutes = PAMacros.DecimalDegreesMinutes(dec2Deg); + double correctedDecSeconds = PAMacros.DecimalDegreesSeconds(dec2Deg); return (correctedRAHour, correctedRAMinutes, correctedRASeconds, correctedDecDeg, correctedDecMinutes, correctedDecSeconds); } @@ -353,22 +353,22 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// Tuple (nutation in ecliptic longitude (degrees), nutation in obliquity (degrees)) public (double nutInLongDeg, double nutInOblDeg) NutationInEclipticLongitudeAndObliquity(double greenwichDay, int greenwichMonth, int greenwichYear) { - var jdDays = PAMacros.CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear); - var tCenturies = (jdDays - 2415020) / 36525; - var aDeg = 100.0021358 * tCenturies; - var l1Deg = 279.6967 + (0.000303 * tCenturies * tCenturies); - var lDeg1 = l1Deg + 360 * (aDeg - aDeg.Floor()); - var lDeg2 = lDeg1 - 360 * (lDeg1 / 360).Floor(); - var lRad = lDeg2.ToRadians(); - var bDeg = 5.372617 * tCenturies; - var nDeg1 = 259.1833 - 360 * (bDeg - bDeg.Floor()); - var nDeg2 = nDeg1 - 360 * (nDeg1 / 360).Floor(); - var nRad = nDeg2.ToRadians(); - var nutInLongArcsec = -17.2 * nRad.Sine() - 1.3 * (2 * lRad).Sine(); - var nutInOblArcsec = 9.2 * nRad.Cosine() + 0.5 * (2 * lRad).Cosine(); - - var nutInLongDeg = nutInLongArcsec / 3600; - var nutInOblDeg = nutInOblArcsec / 3600; + double jdDays = PAMacros.CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear); + double tCenturies = (jdDays - 2415020) / 36525; + double aDeg = 100.0021358 * tCenturies; + double l1Deg = 279.6967 + (0.000303 * tCenturies * tCenturies); + double lDeg1 = l1Deg + 360 * (aDeg - aDeg.Floor()); + double lDeg2 = lDeg1 - 360 * (lDeg1 / 360).Floor(); + double lRad = lDeg2.ToRadians(); + double bDeg = 5.372617 * tCenturies; + double nDeg1 = 259.1833 - 360 * (bDeg - bDeg.Floor()); + double nDeg2 = nDeg1 - 360 * (nDeg1 / 360).Floor(); + double nRad = nDeg2.ToRadians(); + double nutInLongArcsec = -17.2 * nRad.Sine() - 1.3 * (2 * lRad).Sine(); + double nutInOblArcsec = 9.2 * nRad.Cosine() + 0.5 * (2 * lRad).Cosine(); + + double nutInLongDeg = nutInLongArcsec / 3600; + double nutInOblDeg = nutInOblArcsec / 3600; return (nutInLongDeg, nutInOblDeg); } @@ -382,20 +382,20 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// public (double apparentEclLongDeg, double apparentEclLongMin, double apparentEclLongSec, double apparentEclLatDeg, double apparentEclLatMin, double apparentEclLatSec) CorrectForAberration(double utHour, double utMinutes, double utSeconds, double gwDay, int gwMonth, int gwYear, double trueEclLongDeg, double trueEclLongMin, double trueEclLongSec, double trueEclLatDeg, double trueEclLatMin, double trueEclLatSec) { - var trueLongDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(trueEclLongDeg, trueEclLongMin, trueEclLongSec); - var trueLatDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(trueEclLatDeg, trueEclLatMin, trueEclLatSec); - var sunTrueLongDeg = PAMacros.SunLong(utHour, utMinutes, utSeconds, 0, 0, gwDay, gwMonth, gwYear); - var dlongArcsec = -20.5 * (sunTrueLongDeg - trueLongDeg).ToRadians().Cosine() / trueLatDeg.ToRadians().Cosine(); - var dlatArcsec = -20.5 * (sunTrueLongDeg - trueLongDeg).ToRadians().Sine() * trueLatDeg.ToRadians().Sine(); - var apparentLongDeg = trueLongDeg + (dlongArcsec / 3600); - var apparentLatDeg = trueLatDeg + (dlatArcsec / 3600); - - var apparentEclLongDeg = PAMacros.DecimalDegreesDegrees(apparentLongDeg); - var apparentEclLongMin = PAMacros.DecimalDegreesMinutes(apparentLongDeg); - var apparentEclLongSec = PAMacros.DecimalDegreesSeconds(apparentLongDeg); - var apparentEclLatDeg = PAMacros.DecimalDegreesDegrees(apparentLatDeg); - var apparentEclLatMin = PAMacros.DecimalDegreesMinutes(apparentLatDeg); - var apparentEclLatSec = PAMacros.DecimalDegreesSeconds(apparentLatDeg); + double trueLongDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(trueEclLongDeg, trueEclLongMin, trueEclLongSec); + double trueLatDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(trueEclLatDeg, trueEclLatMin, trueEclLatSec); + double sunTrueLongDeg = PAMacros.SunLong(utHour, utMinutes, utSeconds, 0, 0, gwDay, gwMonth, gwYear); + double dlongArcsec = -20.5 * (sunTrueLongDeg - trueLongDeg).ToRadians().Cosine() / trueLatDeg.ToRadians().Cosine(); + double dlatArcsec = -20.5 * (sunTrueLongDeg - trueLongDeg).ToRadians().Sine() * trueLatDeg.ToRadians().Sine(); + double apparentLongDeg = trueLongDeg + (dlongArcsec / 3600); + double apparentLatDeg = trueLatDeg + (dlatArcsec / 3600); + + double apparentEclLongDeg = PAMacros.DecimalDegreesDegrees(apparentLongDeg); + double apparentEclLongMin = PAMacros.DecimalDegreesMinutes(apparentLongDeg); + double apparentEclLongSec = PAMacros.DecimalDegreesSeconds(apparentLongDeg); + double apparentEclLatDeg = PAMacros.DecimalDegreesDegrees(apparentLatDeg); + double apparentEclLatMin = PAMacros.DecimalDegreesMinutes(apparentLatDeg); + double apparentEclLatSec = PAMacros.DecimalDegreesSeconds(apparentLatDeg); return (apparentEclLongDeg, apparentEclLongMin, apparentEclLongSec, apparentEclLatDeg, apparentEclLatMin, apparentEclLatSec); } @@ -413,21 +413,21 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// public (double correctedRAHour, double correctedRAMin, double correctedRASec, double correctedDecDeg, double correctedDecMin, double correctedDecSec) AtmosphericRefraction(double trueRAHour, double trueRAMin, double trueRASec, double trueDecDeg, double trueDecMin, double trueDecSec, PACoordinateType coordinateType, double geogLongDeg, double geogLatDeg, int daylightSavingHours, int timezoneHours, double lcdDay, int lcdMonth, int lcdYear, double lctHour, double lctMin, double lctSec, double atmosphericPressureMbar, double atmosphericTemperatureCelsius) { - var haHour = PAMacros.RightAscensionToHourAngle(trueRAHour, trueRAMin, trueRASec, lctHour, lctMin, lctSec, daylightSavingHours, timezoneHours, lcdDay, lcdMonth, lcdYear, geogLongDeg); - var azimuthDeg = PAMacros.EquatorialCoordinatesToAzimuth(haHour, 0, 0, trueDecDeg, trueDecMin, trueDecSec, geogLatDeg); - var altitudeDeg = PAMacros.EquatorialCoordinatesToAltitude(haHour, 0, 0, trueDecDeg, trueDecMin, trueDecSec, geogLatDeg); - var correctedAltitudeDeg = PAMacros.Refract(altitudeDeg, coordinateType, atmosphericPressureMbar, atmosphericTemperatureCelsius); - - var correctedHAHour = PAMacros.HorizonCoordinatesToHourAngle(azimuthDeg, 0, 0, correctedAltitudeDeg, 0, 0, geogLatDeg); - var correctedRAHour1 = PAMacros.HourAngleToRightAscension(correctedHAHour, 0, 0, lctHour, lctMin, lctSec, daylightSavingHours, timezoneHours, lcdDay, lcdMonth, lcdYear, geogLongDeg); - var correctedDecDeg1 = PAMacros.HorizonCoordinatesToDeclination(azimuthDeg, 0, 0, correctedAltitudeDeg, 0, 0, geogLatDeg); - - var correctedRAHour = PAMacros.DecimalHoursHour(correctedRAHour1); - var correctedRAMin = PAMacros.DecimalHoursMinute(correctedRAHour1); - var correctedRASec = PAMacros.DecimalHoursSecond(correctedRAHour1); - var correctedDecDeg = PAMacros.DecimalDegreesDegrees(correctedDecDeg1); - var correctedDecMin = PAMacros.DecimalDegreesMinutes(correctedDecDeg1); - var correctedDecSec = PAMacros.DecimalDegreesSeconds(correctedDecDeg1); + double haHour = PAMacros.RightAscensionToHourAngle(trueRAHour, trueRAMin, trueRASec, lctHour, lctMin, lctSec, daylightSavingHours, timezoneHours, lcdDay, lcdMonth, lcdYear, geogLongDeg); + double azimuthDeg = PAMacros.EquatorialCoordinatesToAzimuth(haHour, 0, 0, trueDecDeg, trueDecMin, trueDecSec, geogLatDeg); + double altitudeDeg = PAMacros.EquatorialCoordinatesToAltitude(haHour, 0, 0, trueDecDeg, trueDecMin, trueDecSec, geogLatDeg); + double correctedAltitudeDeg = PAMacros.Refract(altitudeDeg, coordinateType, atmosphericPressureMbar, atmosphericTemperatureCelsius); + + double correctedHAHour = PAMacros.HorizonCoordinatesToHourAngle(azimuthDeg, 0, 0, correctedAltitudeDeg, 0, 0, geogLatDeg); + double correctedRAHour1 = PAMacros.HourAngleToRightAscension(correctedHAHour, 0, 0, lctHour, lctMin, lctSec, daylightSavingHours, timezoneHours, lcdDay, lcdMonth, lcdYear, geogLongDeg); + double correctedDecDeg1 = PAMacros.HorizonCoordinatesToDeclination(azimuthDeg, 0, 0, correctedAltitudeDeg, 0, 0, geogLatDeg); + + int correctedRAHour = PAMacros.DecimalHoursHour(correctedRAHour1); + int correctedRAMin = PAMacros.DecimalHoursMinute(correctedRAHour1); + double correctedRASec = PAMacros.DecimalHoursSecond(correctedRAHour1); + double correctedDecDeg = PAMacros.DecimalDegreesDegrees(correctedDecDeg1); + double correctedDecMin = PAMacros.DecimalDegreesMinutes(correctedDecDeg1); + double correctedDecSec = PAMacros.DecimalDegreesSeconds(correctedDecDeg1); return (correctedRAHour, correctedRAMin, correctedRASec, correctedDecDeg, correctedDecMin, correctedDecSec); } @@ -439,20 +439,20 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// corrected RA hours,minutes,seconds and corrected Declination degrees,minutes,seconds public (double correctedRAHour, double correctedRAMin, double correctedRASec, double correctedDecDeg, double correctedDecMin, double correctedDecSec) CorrectionsForGeocentricParallax(double raHour, double raMin, double raSec, double decDeg, double decMin, double decSec, PACoordinateType coordinateType, double equatorialHorParallaxDeg, double geogLongDeg, double geogLatDeg, double heightM, int daylightSaving, int timezoneHours, double lcdDay, int lcdMonth, int lcdYear, double lctHour, double lctMin, double lctSec) { - var haHours = PAMacros.RightAscensionToHourAngle(raHour, raMin, raSec, lctHour, lctMin, lctSec, daylightSaving, timezoneHours, lcdDay, lcdMonth, lcdYear, geogLongDeg); + double haHours = PAMacros.RightAscensionToHourAngle(raHour, raMin, raSec, lctHour, lctMin, lctSec, daylightSaving, timezoneHours, lcdDay, lcdMonth, lcdYear, geogLongDeg); - var correctedHAHours = PAMacros.ParallaxHA(haHours, 0, 0, decDeg, decMin, decSec, coordinateType, geogLatDeg, heightM, equatorialHorParallaxDeg); + double correctedHAHours = PAMacros.ParallaxHA(haHours, 0, 0, decDeg, decMin, decSec, coordinateType, geogLatDeg, heightM, equatorialHorParallaxDeg); - var correctedRAHours = PAMacros.HourAngleToRightAscension(correctedHAHours, 0, 0, lctHour, lctMin, lctSec, daylightSaving, timezoneHours, lcdDay, lcdMonth, lcdYear, geogLongDeg); + double correctedRAHours = PAMacros.HourAngleToRightAscension(correctedHAHours, 0, 0, lctHour, lctMin, lctSec, daylightSaving, timezoneHours, lcdDay, lcdMonth, lcdYear, geogLongDeg); - var correctedDecDeg1 = PAMacros.ParallaxDec(haHours, 0, 0, decDeg, decMin, decSec, coordinateType, geogLatDeg, heightM, equatorialHorParallaxDeg); + double correctedDecDeg1 = PAMacros.ParallaxDec(haHours, 0, 0, decDeg, decMin, decSec, coordinateType, geogLatDeg, heightM, equatorialHorParallaxDeg); - var correctedRAHour = PAMacros.DecimalHoursHour(correctedRAHours); - var correctedRAMin = PAMacros.DecimalHoursMinute(correctedRAHours); - var correctedRASec = PAMacros.DecimalHoursSecond(correctedRAHours); - var correctedDecDeg = PAMacros.DecimalDegreesDegrees(correctedDecDeg1); - var correctedDecMin = PAMacros.DecimalDegreesMinutes(correctedDecDeg1); - var correctedDecSec = PAMacros.DecimalDegreesSeconds(correctedDecDeg1); + int correctedRAHour = PAMacros.DecimalHoursHour(correctedRAHours); + int correctedRAMin = PAMacros.DecimalHoursMinute(correctedRAHours); + double correctedRASec = PAMacros.DecimalHoursSecond(correctedRAHours); + double correctedDecDeg = PAMacros.DecimalDegreesDegrees(correctedDecDeg1); + double correctedDecMin = PAMacros.DecimalDegreesMinutes(correctedDecDeg1); + double correctedDecSec = PAMacros.DecimalDegreesSeconds(correctedDecDeg1); return (correctedRAHour, correctedRAMin, correctedRASec, correctedDecDeg, correctedDecMin, correctedDecSec); } @@ -463,29 +463,29 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// heliographic longitude and heliographic latitude, in degrees public (double helioLongDeg, double helioLatDeg) HeliographicCoordinates(double helioPositionAngleDeg, double helioDisplacementArcmin, double gwdateDay, int gwdateMonth, int gwdateYear) { - var julianDateDays = PAMacros.CivilDateToJulianDate(gwdateDay, gwdateMonth, gwdateYear); - var tCenturies = (julianDateDays - 2415020) / 36525; - var longAscNodeDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(74, 22, 0) + (84 * tCenturies / 60); - var sunLongDeg = PAMacros.SunLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); - var y = (longAscNodeDeg - sunLongDeg).ToRadians().Sine() * PAMacros.DegreesMinutesSecondsToDecimalDegrees(7, 15, 0).ToRadians().Cosine(); - var x = -(longAscNodeDeg - sunLongDeg).ToRadians().Cosine(); - var aDeg = PAMacros.Degrees(y.AngleTangent2(x)); - var mDeg1 = 360 - (360 * (julianDateDays - 2398220) / 25.38); - var mDeg2 = mDeg1 - 360 * (mDeg1 / 360).Floor(); - var l0Deg1 = mDeg2 + aDeg; - var b0Rad = ((sunLongDeg - longAscNodeDeg).ToRadians().Sine() * PAMacros.DegreesMinutesSecondsToDecimalDegrees(7, 15, 0).ToRadians().Sine()).ASine(); - var theta1Rad = (-sunLongDeg.ToRadians().Cosine() * PAMacros.Obliq(gwdateDay, gwdateMonth, gwdateYear).ToRadians().Tangent()).AngleTangent(); - var theta2Rad = (-(longAscNodeDeg - sunLongDeg).ToRadians().Cosine() * PAMacros.DegreesMinutesSecondsToDecimalDegrees(7, 15, 0).ToRadians().Tangent()).AngleTangent(); - var pDeg = PAMacros.Degrees(theta1Rad + theta2Rad); - var rho1Deg = helioDisplacementArcmin / 60; - var rhoRad = (2 * rho1Deg / PAMacros.SunDia(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear)).ASine() - rho1Deg.ToRadians(); - var bRad = (b0Rad.Sine() * rhoRad.Cosine() + b0Rad.Cosine() * rhoRad.Sine() * (pDeg - helioPositionAngleDeg).ToRadians().Cosine()).ASine(); - var bDeg = PAMacros.Degrees(bRad); - var lDeg1 = PAMacros.Degrees((rhoRad.Sine() * (pDeg - helioPositionAngleDeg).ToRadians().Sine() / bRad.Cosine()).ASine()) + l0Deg1; - var lDeg2 = lDeg1 - 360 * (lDeg1 / 360).Floor(); - - var helioLongDeg = Math.Round(lDeg2, 2); - var helioLatDeg = Math.Round(bDeg, 2); + double julianDateDays = PAMacros.CivilDateToJulianDate(gwdateDay, gwdateMonth, gwdateYear); + double tCenturies = (julianDateDays - 2415020) / 36525; + double longAscNodeDeg = PAMacros.DegreesMinutesSecondsToDecimalDegrees(74, 22, 0) + (84 * tCenturies / 60); + double sunLongDeg = PAMacros.SunLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); + double y = (longAscNodeDeg - sunLongDeg).ToRadians().Sine() * PAMacros.DegreesMinutesSecondsToDecimalDegrees(7, 15, 0).ToRadians().Cosine(); + double x = -(longAscNodeDeg - sunLongDeg).ToRadians().Cosine(); + double aDeg = PAMacros.Degrees(y.AngleTangent2(x)); + double mDeg1 = 360 - (360 * (julianDateDays - 2398220) / 25.38); + double mDeg2 = mDeg1 - 360 * (mDeg1 / 360).Floor(); + double l0Deg1 = mDeg2 + aDeg; + double b0Rad = ((sunLongDeg - longAscNodeDeg).ToRadians().Sine() * PAMacros.DegreesMinutesSecondsToDecimalDegrees(7, 15, 0).ToRadians().Sine()).ASine(); + double theta1Rad = (-sunLongDeg.ToRadians().Cosine() * PAMacros.Obliq(gwdateDay, gwdateMonth, gwdateYear).ToRadians().Tangent()).AngleTangent(); + double theta2Rad = (-(longAscNodeDeg - sunLongDeg).ToRadians().Cosine() * PAMacros.DegreesMinutesSecondsToDecimalDegrees(7, 15, 0).ToRadians().Tangent()).AngleTangent(); + double pDeg = PAMacros.Degrees(theta1Rad + theta2Rad); + double rho1Deg = helioDisplacementArcmin / 60; + double rhoRad = (2 * rho1Deg / PAMacros.SunDia(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear)).ASine() - rho1Deg.ToRadians(); + double bRad = (b0Rad.Sine() * rhoRad.Cosine() + b0Rad.Cosine() * rhoRad.Sine() * (pDeg - helioPositionAngleDeg).ToRadians().Cosine()).ASine(); + double bDeg = PAMacros.Degrees(bRad); + double lDeg1 = PAMacros.Degrees((rhoRad.Sine() * (pDeg - helioPositionAngleDeg).ToRadians().Sine() / bRad.Cosine()).ASine()) + l0Deg1; + double lDeg2 = lDeg1 - 360 * (lDeg1 / 360).Floor(); + + double helioLongDeg = Math.Round(lDeg2, 2); + double helioLatDeg = Math.Round(bDeg, 2); return (helioLongDeg, helioLatDeg); } @@ -496,9 +496,9 @@ public double MeanObliquityOfTheEcliptic(double greenwichDay, int greenwichMonth /// carrington rotation number public int CarringtonRotationNumber(double gwdateDay, int gwdateMonth, int gwdateYear) { - var julianDateDays = PAMacros.CivilDateToJulianDate(gwdateDay, gwdateMonth, gwdateYear); + double julianDateDays = PAMacros.CivilDateToJulianDate(gwdateDay, gwdateMonth, gwdateYear); - var crn = 1690 + (int)Math.Round((julianDateDays - 2444235.34) / 27.2753, 0); + int crn = 1690 + (int)Math.Round((julianDateDays - 2444235.34) / 27.2753, 0); return crn; } @@ -509,30 +509,30 @@ public int CarringtonRotationNumber(double gwdateDay, int gwdateMonth, int gwdat /// sub-earth longitude, sub-earth latitude, and position angle of pole public (double subEarthLongitude, double subEarthLatitude, double positionAngleOfPole) SelenographicCoordinates1(double gwdateDay, int gwdateMonth, int gwdateYear) { - var julianDateDays = PAMacros.CivilDateToJulianDate(gwdateDay, gwdateMonth, gwdateYear); - var tCenturies = (julianDateDays - 2451545) / 36525; - var longAscNodeDeg = 125.044522 - 1934.136261 * tCenturies; - var f1 = 93.27191 + 483202.0175 * tCenturies; - var f2 = f1 - 360 * (f1 / 360).Floor(); - var geocentricMoonLongDeg = PAMacros.MoonLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); - var geocentricMoonLatRad = PAMacros.MoonLat(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear).ToRadians(); - var inclinationRad = PAMacros.DegreesMinutesSecondsToDecimalDegrees(1, 32, 32.7).ToRadians(); - var nodeLongRad = (longAscNodeDeg - geocentricMoonLongDeg).ToRadians(); - var sinBe = -inclinationRad.Cosine() * geocentricMoonLatRad.Sine() + inclinationRad.Sine() * geocentricMoonLatRad.Cosine() * nodeLongRad.Sine(); - var subEarthLatDeg = PAMacros.Degrees(sinBe.ASine()); - var aRad = (-geocentricMoonLatRad.Sine() * inclinationRad.Sine() - geocentricMoonLatRad.Cosine() * inclinationRad.Cosine() * nodeLongRad.Sine()).AngleTangent2(geocentricMoonLatRad.Cosine() * nodeLongRad.Cosine()); - var aDeg = PAMacros.Degrees(aRad); - var subEarthLongDeg1 = aDeg - f2; - var subEarthLongDeg2 = subEarthLongDeg1 - 360 * (subEarthLongDeg1 / 360).Floor(); - var subEarthLongDeg3 = (subEarthLongDeg2 > 180) ? subEarthLongDeg2 - 360 : subEarthLongDeg2; - var c1Rad = (nodeLongRad.Cosine() * inclinationRad.Sine() / (geocentricMoonLatRad.Cosine() * inclinationRad.Cosine() + geocentricMoonLatRad.Sine() * inclinationRad.Sine() * nodeLongRad.Sine())).AngleTangent(); - var obliquityRad = PAMacros.Obliq(gwdateDay, gwdateMonth, gwdateYear).ToRadians(); - var c2Rad = (obliquityRad.Sine() * geocentricMoonLongDeg.ToRadians().Cosine() / (obliquityRad.Sine() * geocentricMoonLatRad.Sine() * geocentricMoonLongDeg.ToRadians().Sine() - obliquityRad.Cosine() * geocentricMoonLatRad.Cosine())).AngleTangent(); - var cDeg = PAMacros.Degrees(c1Rad + c2Rad); - - var subEarthLongitude = Math.Round(subEarthLongDeg3, 2); - var subEarthLatitude = Math.Round(subEarthLatDeg, 2); - var positionAngleOfPole = Math.Round(cDeg, 2); + double julianDateDays = PAMacros.CivilDateToJulianDate(gwdateDay, gwdateMonth, gwdateYear); + double tCenturies = (julianDateDays - 2451545) / 36525; + double longAscNodeDeg = 125.044522 - 1934.136261 * tCenturies; + double f1 = 93.27191 + 483202.0175 * tCenturies; + double f2 = f1 - 360 * (f1 / 360).Floor(); + double geocentricMoonLongDeg = PAMacros.MoonLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); + double geocentricMoonLatRad = PAMacros.MoonLat(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear).ToRadians(); + double inclinationRad = PAMacros.DegreesMinutesSecondsToDecimalDegrees(1, 32, 32.7).ToRadians(); + double nodeLongRad = (longAscNodeDeg - geocentricMoonLongDeg).ToRadians(); + double sinBe = -inclinationRad.Cosine() * geocentricMoonLatRad.Sine() + inclinationRad.Sine() * geocentricMoonLatRad.Cosine() * nodeLongRad.Sine(); + double subEarthLatDeg = PAMacros.Degrees(sinBe.ASine()); + double aRad = (-geocentricMoonLatRad.Sine() * inclinationRad.Sine() - geocentricMoonLatRad.Cosine() * inclinationRad.Cosine() * nodeLongRad.Sine()).AngleTangent2(geocentricMoonLatRad.Cosine() * nodeLongRad.Cosine()); + double aDeg = PAMacros.Degrees(aRad); + double subEarthLongDeg1 = aDeg - f2; + double subEarthLongDeg2 = subEarthLongDeg1 - 360 * (subEarthLongDeg1 / 360).Floor(); + double subEarthLongDeg3 = (subEarthLongDeg2 > 180) ? subEarthLongDeg2 - 360 : subEarthLongDeg2; + double c1Rad = (nodeLongRad.Cosine() * inclinationRad.Sine() / (geocentricMoonLatRad.Cosine() * inclinationRad.Cosine() + geocentricMoonLatRad.Sine() * inclinationRad.Sine() * nodeLongRad.Sine())).AngleTangent(); + double obliquityRad = PAMacros.Obliq(gwdateDay, gwdateMonth, gwdateYear).ToRadians(); + double c2Rad = (obliquityRad.Sine() * geocentricMoonLongDeg.ToRadians().Cosine() / (obliquityRad.Sine() * geocentricMoonLatRad.Sine() * geocentricMoonLongDeg.ToRadians().Sine() - obliquityRad.Cosine() * geocentricMoonLatRad.Cosine())).AngleTangent(); + double cDeg = PAMacros.Degrees(c1Rad + c2Rad); + + double subEarthLongitude = Math.Round(subEarthLongDeg3, 2); + double subEarthLatitude = Math.Round(subEarthLatDeg, 2); + double positionAngleOfPole = Math.Round(cDeg, 2); return (subEarthLongitude, subEarthLatitude, positionAngleOfPole); } @@ -543,32 +543,32 @@ public int CarringtonRotationNumber(double gwdateDay, int gwdateMonth, int gwdat /// sub-solar longitude, sub-solar colongitude, and sub-solar latitude public (double subSolarLongitude, double subSolarColongitude, double subSolarLatitude) SelenographicCoordinates2(double gwdateDay, int gwdateMonth, int gwdateYear) { - var julianDateDays = PAMacros.CivilDateToJulianDate(gwdateDay, gwdateMonth, gwdateYear); - var tCenturies = (julianDateDays - 2451545) / 36525; - var longAscNodeDeg = 125.044522 - 1934.136261 * tCenturies; - var f1 = 93.27191 + 483202.0175 * tCenturies; - var f2 = f1 - 360 * (f1 / 360).Floor(); - var sunGeocentricLongDeg = PAMacros.SunLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); - var moonEquHorParallaxArcMin = PAMacros.MoonHP(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear) * 60; - var sunEarthDistAU = PAMacros.SunDist(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); - var geocentricMoonLatRad = PAMacros.MoonLat(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear).ToRadians(); - var geocentricMoonLongDeg = PAMacros.MoonLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); - var adjustedMoonLongDeg = sunGeocentricLongDeg + 180 + (26.4 * geocentricMoonLatRad.Cosine() * (sunGeocentricLongDeg - geocentricMoonLongDeg).ToRadians().Sine() / (moonEquHorParallaxArcMin * sunEarthDistAU)); - var adjustedMoonLatRad = 0.14666 * geocentricMoonLatRad / (moonEquHorParallaxArcMin * sunEarthDistAU); - var inclinationRad = PAMacros.DegreesMinutesSecondsToDecimalDegrees(1, 32, 32.7).ToRadians(); - var nodeLongRad = (longAscNodeDeg - adjustedMoonLongDeg).ToRadians(); - var sinBs = -inclinationRad.Cosine() * adjustedMoonLatRad.Sine() + inclinationRad.Sine() * adjustedMoonLatRad.Cosine() * nodeLongRad.Sine(); - var subSolarLatDeg = PAMacros.Degrees(sinBs.ASine()); - var aRad = (-adjustedMoonLatRad.Sine() * inclinationRad.Sine() - adjustedMoonLatRad.Cosine() * inclinationRad.Cosine() * nodeLongRad.Sine()).AngleTangent2(adjustedMoonLatRad.Cosine() * nodeLongRad.Cosine()); - var aDeg = PAMacros.Degrees(aRad); - var subSolarLongDeg1 = aDeg - f2; - var subSolarLongDeg2 = subSolarLongDeg1 - 360 * (subSolarLongDeg1 / 360).Floor(); - var subSolarLongDeg3 = (subSolarLongDeg2 > 180) ? subSolarLongDeg2 - 360 : subSolarLongDeg2; - var subSolarColongDeg = 90 - subSolarLongDeg3; - - var subSolarLongitude = Math.Round(subSolarLongDeg3, 2); - var subSolarColongitude = Math.Round(subSolarColongDeg, 2); - var subSolarLatitude = Math.Round(subSolarLatDeg, 2); + double julianDateDays = PAMacros.CivilDateToJulianDate(gwdateDay, gwdateMonth, gwdateYear); + double tCenturies = (julianDateDays - 2451545) / 36525; + double longAscNodeDeg = 125.044522 - 1934.136261 * tCenturies; + double f1 = 93.27191 + 483202.0175 * tCenturies; + double f2 = f1 - 360 * (f1 / 360).Floor(); + double sunGeocentricLongDeg = PAMacros.SunLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); + double moonEquHorParallaxArcMin = PAMacros.MoonHP(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear) * 60; + double sunEarthDistAU = PAMacros.SunDist(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); + double geocentricMoonLatRad = PAMacros.MoonLat(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear).ToRadians(); + double geocentricMoonLongDeg = PAMacros.MoonLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); + double adjustedMoonLongDeg = sunGeocentricLongDeg + 180 + (26.4 * geocentricMoonLatRad.Cosine() * (sunGeocentricLongDeg - geocentricMoonLongDeg).ToRadians().Sine() / (moonEquHorParallaxArcMin * sunEarthDistAU)); + double adjustedMoonLatRad = 0.14666 * geocentricMoonLatRad / (moonEquHorParallaxArcMin * sunEarthDistAU); + double inclinationRad = PAMacros.DegreesMinutesSecondsToDecimalDegrees(1, 32, 32.7).ToRadians(); + double nodeLongRad = (longAscNodeDeg - adjustedMoonLongDeg).ToRadians(); + double sinBs = -inclinationRad.Cosine() * adjustedMoonLatRad.Sine() + inclinationRad.Sine() * adjustedMoonLatRad.Cosine() * nodeLongRad.Sine(); + double subSolarLatDeg = PAMacros.Degrees(sinBs.ASine()); + double aRad = (-adjustedMoonLatRad.Sine() * inclinationRad.Sine() - adjustedMoonLatRad.Cosine() * inclinationRad.Cosine() * nodeLongRad.Sine()).AngleTangent2(adjustedMoonLatRad.Cosine() * nodeLongRad.Cosine()); + double aDeg = PAMacros.Degrees(aRad); + double subSolarLongDeg1 = aDeg - f2; + double subSolarLongDeg2 = subSolarLongDeg1 - 360 * (subSolarLongDeg1 / 360).Floor(); + double subSolarLongDeg3 = (subSolarLongDeg2 > 180) ? subSolarLongDeg2 - 360 : subSolarLongDeg2; + double subSolarColongDeg = 90 - subSolarLongDeg3; + + double subSolarLongitude = Math.Round(subSolarLongDeg3, 2); + double subSolarColongitude = Math.Round(subSolarColongDeg, 2); + double subSolarLatitude = Math.Round(subSolarLatDeg, 2); return (subSolarLongitude, subSolarColongitude, subSolarLatitude); } diff --git a/PALib/PADateTime.cs b/PALib/PADateTime.cs index 6405111..272bd0c 100644 --- a/PALib/PADateTime.cs +++ b/PALib/PADateTime.cs @@ -16,23 +16,23 @@ public class PADateTime { double year = inputYear; - var a = year % 19; - var b = (year / 100).Floor(); - var c = year % 100; - var d = (b / 4).Floor(); - var e = b % 4; - var f = ((b + 8) / 25).Floor(); - var g = ((b - f + 1) / 3).Floor(); - var h = ((19 * a) + b - d - g + 15) % 30; - var i = (c / 4).Floor(); - var k = c % 4; - var l = (32 + 2 * (e + i) - h - k) % 7; - var m = ((a + (11 * h) + (22 * l)) / 451).Floor(); - var n = ((h + l - (7 * m) + 114) / 31).Floor(); - var p = (h + l - (7 * m) + 114) % 31; - - var day = p + 1; - var month = n; + double a = year % 19; + double b = (year / 100).Floor(); + double c = year % 100; + double d = (b / 4).Floor(); + double e = b % 4; + double f = ((b + 8) / 25).Floor(); + double g = ((b - f + 1) / 3).Floor(); + double h = ((19 * a) + b - d - g + 15) % 30; + double i = (c / 4).Floor(); + double k = c % 4; + double l = (32 + 2 * (e + i) - h - k) % 7; + double m = ((a + (11 * h) + (22 * l)) / 451).Floor(); + double n = ((h + l - (7 * m) + 114) / 31).Floor(); + double p = (h + l - (7 * m) + 114) % 31; + + double day = p + 1; + double month = n; return ((int)month, (int)day, (int)year); } @@ -71,9 +71,9 @@ public double CivilTimeToDecimalHours(double hours, double minutes, double secon /// Tuple(hours (double), minutes (double), seconds (double)) public (double hours, double minutes, double seconds) DecimalHoursToCivilTime(double decimalHours) { - var hours = PAMacros.DecimalHoursHour(decimalHours); - var minutes = PAMacros.DecimalHoursMinute(decimalHours); - var seconds = PAMacros.DecimalHoursSecond(decimalHours); + int hours = PAMacros.DecimalHoursHour(decimalHours); + int minutes = PAMacros.DecimalHoursMinute(decimalHours); + double seconds = PAMacros.DecimalHoursSecond(decimalHours); return (hours, minutes, seconds); } @@ -84,20 +84,20 @@ public double CivilTimeToDecimalHours(double hours, double minutes, double secon /// Tuple (int utHours, int utMinutes, int utSeconds, int gwDay, int gwMonth, int gwYear) public (int utHours, int utMinutes, int utSeconds, int gwDay, int gwMonth, int gwYear) LocalCivilTimeToUniversalTime(double lctHours, double lctMinutes, double lctSeconds, bool isDaylightSavings, int zoneCorrection, double localDay, int localMonth, int localYear) { - var lct = CivilTimeToDecimalHours(lctHours, lctMinutes, lctSeconds); + double lct = CivilTimeToDecimalHours(lctHours, lctMinutes, lctSeconds); - var daylightSavingsOffset = isDaylightSavings ? 1 : 0; + int daylightSavingsOffset = isDaylightSavings ? 1 : 0; - var utInterim = lct - daylightSavingsOffset - zoneCorrection; - var gdayInterim = localDay + (utInterim / 24); + double utInterim = lct - daylightSavingsOffset - zoneCorrection; + double gdayInterim = localDay + (utInterim / 24); - var jd = PAMacros.CivilDateToJulianDate(gdayInterim, localMonth, localYear); + double jd = PAMacros.CivilDateToJulianDate(gdayInterim, localMonth, localYear); - var gDay = PAMacros.JulianDateDay(jd); - var gMonth = PAMacros.JulianDateMonth(jd); - var gYear = PAMacros.JulianDateYear(jd); + double gDay = PAMacros.JulianDateDay(jd); + int gMonth = PAMacros.JulianDateMonth(jd); + int gYear = PAMacros.JulianDateYear(jd); - var ut = 24 * (gDay - gDay.Floor()); + double ut = 24 * (gDay - gDay.Floor()); return ( PAMacros.DecimalHoursHour(ut), @@ -115,17 +115,17 @@ public double CivilTimeToDecimalHours(double hours, double minutes, double secon /// Tuple (int lctHours, int lctMinutes, int lctSeconds, int localDay, int localMonth, int localYear) public (int lctHours, int lctMinutes, int lctSeconds, int localDay, int localMonth, int localYear) UniversalTimeToLocalCivilTime(double utHours, double utMinutes, double utSeconds, bool isDaylightSavings, int zoneCorrection, int gwDay, int gwMonth, int gwYear) { - var dstValue = isDaylightSavings ? 1 : 0; - var ut = PAMacros.HMStoDH(utHours, utMinutes, utSeconds); - var zoneTime = ut + zoneCorrection; - var localTime = zoneTime + dstValue; - var localJDPlusLocalTime = PAMacros.CivilDateToJulianDate(gwDay, gwMonth, gwYear) + (localTime / 24); - var localDay = PAMacros.JulianDateDay(localJDPlusLocalTime); - var integerDay = localDay.Floor(); - var localMonth = PAMacros.JulianDateMonth(localJDPlusLocalTime); - var localYear = PAMacros.JulianDateYear(localJDPlusLocalTime); - - var lct = 24 * (localDay - integerDay); + int dstValue = isDaylightSavings ? 1 : 0; + double ut = PAMacros.HMStoDH(utHours, utMinutes, utSeconds); + double zoneTime = ut + zoneCorrection; + double localTime = zoneTime + dstValue; + double localJDPlusLocalTime = PAMacros.CivilDateToJulianDate(gwDay, gwMonth, gwYear) + (localTime / 24); + double localDay = PAMacros.JulianDateDay(localJDPlusLocalTime); + double integerDay = localDay.Floor(); + int localMonth = PAMacros.JulianDateMonth(localJDPlusLocalTime); + int localYear = PAMacros.JulianDateYear(localJDPlusLocalTime); + + double lct = 24 * (localDay - integerDay); return ( PAMacros.DecimalHoursHour(lct), @@ -143,19 +143,19 @@ public double CivilTimeToDecimalHours(double hours, double minutes, double secon /// Tuple (int gstHours, int gstMinutes, double gstSeconds) public (int gstHours, int gstMinutes, double gstSeconds) UniversalTimeToGreenwichSiderealTime(double utHours, double utMinutes, double utSeconds, double gwDay, int gwMonth, int gwYear) { - var jd = PAMacros.CivilDateToJulianDate(gwDay, gwMonth, gwYear); - var s = jd - 2451545; - var t = s / 36525; - var t01 = 6.697374558 + (2400.051336 * t) + (0.000025862 * t * t); - var t02 = t01 - (24.0 * (t01 / 24).Floor()); - var ut = PAMacros.HMStoDH(utHours, utMinutes, utSeconds); - var a = ut * 1.002737909; - var gst1 = t02 + a; - var gst2 = gst1 - (24.0 * (gst1 / 24).Floor()); - - var gstHours = PAMacros.DecimalHoursHour(gst2); - var gstMinutes = PAMacros.DecimalHoursMinute(gst2); - var gstSeconds = PAMacros.DecimalHoursSecond(gst2); + double jd = PAMacros.CivilDateToJulianDate(gwDay, gwMonth, gwYear); + double s = jd - 2451545; + double t = s / 36525; + double t01 = 6.697374558 + (2400.051336 * t) + (0.000025862 * t * t); + double t02 = t01 - (24.0 * (t01 / 24).Floor()); + double ut = PAMacros.HMStoDH(utHours, utMinutes, utSeconds); + double a = ut * 1.002737909; + double gst1 = t02 + a; + double gst2 = gst1 - (24.0 * (gst1 / 24).Floor()); + + int gstHours = PAMacros.DecimalHoursHour(gst2); + int gstMinutes = PAMacros.DecimalHoursMinute(gst2); + double gstSeconds = PAMacros.DecimalHoursSecond(gst2); return (gstHours, gstMinutes, gstSeconds); } @@ -166,21 +166,21 @@ public double CivilTimeToDecimalHours(double hours, double minutes, double secon /// Tuple (int utHours, int utMinutes, double utSeconds, PAWarningFlag warningFlag) public (int utHours, int utMinutes, double utSeconds, PAWarningFlag warningFlag) GreenwichSiderealTimeToUniversalTime(double gstHours, double gstMinutes, double gstSeconds, double gwDay, int gwMonth, int gwYear) { - var jd = PAMacros.CivilDateToJulianDate(gwDay, gwMonth, gwYear); - var s = jd - 2451545; - var t = s / 36525; - var t01 = 6.697374558 + (2400.051336 * t) + (0.000025862 * t * t); - var t02 = t01 - (24 * (t01 / 24).Floor()); - var gstHours1 = PAMacros.HMStoDH(gstHours, gstMinutes, gstSeconds); - - var a = gstHours1 - t02; - var b = a - (24 * (a / 24).Floor()); - var ut = b * 0.9972695663; - var utHours = PAMacros.DecimalHoursHour(ut); - var utMinutes = PAMacros.DecimalHoursMinute(ut); - var utSeconds = PAMacros.DecimalHoursSecond(ut); - - var warningFlag = (ut < 0.065574) ? PAWarningFlag.Warning : PAWarningFlag.OK; + double jd = PAMacros.CivilDateToJulianDate(gwDay, gwMonth, gwYear); + double s = jd - 2451545; + double t = s / 36525; + double t01 = 6.697374558 + (2400.051336 * t) + (0.000025862 * t * t); + double t02 = t01 - (24 * (t01 / 24).Floor()); + double gstHours1 = PAMacros.HMStoDH(gstHours, gstMinutes, gstSeconds); + + double a = gstHours1 - t02; + double b = a - (24 * (a / 24).Floor()); + double ut = b * 0.9972695663; + int utHours = PAMacros.DecimalHoursHour(ut); + int utMinutes = PAMacros.DecimalHoursMinute(ut); + double utSeconds = PAMacros.DecimalHoursSecond(ut); + + PAWarningFlag warningFlag = (ut < 0.065574) ? PAWarningFlag.Warning : PAWarningFlag.OK; return (utHours, utMinutes, utSeconds, warningFlag); } @@ -191,14 +191,14 @@ public double CivilTimeToDecimalHours(double hours, double minutes, double secon /// Tuple (int lstHours, int lstMinutes, double lstSeconds) public (int lstHours, int lstMinutes, double lstSeconds) GreenwichSiderealTimeToLocalSiderealTime(double gstHours, double gstMinutes, double gstSeconds, double geographicalLongitude) { - var gst = PAMacros.HMStoDH(gstHours, gstMinutes, gstSeconds); - var offset = geographicalLongitude / 15; - var lstHours1 = gst + offset; - var lstHours2 = lstHours1 - (24 * (lstHours1 / 24).Floor()); + double gst = PAMacros.HMStoDH(gstHours, gstMinutes, gstSeconds); + double offset = geographicalLongitude / 15; + double lstHours1 = gst + offset; + double lstHours2 = lstHours1 - (24 * (lstHours1 / 24).Floor()); - var lstHours = PAMacros.DecimalHoursHour(lstHours2); - var lstMinutes = PAMacros.DecimalHoursMinute(lstHours2); - var lstSeconds = PAMacros.DecimalHoursSecond(lstHours2); + int lstHours = PAMacros.DecimalHoursHour(lstHours2); + int lstMinutes = PAMacros.DecimalHoursMinute(lstHours2); + double lstSeconds = PAMacros.DecimalHoursSecond(lstHours2); return (lstHours, lstMinutes, lstSeconds); } @@ -209,14 +209,14 @@ public double CivilTimeToDecimalHours(double hours, double minutes, double secon /// Tuple (int gstHours, int gstMinutes, double gstSeconds) public (int gstHours, int gstMinutes, double gstSeconds) LocalSiderealTimeToGreenwichSiderealTime(double lstHours, double lstMinutes, double lstSeconds, double geographicalLongitude) { - var gst = PAMacros.HMStoDH(lstHours, lstMinutes, lstSeconds); - var longHours = geographicalLongitude / 15; - var gst1 = gst - longHours; - var gst2 = gst1 - (24 * (gst1 / 24).Floor()); - - var gstHours = PAMacros.DecimalHoursHour(gst2); - var gstMinutes = PAMacros.DecimalHoursMinute(gst2); - var gstSeconds = PAMacros.DecimalHoursSecond(gst2); + double gst = PAMacros.HMStoDH(lstHours, lstMinutes, lstSeconds); + double longHours = geographicalLongitude / 15; + double gst1 = gst - longHours; + double gst2 = gst1 - (24 * (gst1 / 24).Floor()); + + int gstHours = PAMacros.DecimalHoursHour(gst2); + int gstMinutes = PAMacros.DecimalHoursMinute(gst2); + double gstSeconds = PAMacros.DecimalHoursSecond(gst2); return (gstHours, gstMinutes, gstSeconds); } diff --git a/PALib/PAEclipses.cs b/PALib/PAEclipses.cs index 9ef4094..bfd7d7a 100644 --- a/PALib/PAEclipses.cs +++ b/PALib/PAEclipses.cs @@ -19,26 +19,26 @@ public class PAEclipses /// public (string status, double eventDateDay, int eventDateMonth, int eventDateYear) LunarEclipseOccurrence(double localDateDay, int localDateMonth, int localDateYear, bool isDaylightSaving, int zoneCorrectionHours) { - var daylightSaving = isDaylightSaving ? 1 : 0; + int daylightSaving = isDaylightSaving ? 1 : 0; - var julianDateOfFullMoon = PAMacros.FullMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double julianDateOfFullMoon = PAMacros.FullMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var gDateOfFullMoonDay = PAMacros.JulianDateDay(julianDateOfFullMoon); - var integerDay = gDateOfFullMoonDay.Floor(); - var gDateOfFullMoonMonth = PAMacros.JulianDateMonth(julianDateOfFullMoon); - var gDateOfFullMoonYear = PAMacros.JulianDateYear(julianDateOfFullMoon); - var utOfFullMoonHours = gDateOfFullMoonDay - integerDay; + double gDateOfFullMoonDay = PAMacros.JulianDateDay(julianDateOfFullMoon); + double integerDay = gDateOfFullMoonDay.Floor(); + int gDateOfFullMoonMonth = PAMacros.JulianDateMonth(julianDateOfFullMoon); + int gDateOfFullMoonYear = PAMacros.JulianDateYear(julianDateOfFullMoon); + double utOfFullMoonHours = gDateOfFullMoonDay - integerDay; - var localCivilDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfFullMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfFullMoonMonth, gDateOfFullMoonYear); - var localCivilDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfFullMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfFullMoonMonth, gDateOfFullMoonYear); - var localCivilDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfFullMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfFullMoonMonth, gDateOfFullMoonYear); + double localCivilDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfFullMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfFullMoonMonth, gDateOfFullMoonYear); + int localCivilDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfFullMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfFullMoonMonth, gDateOfFullMoonYear); + int localCivilDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfFullMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfFullMoonMonth, gDateOfFullMoonYear); - var eclipseOccurrence = PAMacros.LunarEclipseOccurrence(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + string eclipseOccurrence = PAMacros.LunarEclipseOccurrence(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var status = eclipseOccurrence; - var eventDateDay = localCivilDateDay; - var eventDateMonth = localCivilDateMonth; - var eventDateYear = localCivilDateYear; + string status = eclipseOccurrence; + double eventDateDay = localCivilDateDay; + int eventDateMonth = localCivilDateMonth; + int eventDateYear = localCivilDateYear; return (status, eventDateDay, eventDateMonth, eventDateYear); } @@ -68,55 +68,55 @@ public class PAEclipses /// public (double lunarEclipseCertainDateDay, double lunarEclipseCertainDateMonth, double lunarEclipseCertainDateYear, double utStartPenPhaseHour, double utStartPenPhaseMinutes, double utStartUmbralPhaseHour, double utStartUmbralPhaseMinutes, double utStartTotalPhaseHour, double utStartTotalPhaseMinutes, double utMidEclipseHour, double utMidEclipseMinutes, double utEndTotalPhaseHour, double utEndTotalPhaseMinutes, double utEndUmbralPhaseHour, double utEndUmbralPhaseMinutes, double utEndPenPhaseHour, double utEndPenPhaseMinutes, double eclipseMagnitude) LunarEclipseCircumstances(double localDateDay, int localDateMonth, int localDateYear, bool isDaylightSaving, int zoneCorrectionHours) { - var daylightSaving = isDaylightSaving ? 1 : 0; + int daylightSaving = isDaylightSaving ? 1 : 0; - var julianDateOfFullMoon = PAMacros.FullMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var gDateOfFullMoonDay = PAMacros.JulianDateDay(julianDateOfFullMoon); - var integerDay = gDateOfFullMoonDay.Floor(); - var gDateOfFullMoonMonth = PAMacros.JulianDateMonth(julianDateOfFullMoon); - var gDateOfFullMoonYear = PAMacros.JulianDateYear(julianDateOfFullMoon); - var utOfFullMoonHours = gDateOfFullMoonDay - integerDay; + double julianDateOfFullMoon = PAMacros.FullMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double gDateOfFullMoonDay = PAMacros.JulianDateDay(julianDateOfFullMoon); + double integerDay = gDateOfFullMoonDay.Floor(); + int gDateOfFullMoonMonth = PAMacros.JulianDateMonth(julianDateOfFullMoon); + int gDateOfFullMoonYear = PAMacros.JulianDateYear(julianDateOfFullMoon); + double utOfFullMoonHours = gDateOfFullMoonDay - integerDay; - var localCivilDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfFullMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfFullMoonMonth, gDateOfFullMoonYear); - var localCivilDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfFullMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfFullMoonMonth, gDateOfFullMoonYear); - var localCivilDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfFullMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfFullMoonMonth, gDateOfFullMoonYear); + double localCivilDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfFullMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfFullMoonMonth, gDateOfFullMoonYear); + int localCivilDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfFullMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfFullMoonMonth, gDateOfFullMoonYear); + int localCivilDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfFullMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfFullMoonMonth, gDateOfFullMoonYear); - var utMaxEclipse = PAMacros.UTMaxLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); - var utFirstContact = PAMacros.UTFirstContactLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); - var utLastContact = PAMacros.UTLastContactLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); - var utStartUmbralPhase = PAMacros.UTStartUmbraLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); - var utEndUmbralPhase = PAMacros.UTEndUmbraLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); - var utStartTotalPhase = PAMacros.UTStartTotalLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); - var utEndTotalPhase = PAMacros.UTEndTotalLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); + double utMaxEclipse = PAMacros.UTMaxLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); + double utFirstContact = PAMacros.UTFirstContactLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); + double utLastContact = PAMacros.UTLastContactLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); + double utStartUmbralPhase = PAMacros.UTStartUmbraLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); + double utEndUmbralPhase = PAMacros.UTEndUmbraLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); + double utStartTotalPhase = PAMacros.UTStartTotalLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); + double utEndTotalPhase = PAMacros.UTEndTotalLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); - var eclipseMagnitude1 = PAMacros.MagLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); + double eclipseMagnitude1 = PAMacros.MagLunarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours); - var lunarEclipseCertainDateDay = localCivilDateDay; - var lunarEclipseCertainDateMonth = localCivilDateMonth; - var lunarEclipseCertainDateYear = localCivilDateYear; + double lunarEclipseCertainDateDay = localCivilDateDay; + int lunarEclipseCertainDateMonth = localCivilDateMonth; + int lunarEclipseCertainDateYear = localCivilDateYear; - var utStartPenPhaseHour = (utFirstContact == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utFirstContact + 0.008333); - var utStartPenPhaseMinutes = (utFirstContact == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utFirstContact + 0.008333); + double utStartPenPhaseHour = (utFirstContact == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utFirstContact + 0.008333); + double utStartPenPhaseMinutes = (utFirstContact == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utFirstContact + 0.008333); - var utStartUmbralPhaseHour = (utStartUmbralPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utStartUmbralPhase + 0.008333); - var utStartUmbralPhaseMinutes = (utStartUmbralPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utStartUmbralPhase + 0.008333); + double utStartUmbralPhaseHour = (utStartUmbralPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utStartUmbralPhase + 0.008333); + double utStartUmbralPhaseMinutes = (utStartUmbralPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utStartUmbralPhase + 0.008333); - var utStartTotalPhaseHour = (utStartTotalPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utStartTotalPhase + 0.008333); - var utStartTotalPhaseMinutes = (utStartTotalPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utStartTotalPhase + 0.008333); + double utStartTotalPhaseHour = (utStartTotalPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utStartTotalPhase + 0.008333); + double utStartTotalPhaseMinutes = (utStartTotalPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utStartTotalPhase + 0.008333); - var utMidEclipseHour = (utMaxEclipse == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utMaxEclipse + 0.008333); - var utMidEclipseMinutes = (utMaxEclipse == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utMaxEclipse + 0.008333); + double utMidEclipseHour = (utMaxEclipse == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utMaxEclipse + 0.008333); + double utMidEclipseMinutes = (utMaxEclipse == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utMaxEclipse + 0.008333); - var utEndTotalPhaseHour = (utEndTotalPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utEndTotalPhase + 0.008333); - var utEndTotalPhaseMinutes = (utEndTotalPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utEndTotalPhase + 0.008333); + double utEndTotalPhaseHour = (utEndTotalPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utEndTotalPhase + 0.008333); + double utEndTotalPhaseMinutes = (utEndTotalPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utEndTotalPhase + 0.008333); - var utEndUmbralPhaseHour = (utEndUmbralPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utEndUmbralPhase + 0.008333); - var utEndUmbralPhaseMinutes = (utEndUmbralPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utEndUmbralPhase + 0.008333); + double utEndUmbralPhaseHour = (utEndUmbralPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utEndUmbralPhase + 0.008333); + double utEndUmbralPhaseMinutes = (utEndUmbralPhase == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utEndUmbralPhase + 0.008333); - var utEndPenPhaseHour = (utLastContact == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utLastContact + 0.008333); - var utEndPenPhaseMinutes = (utLastContact == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utLastContact + 0.008333); + double utEndPenPhaseHour = (utLastContact == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utLastContact + 0.008333); + double utEndPenPhaseMinutes = (utLastContact == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utLastContact + 0.008333); - var eclipseMagnitude = (eclipseMagnitude1 == -99.0) ? -99.0 : Math.Round(eclipseMagnitude1, 2); + double eclipseMagnitude = (eclipseMagnitude1 == -99.0) ? -99.0 : Math.Round(eclipseMagnitude1, 2); return (lunarEclipseCertainDateDay, lunarEclipseCertainDateMonth, lunarEclipseCertainDateYear, utStartPenPhaseHour, utStartPenPhaseMinutes, utStartUmbralPhaseHour, utStartUmbralPhaseMinutes, utStartTotalPhaseHour, utStartTotalPhaseMinutes, utMidEclipseHour, utMidEclipseMinutes, utEndTotalPhaseHour, utEndTotalPhaseMinutes, utEndUmbralPhaseHour, utEndUmbralPhaseMinutes, utEndPenPhaseHour, utEndPenPhaseMinutes, eclipseMagnitude); } @@ -132,25 +132,25 @@ public class PAEclipses /// public (string status, double eventDateDay, int eventDateMonth, int eventDateYear) SolarEclipseOccurrence(double localDateDay, int localDateMonth, int localDateYear, bool isDaylightSaving, int zoneCorrectionHours) { - var daylightSaving = isDaylightSaving ? 1 : 0; + int daylightSaving = isDaylightSaving ? 1 : 0; - var julianDateOfNewMoon = PAMacros.NewMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var gDateOfNewMoonDay = PAMacros.JulianDateDay(julianDateOfNewMoon); - var integerDay = gDateOfNewMoonDay.Floor(); - var gDateOfNewMoonMonth = PAMacros.JulianDateMonth(julianDateOfNewMoon); - var gDateOfNewMoonYear = PAMacros.JulianDateYear(julianDateOfNewMoon); - var utOfNewMoonHours = gDateOfNewMoonDay - integerDay; + double julianDateOfNewMoon = PAMacros.NewMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double gDateOfNewMoonDay = PAMacros.JulianDateDay(julianDateOfNewMoon); + double integerDay = gDateOfNewMoonDay.Floor(); + int gDateOfNewMoonMonth = PAMacros.JulianDateMonth(julianDateOfNewMoon); + int gDateOfNewMoonYear = PAMacros.JulianDateYear(julianDateOfNewMoon); + double utOfNewMoonHours = gDateOfNewMoonDay - integerDay; - var localCivilDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); - var localCivilDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); - var localCivilDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); + double localCivilDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); + int localCivilDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); + int localCivilDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); - var eclipseOccurrence = PAMacros.SolarEclipseOccurrence(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + string eclipseOccurrence = PAMacros.SolarEclipseOccurrence(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var status = eclipseOccurrence; - var eventDateDay = localCivilDateDay; - var eventDateMonth = localCivilDateMonth; - var eventDateYear = localCivilDateYear; + string status = eclipseOccurrence; + double eventDateDay = localCivilDateDay; + int eventDateMonth = localCivilDateMonth; + int eventDateYear = localCivilDateYear; return (status, eventDateDay, eventDateMonth, eventDateYear); } @@ -172,37 +172,37 @@ public class PAEclipses /// public (double solarEclipseCertainDateDay, int solarEclipseCertainDateMonth, int solarEclipseCertainDateYear, double utFirstContactHour, double utFirstContactMinutes, double utMidEclipseHour, double utMidEclipseMinutes, double utLastContactHour, double utLastContactMinutes, double eclipseMagnitude) SolarEclipseCircumstances(double localDateDay, int localDateMonth, int localDateYear, bool isDaylightSaving, int zoneCorrectionHours, double geogLongitudeDeg, double geogLatitudeDeg) { - var daylightSaving = isDaylightSaving ? 1 : 0; + int daylightSaving = isDaylightSaving ? 1 : 0; - var julianDateOfNewMoon = PAMacros.NewMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var gDateOfNewMoonDay = PAMacros.JulianDateDay(julianDateOfNewMoon); - var integerDay = gDateOfNewMoonDay.Floor(); - var gDateOfNewMoonMonth = PAMacros.JulianDateMonth(julianDateOfNewMoon); - var gDateOfNewMoonYear = PAMacros.JulianDateYear(julianDateOfNewMoon); - var utOfNewMoonHours = gDateOfNewMoonDay - integerDay; - var localCivilDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); - var localCivilDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); - var localCivilDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); + double julianDateOfNewMoon = PAMacros.NewMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double gDateOfNewMoonDay = PAMacros.JulianDateDay(julianDateOfNewMoon); + double integerDay = gDateOfNewMoonDay.Floor(); + int gDateOfNewMoonMonth = PAMacros.JulianDateMonth(julianDateOfNewMoon); + int gDateOfNewMoonYear = PAMacros.JulianDateYear(julianDateOfNewMoon); + double utOfNewMoonHours = gDateOfNewMoonDay - integerDay; + double localCivilDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); + int localCivilDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); + int localCivilDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); - var utMaxEclipse = PAMacros.UTMaxSolarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongitudeDeg, geogLatitudeDeg); - var utFirstContact = PAMacros.UTFirstContactSolarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongitudeDeg, geogLatitudeDeg); - var utLastContact = PAMacros.UTLastContactSolarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongitudeDeg, geogLatitudeDeg); - var magnitude = PAMacros.MagSolarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongitudeDeg, geogLatitudeDeg); + double utMaxEclipse = PAMacros.UTMaxSolarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongitudeDeg, geogLatitudeDeg); + double utFirstContact = PAMacros.UTFirstContactSolarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongitudeDeg, geogLatitudeDeg); + double utLastContact = PAMacros.UTLastContactSolarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongitudeDeg, geogLatitudeDeg); + double magnitude = PAMacros.MagSolarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongitudeDeg, geogLatitudeDeg); - var solarEclipseCertainDateDay = localCivilDateDay; - var solarEclipseCertainDateMonth = localCivilDateMonth; - var solarEclipseCertainDateYear = localCivilDateYear; + double solarEclipseCertainDateDay = localCivilDateDay; + int solarEclipseCertainDateMonth = localCivilDateMonth; + int solarEclipseCertainDateYear = localCivilDateYear; - var utFirstContactHour = (utFirstContact == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utFirstContact + 0.008333); - var utFirstContactMinutes = (utFirstContact == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utFirstContact + 0.008333); + double utFirstContactHour = (utFirstContact == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utFirstContact + 0.008333); + double utFirstContactMinutes = (utFirstContact == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utFirstContact + 0.008333); - var utMidEclipseHour = (utMaxEclipse == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utMaxEclipse + 0.008333); - var utMidEclipseMinutes = (utMaxEclipse == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utMaxEclipse + 0.008333); + double utMidEclipseHour = (utMaxEclipse == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utMaxEclipse + 0.008333); + double utMidEclipseMinutes = (utMaxEclipse == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utMaxEclipse + 0.008333); - var utLastContactHour = (utLastContact == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utLastContact + 0.008333); - var utLastContactMinutes = (utLastContact == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utLastContact + 0.008333); + double utLastContactHour = (utLastContact == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utLastContact + 0.008333); + double utLastContactMinutes = (utLastContact == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utLastContact + 0.008333); - var eclipseMagnitude = (magnitude == -99.0) ? -99.0 : Math.Round(magnitude, 3); + double eclipseMagnitude = (magnitude == -99.0) ? -99.0 : Math.Round(magnitude, 3); return (solarEclipseCertainDateDay, solarEclipseCertainDateMonth, solarEclipseCertainDateYear, utFirstContactHour, utFirstContactMinutes, utMidEclipseHour, utMidEclipseMinutes, utLastContactHour, utLastContactMinutes, eclipseMagnitude); } diff --git a/PALib/PAMacros.cs b/PALib/PAMacros.cs index 240c105..c786375 100644 --- a/PALib/PAMacros.cs +++ b/PALib/PAMacros.cs @@ -23,9 +23,9 @@ public static double HMStoDH(double hours, double minutes, double seconds) double fMinutes = minutes; double fSeconds = seconds; - var a = Math.Abs(fSeconds) / 60; - var b = (Math.Abs(fMinutes) + a) / 60; - var c = Math.Abs(fHours) + b; + double a = Math.Abs(fSeconds) / 60; + double b = (Math.Abs(fMinutes) + a) / 60; + double c = Math.Abs(fHours) + b; return (fHours < 0 || fMinutes < 0 || fSeconds < 0) ? -c : c; } @@ -38,10 +38,10 @@ public static double HMStoDH(double hours, double minutes, double seconds) /// public static int DecimalHoursHour(double decimalHours) { - var a = Math.Abs(decimalHours); - var b = a * 3600; - var c = Math.Round(b - 60 * (b / 60).Floor(), 2); - var e = (c == 60) ? b + 60 : b; + double a = Math.Abs(decimalHours); + double b = a * 3600; + double c = Math.Round(b - 60 * (b / 60).Floor(), 2); + double e = (c == 60) ? b + 60 : b; return (decimalHours < 0) ? (int)-(e / 3600).Floor() : (int)(e / 3600).Floor(); } @@ -54,10 +54,10 @@ public static int DecimalHoursHour(double decimalHours) /// public static int DecimalHoursMinute(double decimalHours) { - var a = Math.Abs(decimalHours); - var b = a * 3600; - var c = Math.Round(b - 60 * (b / 60).Floor(), 2); - var e = (c == 60) ? b + 60 : b; + double a = Math.Abs(decimalHours); + double b = a * 3600; + double c = Math.Round(b - 60 * (b / 60).Floor(), 2); + double e = (c == 60) ? b + 60 : b; return (int)(e / 60).Floor() % 60; } @@ -70,10 +70,10 @@ public static int DecimalHoursMinute(double decimalHours) /// public static double DecimalHoursSecond(double decimalHours) { - var a = Math.Abs(decimalHours); - var b = a * 3600; - var c = Math.Round(b - 60 * (b / 60).Floor(), 2); - var d = (c == 60) ? 0 : c; + double a = Math.Abs(decimalHours); + double b = a * 3600; + double c = Math.Round(b - 60 * (b / 60).Floor(), 2); + double d = (c == 60) ? 0 : c; return d; } @@ -86,32 +86,32 @@ public static double DecimalHoursSecond(double decimalHours) /// public static double CivilDateToJulianDate(double day, double month, double year) { - var fDay = (double)day; - var fMonth = (double)month; - var fYear = (double)year; + double fDay = (double)day; + double fMonth = (double)month; + double fYear = (double)year; - var y = (fMonth < 3) ? fYear - 1 : fYear; - var m = (fMonth < 3) ? fMonth + 12 : fMonth; + double y = (fMonth < 3) ? fYear - 1 : fYear; + double m = (fMonth < 3) ? fMonth + 12 : fMonth; double b; if (fYear > 1582) { - var a = (y / 100).Floor(); + double a = (y / 100).Floor(); b = 2 - a + (a / 4).Floor(); } else { if (fYear == 1582 && fMonth > 10) { - var a = (y / 100).Floor(); + double a = (y / 100).Floor(); b = 2 - a + (a / 4).Floor(); } else { if (fYear == 1582 && fMonth == 10 && fDay >= 15) { - var a = (y / 100).Floor(); + double a = (y / 100).Floor(); b = 2 - a + (a / 4).Floor(); } else @@ -119,8 +119,8 @@ public static double CivilDateToJulianDate(double day, double month, double year } } - var c = (y < 0) ? ((365.25 * y) - 0.75).Floor() : (365.25 * y).Floor(); - var d = (30.6001 * (m + 1.0)).Floor(); + double c = (y < 0) ? ((365.25 * y) - 0.75).Floor() : (365.25 * y).Floor(); + double d = (30.6001 * (m + 1.0)).Floor(); return b + c + d + fDay + 1720994.5; } @@ -133,14 +133,14 @@ public static double CivilDateToJulianDate(double day, double month, double year /// public static double JulianDateDay(double julianDate) { - var i = (julianDate + 0.5).Floor(); - var f = julianDate + 0.5 - i; - var a = ((i - 1867216.25) / 36524.25).Floor(); - var b = (i > 2299160) ? i + 1 + a - (a / 4).Floor() : i; - var c = b + 1524; - var d = ((c - 122.1) / 365.25).Floor(); - var e = (365.25 * d).Floor(); - var g = ((c - e) / 30.6001).Floor(); + double i = (julianDate + 0.5).Floor(); + double f = julianDate + 0.5 - i; + double a = ((i - 1867216.25) / 36524.25).Floor(); + double b = (i > 2299160) ? i + 1 + a - (a / 4).Floor() : i; + double c = b + 1524; + double d = ((c - 122.1) / 365.25).Floor(); + double e = (365.25 * d).Floor(); + double g = ((c - e) / 30.6001).Floor(); return c - e + f - (30.6001 * g).Floor(); } @@ -153,15 +153,15 @@ public static double JulianDateDay(double julianDate) /// public static int JulianDateMonth(double julianDate) { - var i = (julianDate + 0.5).Floor(); - var a = ((i - 1867216.25) / 36524.25).Floor(); - var b = (i > 2299160) ? i + 1 + a - (a / 4).Floor() : i; - var c = b + 1524; - var d = ((c - 122.1) / 365.25).Floor(); - var e = (365.25 * d).Floor(); - var g = ((c - e) / 30.6001).Floor(); + double i = (julianDate + 0.5).Floor(); + double a = ((i - 1867216.25) / 36524.25).Floor(); + double b = (i > 2299160) ? i + 1 + a - (a / 4).Floor() : i; + double c = b + 1524; + double d = ((c - 122.1) / 365.25).Floor(); + double e = (365.25 * d).Floor(); + double g = ((c - e) / 30.6001).Floor(); - var returnValue = (g < 13.5) ? g - 1 : g - 13; + double returnValue = (g < 13.5) ? g - 1 : g - 13; return (int)returnValue; } @@ -174,16 +174,16 @@ public static int JulianDateMonth(double julianDate) /// public static int JulianDateYear(double julianDate) { - var i = (julianDate + 0.5).Floor(); - var a = ((i - 1867216.25) / 36524.25).Floor(); - var b = (i > 2299160) ? i + 1.0 + a - (a / 4.0).Floor() : i; - var c = b + 1524; - var d = ((c - 122.1) / 365.25).Floor(); - var e = (365.25 * d).Floor(); - var g = ((c - e) / 30.6001).Floor(); - var h = (g < 13.5) ? g - 1 : g - 13; + double i = (julianDate + 0.5).Floor(); + double a = ((i - 1867216.25) / 36524.25).Floor(); + double b = (i > 2299160) ? i + 1.0 + a - (a / 4.0).Floor() : i; + double c = b + 1524; + double d = ((c - 122.1) / 365.25).Floor(); + double e = (365.25 * d).Floor(); + double g = ((c - e) / 30.6001).Floor(); + double h = (g < 13.5) ? g - 1 : g - 13; - var returnValue = (h > 2.5) ? d - 4716 : d - 4715; + double returnValue = (h > 2.5) ? d - 4716 : d - 4715; return (int)returnValue; } @@ -196,14 +196,14 @@ public static int JulianDateYear(double julianDate) /// public static double RightAscensionToHourAngle(double raHours, double raMinutes, double raSeconds, double lctHours, double lctMinutes, double lctSeconds, int daylightSaving, int zoneCorrection, double localDay, int localMonth, int localYear, double geographicalLongitude) { - var a = LocalCivilTimeToUniversalTime(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var b = LocalCivilTimeGreenwichDay(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var c = LocalCivilTimeGreenwichMonth(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var d = LocalCivilTimeGreenwichYear(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var e = UniversalTimeToGreenwichSiderealTime(a, 0, 0, b, c, d); - var f = GreenwichSiderealTimeToLocalSiderealTime(e, 0, 0, geographicalLongitude); - var g = HMStoDH(raHours, raMinutes, raSeconds); - var h = f - g; + double a = LocalCivilTimeToUniversalTime(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + double b = LocalCivilTimeGreenwichDay(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + int c = LocalCivilTimeGreenwichMonth(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + int d = LocalCivilTimeGreenwichYear(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + double e = UniversalTimeToGreenwichSiderealTime(a, 0, 0, b, c, d); + double f = GreenwichSiderealTimeToLocalSiderealTime(e, 0, 0, geographicalLongitude); + double g = HMStoDH(raHours, raMinutes, raSeconds); + double h = f - g; return (h < 0) ? 24 + h : h; } @@ -216,14 +216,14 @@ public static double RightAscensionToHourAngle(double raHours, double raMinutes, /// public static double HourAngleToRightAscension(double hourAngleHours, double hourAngleMinutes, double hourAngleSeconds, double lctHours, double lctMinutes, double lctSeconds, int daylightSaving, int zoneCorrection, double localDay, int localMonth, int localYear, double geographicalLongitude) { - var a = LocalCivilTimeToUniversalTime(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var b = LocalCivilTimeGreenwichDay(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var c = LocalCivilTimeGreenwichMonth(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var d = LocalCivilTimeGreenwichYear(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var e = UniversalTimeToGreenwichSiderealTime(a, 0, 0, b, c, d); - var f = GreenwichSiderealTimeToLocalSiderealTime(e, 0, 00, geographicalLongitude); - var g = HMStoDH(hourAngleHours, hourAngleMinutes, hourAngleSeconds); - var h = f - g; + double a = LocalCivilTimeToUniversalTime(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + double b = LocalCivilTimeGreenwichDay(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + int c = LocalCivilTimeGreenwichMonth(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + int d = LocalCivilTimeGreenwichYear(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + double e = UniversalTimeToGreenwichSiderealTime(a, 0, 0, b, c, d); + double f = GreenwichSiderealTimeToLocalSiderealTime(e, 0, 00, geographicalLongitude); + double g = HMStoDH(hourAngleHours, hourAngleMinutes, hourAngleSeconds); + double h = f - g; return (h < 0) ? 24 + h : h; } @@ -236,12 +236,12 @@ public static double HourAngleToRightAscension(double hourAngleHours, double hou /// public static double LocalCivilTimeToUniversalTime(double lctHours, double lctMinutes, double lctSeconds, int daylightSaving, int zoneCorrection, double localDay, int localMonth, int localYear) { - var a = HMStoDH(lctHours, lctMinutes, lctSeconds); - var b = a - daylightSaving - zoneCorrection; - var c = localDay + (b / 24); - var d = CivilDateToJulianDate(c, localMonth, localYear); - var e = JulianDateDay(d); - var e1 = e.Floor(); + double a = HMStoDH(lctHours, lctMinutes, lctSeconds); + double b = a - daylightSaving - zoneCorrection; + double c = localDay + (b / 24); + double d = CivilDateToJulianDate(c, localMonth, localYear); + double e = JulianDateDay(d); + double e1 = e.Floor(); return 24 * (e - e1); } @@ -254,12 +254,12 @@ public static double LocalCivilTimeToUniversalTime(double lctHours, double lctMi /// public static double UniversalTimeToLocalCivilTime(double uHours, double uMinutes, double uSeconds, int daylightSaving, int zoneCorrection, double greenwichDay, int greenwichMonth, int greenwichYear) { - var a = HMStoDH(uHours, uMinutes, uSeconds); - var b = a + zoneCorrection; - var c = b + daylightSaving; - var d = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear) + (c / 24); - var e = JulianDateDay(d); - var e1 = e.Floor(); + double a = HMStoDH(uHours, uMinutes, uSeconds); + double b = a + zoneCorrection; + double c = b + daylightSaving; + double d = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear) + (c / 24); + double e = JulianDateDay(d); + double e1 = e.Floor(); return 24 * (e - e1); } @@ -272,12 +272,12 @@ public static double UniversalTimeToLocalCivilTime(double uHours, double uMinute /// public static double UniversalTime_LocalCivilDay(double uHours, double uMinutes, double uSeconds, int daylightSaving, int zoneCorrection, double greenwichDay, int greenwichMonth, int greenwichYear) { - var a = HMStoDH(uHours, uMinutes, uSeconds); - var b = a + zoneCorrection; - var c = b + daylightSaving; - var d = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear) + (c / 24.0); - var e = JulianDateDay(d); - var e1 = e.Floor(); + double a = HMStoDH(uHours, uMinutes, uSeconds); + double b = a + zoneCorrection; + double c = b + daylightSaving; + double d = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear) + (c / 24.0); + double e = JulianDateDay(d); + double e1 = e.Floor(); return e1; } @@ -290,10 +290,10 @@ public static double UniversalTime_LocalCivilDay(double uHours, double uMinutes, /// public static int UniversalTime_LocalCivilMonth(double uHours, double uMinutes, double uSeconds, int daylightSaving, int zoneCorrection, double greenwichDay, int greenwichMonth, int greenwichYear) { - var a = HMStoDH(uHours, uMinutes, uSeconds); - var b = a + zoneCorrection; - var c = b + daylightSaving; - var d = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear) + (c / 24.0); + double a = HMStoDH(uHours, uMinutes, uSeconds); + double b = a + zoneCorrection; + double c = b + daylightSaving; + double d = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear) + (c / 24.0); return JulianDateMonth(d); } @@ -306,10 +306,10 @@ public static int UniversalTime_LocalCivilMonth(double uHours, double uMinutes, /// public static int UniversalTime_LocalCivilYear(double uHours, double uMinutes, double uSeconds, int daylightSaving, int zoneCorrection, double greenwichDay, int greenwichMonth, int greenwichYear) { - var a = HMStoDH(uHours, uMinutes, uSeconds); - var b = a + zoneCorrection; - var c = b + daylightSaving; - var d = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear) + (c / 24.0); + double a = HMStoDH(uHours, uMinutes, uSeconds); + double b = a + zoneCorrection; + double c = b + daylightSaving; + double d = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear) + (c / 24.0); return JulianDateYear(d); } @@ -322,11 +322,11 @@ public static int UniversalTime_LocalCivilYear(double uHours, double uMinutes, d /// public static double LocalCivilTimeGreenwichDay(double lctHours, double lctMinutes, double lctSeconds, int daylightSaving, int zoneCorrection, double localDay, int localMonth, int localYear) { - var a = HMStoDH(lctHours, lctMinutes, lctSeconds); - var b = a - daylightSaving - zoneCorrection; - var c = localDay + (b / 24); - var d = CivilDateToJulianDate(c, localMonth, localYear); - var e = JulianDateDay(d); + double a = HMStoDH(lctHours, lctMinutes, lctSeconds); + double b = a - daylightSaving - zoneCorrection; + double c = localDay + (b / 24); + double d = CivilDateToJulianDate(c, localMonth, localYear); + double e = JulianDateDay(d); return e.Floor(); } @@ -339,10 +339,10 @@ public static double LocalCivilTimeGreenwichDay(double lctHours, double lctMinut /// public static int LocalCivilTimeGreenwichMonth(double lctHours, double lctMinutes, double lctSeconds, int daylightSaving, int zoneCorrection, double localDay, int localMonth, int localYear) { - var a = HMStoDH(lctHours, lctMinutes, lctSeconds); - var b = a - daylightSaving - zoneCorrection; - var c = localDay + (b / 24); - var d = CivilDateToJulianDate(c, localMonth, localYear); + double a = HMStoDH(lctHours, lctMinutes, lctSeconds); + double b = a - daylightSaving - zoneCorrection; + double c = localDay + (b / 24); + double d = CivilDateToJulianDate(c, localMonth, localYear); return JulianDateMonth(d); } @@ -355,10 +355,10 @@ public static int LocalCivilTimeGreenwichMonth(double lctHours, double lctMinute /// public static int LocalCivilTimeGreenwichYear(double lctHours, double lctMinutes, double lctSeconds, int daylightSaving, int zoneCorrection, double localDay, int localMonth, int localYear) { - var a = HMStoDH(lctHours, lctMinutes, lctSeconds); - var b = a - daylightSaving - zoneCorrection; - var c = localDay + (b / 24); - var d = CivilDateToJulianDate(c, localMonth, localYear); + double a = HMStoDH(lctHours, lctMinutes, lctSeconds); + double b = a - daylightSaving - zoneCorrection; + double c = localDay + (b / 24); + double d = CivilDateToJulianDate(c, localMonth, localYear); return JulianDateYear(d); } @@ -371,14 +371,14 @@ public static int LocalCivilTimeGreenwichYear(double lctHours, double lctMinutes /// public static double UniversalTimeToGreenwichSiderealTime(double uHours, double uMinutes, double uSeconds, double greenwichDay, int greenwichMonth, int greenwichYear) { - var a = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear); - var b = a - 2451545; - var c = b / 36525; - var d = 6.697374558 + (2400.051336 * c) + (0.000025862 * c * c); - var e = d - (24 * (d / 24).Floor()); - var f = HMStoDH(uHours, uMinutes, uSeconds); - var g = f * 1.002737909; - var h = e + g; + double a = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear); + double b = a - 2451545; + double c = b / 36525; + double d = 6.697374558 + (2400.051336 * c) + (0.000025862 * c * c); + double e = d - (24 * (d / 24).Floor()); + double f = HMStoDH(uHours, uMinutes, uSeconds); + double g = f * 1.002737909; + double h = e + g; return h - (24 * (h / 24).Floor()); } @@ -391,9 +391,9 @@ public static double UniversalTimeToGreenwichSiderealTime(double uHours, double /// public static double GreenwichSiderealTimeToLocalSiderealTime(double greenwichHours, double greenwichMinutes, double greenwichSeconds, double geographicalLongitude) { - var a = HMStoDH(greenwichHours, greenwichMinutes, greenwichSeconds); - var b = geographicalLongitude / 15; - var c = a + b; + double a = HMStoDH(greenwichHours, greenwichMinutes, greenwichSeconds); + double b = geographicalLongitude / 15; + double c = a + b; return c - (24 * (c / 24).Floor()); } @@ -406,16 +406,16 @@ public static double GreenwichSiderealTimeToLocalSiderealTime(double greenwichHo /// public static double EquatorialCoordinatesToAzimuth(double hourAngleHours, double hourAngleMinutes, double hourAngleSeconds, double declinationDegrees, double declinationMinutes, double declinationSeconds, double geographicalLatitude) { - var a = HMStoDH(hourAngleHours, hourAngleMinutes, hourAngleSeconds); - var b = a * 15; - var c = b.ToRadians(); - var d = DegreesMinutesSecondsToDecimalDegrees(declinationDegrees, declinationMinutes, declinationSeconds); - var e = d.ToRadians(); - var f = geographicalLatitude.ToRadians(); - var g = e.Sine() * f.Sine() + e.Cosine() * f.Cosine() * c.Cosine(); - var h = -e.Cosine() * f.Cosine() * c.Sine(); - var i = e.Sine() - (f.Sine() * g); - var j = Degrees(h.AngleTangent2(i)); + double a = HMStoDH(hourAngleHours, hourAngleMinutes, hourAngleSeconds); + double b = a * 15; + double c = b.ToRadians(); + double d = DegreesMinutesSecondsToDecimalDegrees(declinationDegrees, declinationMinutes, declinationSeconds); + double e = d.ToRadians(); + double f = geographicalLatitude.ToRadians(); + double g = e.Sine() * f.Sine() + e.Cosine() * f.Cosine() * c.Cosine(); + double h = -e.Cosine() * f.Cosine() * c.Sine(); + double i = e.Sine() - (f.Sine() * g); + double j = Degrees(h.AngleTangent2(i)); return j - 360.0 * (j / 360).Floor(); } @@ -428,13 +428,13 @@ public static double EquatorialCoordinatesToAzimuth(double hourAngleHours, doubl /// public static double EquatorialCoordinatesToAltitude(double hourAngleHours, double hourAngleMinutes, double hourAngleSeconds, double declinationDegrees, double declinationMinutes, double declinationSeconds, double geographicalLatitude) { - var a = HMStoDH(hourAngleHours, hourAngleMinutes, hourAngleSeconds); - var b = a * 15; - var c = b.ToRadians(); - var d = DegreesMinutesSecondsToDecimalDegrees(declinationDegrees, declinationMinutes, declinationSeconds); - var e = d.ToRadians(); - var f = geographicalLatitude.ToRadians(); - var g = e.Sine() * f.Sine() + e.Cosine() * f.Cosine() * c.Cosine(); + double a = HMStoDH(hourAngleHours, hourAngleMinutes, hourAngleSeconds); + double b = a * 15; + double c = b.ToRadians(); + double d = DegreesMinutesSecondsToDecimalDegrees(declinationDegrees, declinationMinutes, declinationSeconds); + double e = d.ToRadians(); + double f = geographicalLatitude.ToRadians(); + double g = e.Sine() * f.Sine() + e.Cosine() * f.Cosine() * c.Cosine(); return Degrees(g.ASine()); } @@ -447,9 +447,9 @@ public static double EquatorialCoordinatesToAltitude(double hourAngleHours, doub /// public static double DegreesMinutesSecondsToDecimalDegrees(double degrees, double minutes, double seconds) { - var a = Math.Abs(seconds) / 60; - var b = (Math.Abs(minutes) + a) / 60; - var c = Math.Abs(degrees) + b; + double a = Math.Abs(seconds) / 60; + double b = (Math.Abs(minutes) + a) / 60; + double c = Math.Abs(degrees) + b; return (degrees < 0 || minutes < 0 || seconds < 0) ? -c : c; } @@ -473,10 +473,10 @@ public static double Degrees(double w) /// public static double DecimalDegreesDegrees(double decimalDegrees) { - var a = Math.Abs(decimalDegrees); - var b = a * 3600; - var c = Math.Round(b - 60 * (b / 60).Floor(), 2); - var e = (c == 60) ? 60 : b; + double a = Math.Abs(decimalDegrees); + double b = a * 3600; + double c = Math.Round(b - 60 * (b / 60).Floor(), 2); + double e = (c == 60) ? 60 : b; return (decimalDegrees < 0) ? -(e / 3600).Floor() : (e / 3600).Floor(); } @@ -489,10 +489,10 @@ public static double DecimalDegreesDegrees(double decimalDegrees) /// public static double DecimalDegreesMinutes(double decimalDegrees) { - var a = Math.Abs(decimalDegrees); - var b = a * 3600; - var c = Math.Round(b - 60 * (b / 60).Floor(), 2); - var e = (c == 60) ? b + 60 : b; + double a = Math.Abs(decimalDegrees); + double b = a * 3600; + double c = Math.Round(b - 60 * (b / 60).Floor(), 2); + double e = (c == 60) ? b + 60 : b; return (e / 60).Floor() % 60; } @@ -505,10 +505,10 @@ public static double DecimalDegreesMinutes(double decimalDegrees) /// public static double DecimalDegreesSeconds(double decimalDegrees) { - var a = Math.Abs(decimalDegrees); - var b = a * 3600; - var c = Math.Round(b - 60 * (b / 60).Floor(), 2); - var d = (c == 60) ? 0 : c; + double a = Math.Abs(decimalDegrees); + double b = a * 3600; + double c = Math.Round(b - 60 * (b / 60).Floor(), 2); + double d = (c == 60) ? 0 : c; return d; } @@ -543,12 +543,12 @@ public static double DegreeHoursToDecimalDegrees(double degreeHours) /// public static double HorizonCoordinatesToDeclination(double azimuthDegrees, double azimuthMinutes, double azimuthSeconds, double altitudeDegrees, double altitudeMinutes, double altitudeSeconds, double geographicalLatitude) { - var a = DegreesMinutesSecondsToDecimalDegrees(azimuthDegrees, azimuthMinutes, azimuthSeconds); - var b = DegreesMinutesSecondsToDecimalDegrees(altitudeDegrees, altitudeMinutes, altitudeSeconds); - var c = a.ToRadians(); - var d = b.ToRadians(); - var e = geographicalLatitude.ToRadians(); - var f = d.Sine() * e.Sine() + d.Cosine() * e.Cosine() * c.Cosine(); + double a = DegreesMinutesSecondsToDecimalDegrees(azimuthDegrees, azimuthMinutes, azimuthSeconds); + double b = DegreesMinutesSecondsToDecimalDegrees(altitudeDegrees, altitudeMinutes, altitudeSeconds); + double c = a.ToRadians(); + double d = b.ToRadians(); + double e = geographicalLatitude.ToRadians(); + double f = d.Sine() * e.Sine() + d.Cosine() * e.Cosine() * c.Cosine(); return Degrees(f.ASine()); } @@ -561,15 +561,15 @@ public static double HorizonCoordinatesToDeclination(double azimuthDegrees, doub /// public static double HorizonCoordinatesToHourAngle(double azimuthDegrees, double azimuthMinutes, double azimuthSeconds, double altitudeDegrees, double altitudeMinutes, double altitudeSeconds, double geographicalLatitude) { - var a = DegreesMinutesSecondsToDecimalDegrees(azimuthDegrees, azimuthMinutes, azimuthSeconds); - var b = DegreesMinutesSecondsToDecimalDegrees(altitudeDegrees, altitudeMinutes, altitudeSeconds); - var c = a.ToRadians(); - var d = b.ToRadians(); - var e = geographicalLatitude.ToRadians(); - var f = d.Sine() * e.Sine() + d.Cosine() * e.Cosine() * c.Cosine(); - var g = -d.Cosine() * e.Cosine() * c.Sine(); - var h = d.Sine() - e.Sine() * f; - var i = DecimalDegreesToDegreeHours(Degrees(g.AngleTangent2(h))); + double a = DegreesMinutesSecondsToDecimalDegrees(azimuthDegrees, azimuthMinutes, azimuthSeconds); + double b = DegreesMinutesSecondsToDecimalDegrees(altitudeDegrees, altitudeMinutes, altitudeSeconds); + double c = a.ToRadians(); + double d = b.ToRadians(); + double e = geographicalLatitude.ToRadians(); + double f = d.Sine() * e.Sine() + d.Cosine() * e.Cosine() * c.Cosine(); + double g = -d.Cosine() * e.Cosine() * c.Sine(); + double h = d.Sine() - e.Sine() * f; + double i = DecimalDegreesToDegreeHours(Degrees(g.AngleTangent2(h))); return i - 24 * (i / 24).Floor(); } @@ -582,11 +582,11 @@ public static double HorizonCoordinatesToHourAngle(double azimuthDegrees, double /// public static double Obliq(double greenwichDay, int greenwichMonth, int greenwichYear) { - var a = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear); - var b = a - 2415020; - var c = (b / 36525) - 1; - var d = c * (46.815 + c * (0.0006 - (c * 0.00181))); - var e = d / 3600; + double a = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear); + double b = a - 2415020; + double c = (b / 36525) - 1; + double d = c * (46.815 + c * (0.0006 - (c * 0.00181))); + double e = d / 3600; return 23.43929167 - e + NutatObl(greenwichDay, greenwichMonth, greenwichYear); } @@ -599,43 +599,43 @@ public static double Obliq(double greenwichDay, int greenwichMonth, int greenwic /// public static double NutatLong(double gd, int gm, int gy) { - var dj = CivilDateToJulianDate(gd, gm, gy) - 2415020; - var t = dj / 36525; - var t2 = t * t; + double dj = CivilDateToJulianDate(gd, gm, gy) - 2415020; + double t = dj / 36525; + double t2 = t * t; - var a = 100.0021358 * t; - var b = 360 * (a - a.Floor()); + double a = 100.0021358 * t; + double b = 360 * (a - a.Floor()); - var l1 = 279.6967 + 0.000303 * t2 + b; - var l2 = 2 * l1.ToRadians(); + double l1 = 279.6967 + 0.000303 * t2 + b; + double l2 = 2 * l1.ToRadians(); a = 1336.855231 * t; b = 360 * (a - a.Floor()); - var d1 = 270.4342 - 0.001133 * t2 + b; - var d2 = 2 * d1.ToRadians(); + double d1 = 270.4342 - 0.001133 * t2 + b; + double d2 = 2 * d1.ToRadians(); a = 99.99736056 * t; b = 360 * (a - a.Floor()); - var m1 = 358.4758 - 0.00015 * t2 + b; + double m1 = 358.4758 - 0.00015 * t2 + b; m1 = m1.ToRadians(); a = 1325.552359 * t; b = 360 * (a - a.Floor()); - var m2 = 296.1046 + 0.009192 * t2 + b; + double m2 = 296.1046 + 0.009192 * t2 + b; m2 = m2.ToRadians(); a = 5.372616667 * t; b = 360 * (a - a.Floor()); - var n1 = 259.1833 + 0.002078 * t2 - b; + double n1 = 259.1833 + 0.002078 * t2 - b; n1 = n1.ToRadians(); - var n2 = 2.0 * n1; + double n2 = 2.0 * n1; - var dp = (-17.2327 - 0.01737 * t) * n1.Sine(); + double dp = (-17.2327 - 0.01737 * t) * n1.Sine(); dp = dp + (-1.2729 - 0.00013 * t) * l2.Sine() + 0.2088 * n2.Sine(); dp = dp - 0.2037 * d2.Sine() + (0.1261 - 0.00031 * t) * m1.Sine(); dp = dp + 0.0675 * m2.Sine() - (0.0497 - 0.00012 * t) * (l2 + m1).Sine(); @@ -654,40 +654,40 @@ public static double NutatLong(double gd, int gm, int gy) /// public static double NutatObl(double greenwichDay, int greenwichMonth, int greenwichYear) { - var dj = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear) - 2415020; - var t = dj / 36525; - var t2 = t * t; + double dj = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear) - 2415020; + double t = dj / 36525; + double t2 = t * t; - var a = 100.0021358 * t; - var b = 360 * (a - a.Floor()); + double a = 100.0021358 * t; + double b = 360 * (a - a.Floor()); - var l1 = 279.6967 + 0.000303 * t2 + b; - var l2 = 2 * l1.ToRadians(); + double l1 = 279.6967 + 0.000303 * t2 + b; + double l2 = 2 * l1.ToRadians(); a = 1336.855231 * t; b = 360 * (a - a.Floor()); - var d1 = 270.4342 - 0.001133 * t2 + b; - var d2 = 2 * d1.ToRadians(); + double d1 = 270.4342 - 0.001133 * t2 + b; + double d2 = 2 * d1.ToRadians(); a = 99.99736056 * t; b = 360 * (a - a.Floor()); - var m1 = (358.4758 - 0.00015 * t2 + b).ToRadians(); + double m1 = (358.4758 - 0.00015 * t2 + b).ToRadians(); a = 1325.552359 * t; b = 360 * (a - a.Floor()); - var m2 = (296.1046 + 0.009192 * t2 + b).ToRadians(); + double m2 = (296.1046 + 0.009192 * t2 + b).ToRadians(); a = 5.372616667 * t; b = 360 * (a - a.Floor()); - var n1 = (259.1833 + 0.002078 * t2 - b).ToRadians(); + double n1 = (259.1833 + 0.002078 * t2 - b).ToRadians(); - var n2 = 2 * n1; + double n2 = 2 * n1; - var ddo = (9.21 + 0.00091 * t) * n1.Cosine(); + double ddo = (9.21 + 0.00091 * t) * n1.Cosine(); ddo = ddo + (0.5522 - 0.00029 * t) * l2.Cosine() - 0.0904 * n2.Cosine(); ddo = ddo + 0.0884 * d2.Cosine() + 0.0216 * (l2 + m1).Cosine(); ddo = ddo + 0.0183 * (d2 - n1).Cosine() + 0.0113 * (d2 + m2).Cosine(); @@ -704,9 +704,9 @@ public static double NutatObl(double greenwichDay, int greenwichMonth, int green /// public static double LocalSiderealTimeToGreenwichSiderealTime(double localHours, double localMinutes, double localSeconds, double longitude) { - var a = HMStoDH(localHours, localMinutes, localSeconds); - var b = longitude / 15; - var c = a - b; + double a = HMStoDH(localHours, localMinutes, localSeconds); + double b = longitude / 15; + double c = a - b; return c - (24 * (c / 24).Floor()); } @@ -719,14 +719,14 @@ public static double LocalSiderealTimeToGreenwichSiderealTime(double localHours, /// public static double GreenwichSiderealTimeToUniversalTime(double greenwichSiderealHours, double greenwichSiderealMinutes, double greenwichSiderealSeconds, double greenwichDay, int greenwichMonth, int greenwichYear) { - var a = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear); - var b = a - 2451545; - var c = b / 36525; - var d = 6.697374558 + (2400.051336 * c) + (0.000025862 * c * c); - var e = d - (24 * (d / 24).Floor()); - var f = HMStoDH(greenwichSiderealHours, greenwichSiderealMinutes, greenwichSiderealSeconds); - var g = f - e; - var h = g - (24 * (g / 24).Floor()); + double a = CivilDateToJulianDate(greenwichDay, greenwichMonth, greenwichYear); + double b = a - 2451545; + double c = b / 36525; + double d = 6.697374558 + (2400.051336 * c) + (0.000025862 * c * c); + double e = d - (24 * (d / 24).Floor()); + double f = HMStoDH(greenwichSiderealHours, greenwichSiderealMinutes, greenwichSiderealSeconds); + double g = f - e; + double h = g - (24 * (g / 24).Floor()); return h * 0.9972695663; } @@ -739,14 +739,14 @@ public static double GreenwichSiderealTimeToUniversalTime(double greenwichSidere /// public static PAWarningFlag EGstUt(double gsh, double gsm, double gss, double gd, int gm, int gy) { - var a = CivilDateToJulianDate(gd, gm, gy); - var b = a - 2451545; - var c = b / 36525; - var d = 6.697374558 + (2400.051336 * c) + (0.000025862 * c * c); - var e = d - (24 * (d / 24).Floor()); - var f = HMStoDH(gsh, gsm, gss); - var g = f - e; - var h = g - (24 * (g / 24).Floor()); + double a = CivilDateToJulianDate(gd, gm, gy); + double b = a - 2451545; + double c = b / 36525; + double d = 6.697374558 + (2400.051336 * c) + (0.000025862 * c * c); + double e = d - (24 * (d / 24).Floor()); + double f = HMStoDH(gsh, gsm, gss); + double g = f - e; + double h = g - (24 * (g / 24).Floor()); return ((h * 0.9972695663) < (4.0 / 60.0)) ? PAWarningFlag.Warning : PAWarningFlag.OK; } @@ -759,54 +759,54 @@ public static PAWarningFlag EGstUt(double gsh, double gsm, double gss, double gd /// public static double SunLong(double lch, double lcm, double lcs, int ds, int zc, double ld, int lm, int ly) { - var aa = LocalCivilTimeGreenwichDay(lch, lcm, lcs, ds, zc, ld, lm, ly); - var bb = LocalCivilTimeGreenwichMonth(lch, lcm, lcs, ds, zc, ld, lm, ly); - var cc = LocalCivilTimeGreenwichYear(lch, lcm, lcs, ds, zc, ld, lm, ly); - var ut = LocalCivilTimeToUniversalTime(lch, lcm, lcs, ds, zc, ld, lm, ly); - var dj = CivilDateToJulianDate(aa, bb, cc) - 2415020; - var t = (dj / 36525) + (ut / 876600); - var t2 = t * t; - var a = 100.0021359 * t; - var b = 360.0 * (a - a.Floor()); - - var l = 279.69668 + 0.0003025 * t2 + b; + double aa = LocalCivilTimeGreenwichDay(lch, lcm, lcs, ds, zc, ld, lm, ly); + int bb = LocalCivilTimeGreenwichMonth(lch, lcm, lcs, ds, zc, ld, lm, ly); + int cc = LocalCivilTimeGreenwichYear(lch, lcm, lcs, ds, zc, ld, lm, ly); + double ut = LocalCivilTimeToUniversalTime(lch, lcm, lcs, ds, zc, ld, lm, ly); + double dj = CivilDateToJulianDate(aa, bb, cc) - 2415020; + double t = (dj / 36525) + (ut / 876600); + double t2 = t * t; + double a = 100.0021359 * t; + double b = 360.0 * (a - a.Floor()); + + double l = 279.69668 + 0.0003025 * t2 + b; a = 99.99736042 * t; b = 360 * (a - a.Floor()); - var m1 = 358.47583 - (0.00015 + 0.0000033 * t) * t2 + b; - var ec = 0.01675104 - 0.0000418 * t - 0.000000126 * t2; + double m1 = 358.47583 - (0.00015 + 0.0000033 * t) * t2 + b; + double ec = 0.01675104 - 0.0000418 * t - 0.000000126 * t2; - var am = m1.ToRadians(); - var at = TrueAnomaly(am, ec); + double am = m1.ToRadians(); + double at = TrueAnomaly(am, ec); a = 62.55209472 * t; b = 360 * (a - a.Floor()); - var a1 = (153.23 + b).ToRadians(); + double a1 = (153.23 + b).ToRadians(); a = 125.1041894 * t; b = 360 * (a - a.Floor()); - var b1 = (216.57 + b).ToRadians(); + double b1 = (216.57 + b).ToRadians(); a = 91.56766028 * t; b = 360.0 * (a - a.Floor()); - var c1 = (312.69 + b).ToRadians(); + double c1 = (312.69 + b).ToRadians(); a = 1236.853095 * t; b = 360.0 * (a - a.Floor()); - var d1 = (350.74 - 0.00144 * t2 + b).ToRadians(); - var e1 = (231.19 + 20.2 * t).ToRadians(); + double d1 = (350.74 - 0.00144 * t2 + b).ToRadians(); + double e1 = (231.19 + 20.2 * t).ToRadians(); a = 183.1353208 * t; b = 360.0 * (a - a.Floor()); - var h1 = (353.4 + b).ToRadians(); + double h1 = (353.4 + b).ToRadians(); - var d2 = 0.00134 * a1.Cosine() + 0.00154 * b1.Cosine() + 0.002 * c1.Cosine(); + double d2 = 0.00134 * a1.Cosine() + 0.00154 * b1.Cosine() + 0.002 * c1.Cosine(); d2 = d2 + 0.00179 * d1.Sine() + 0.00178 * e1.Sine(); - var d3 = 0.00000543 * a1.Sine() + 0.00001575 * b1.Sine(); + double d3 = 0.00000543 * a1.Sine() + 0.00001575 * b1.Sine(); d3 = d3 + 0.00001627 * c1.Sine() + 0.00003076 * d1.Cosine(); - var sr = at + (l - m1 + d2).ToRadians(); - var tp = 6.283185308; + double sr = at + (l - m1 + d2).ToRadians(); + double tp = 6.283185308; sr = sr - tp * (sr / tp).Floor(); @@ -821,13 +821,13 @@ public static double SunLong(double lch, double lcm, double lcs, int ds, int zc, /// public static double TrueAnomaly(double am, double ec) { - var tp = 6.283185308; - var m = am - tp * (am / tp).Floor(); - var ae = m; + double tp = 6.283185308; + double m = am - tp * (am / tp).Floor(); + double ae = m; while (1 == 1) { - var d = ae - (ec * ae.Sine()) - m; + double d = ae - (ec * ae.Sine()) - m; if (Math.Abs(d) < 0.000001) { break; @@ -835,8 +835,8 @@ public static double TrueAnomaly(double am, double ec) d = d / (1.0 - (ec * ae.Cosine())); ae = ae - d; } - var a = ((1 + ec) / (1 - ec)).SquareRoot() * (ae / 2).Tangent(); - var at = 2.0 * a.AngleTangent(); + double a = ((1 + ec) / (1 - ec)).SquareRoot() * (ae / 2).Tangent(); + double at = 2.0 * a.AngleTangent(); return at; } @@ -849,13 +849,13 @@ public static double TrueAnomaly(double am, double ec) /// public static double EccentricAnomaly(double am, double ec) { - var tp = 6.283185308; - var m = am - tp * (am / tp).Floor(); - var ae = m; + double tp = 6.283185308; + double m = am - tp * (am / tp).Floor(); + double ae = m; while (1 == 1) { - var d = ae - (ec * ae.Sine()) - m; + double d = ae - (ec * ae.Sine()) - m; if (Math.Abs(d) < 0.000001) { @@ -877,29 +877,29 @@ public static double EccentricAnomaly(double am, double ec) /// public static double Refract(double y2, PACoordinateType sw, double pr, double tr) { - var y = y2.ToRadians(); + double y = y2.ToRadians(); - var d = (sw == PACoordinateType.True) ? -1.0 : 1.0; + double d = (sw == PACoordinateType.True) ? -1.0 : 1.0; if (d == -1) { - var y3 = y; - var y1 = y; - var r1 = 0.0; + double y3 = y; + double y1 = y; + double r1 = 0.0; while (1 == 1) { - var yNew = y1 + r1; - var rfNew = RefractL3035(pr, tr, yNew, d); + double yNew = y1 + r1; + double rfNew = RefractL3035(pr, tr, yNew, d); if (y < -0.087) return 0; - var r2 = rfNew; + double r2 = rfNew; if ((r2 == 0) || (Math.Abs(r2 - r1) < 0.000001)) { - var qNew = y3; + double qNew = y3; return Degrees(qNew + rfNew); } @@ -908,12 +908,12 @@ public static double Refract(double y2, PACoordinateType sw, double pr, double t } } - var rf = RefractL3035(pr, tr, y, d); + double rf = RefractL3035(pr, tr, y, d); if (y < -0.087) return 0; - var q = y; + double q = y; return Degrees(q + rf); } @@ -928,9 +928,9 @@ public static double RefractL3035(double pr, double tr, double y, double d) if (y < -0.087) return 0; - var yd = Degrees(y); - var a = ((0.00002 * yd + 0.0196) * yd + 0.1594) * pr; - var b = (273.0 + tr) * ((0.0845 * yd + 0.505) * yd + 1); + double yd = Degrees(y); + double a = ((0.00002 * yd + 0.0196) * yd + 0.1594) * pr; + double b = (273.0 + tr) * ((0.0845 * yd + 0.505) * yd + 1); return (-(a / b) * d).ToRadians(); } @@ -946,52 +946,52 @@ public static double RefractL3035(double pr, double tr, double y, double d) /// public static double ParallaxHA(double hh, double hm, double hs, double dd, double dm, double ds, PACoordinateType sw, double gp, double ht, double hp) { - var a = gp.ToRadians(); - var c1 = a.Cosine(); - var s1 = a.Sine(); + double a = gp.ToRadians(); + double c1 = a.Cosine(); + double s1 = a.Sine(); - var u = (0.996647 * s1 / c1).AngleTangent(); - var c2 = u.Cosine(); - var s2 = u.Sine(); - var b = ht / 6378160; + double u = (0.996647 * s1 / c1).AngleTangent(); + double c2 = u.Cosine(); + double s2 = u.Sine(); + double b = ht / 6378160; - var rs = (0.996647 * s2) + (b * s1); + double rs = (0.996647 * s2) + (b * s1); - var rc = c2 + (b * c1); - var tp = 6.283185308; + double rc = c2 + (b * c1); + double tp = 6.283185308; - var rp = 1.0 / hp.ToRadians().Sine(); + double rp = 1.0 / hp.ToRadians().Sine(); - var x = DegreeHoursToDecimalDegrees(HMStoDH(hh, hm, hs)).ToRadians(); - var x1 = x; - var y = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); - var y1 = y; + double x = DegreeHoursToDecimalDegrees(HMStoDH(hh, hm, hs)).ToRadians(); + double x1 = x; + double y = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); + double y1 = y; - var d = sw.Equals(PACoordinateType.True) ? 1.0 : -1.0; + double d = sw.Equals(PACoordinateType.True) ? 1.0 : -1.0; if (d == 1) { - var result = ParallaxHAL2870(x, y, rc, rp, rs, tp); + (double p, double q) result = ParallaxHAL2870(x, y, rc, rp, rs, tp); return DecimalDegreesToDegreeHours(Degrees(result.p)); } - var p1 = 0.0; - var q1 = 0.0; - var xLoop = x; - var yLoop = y; + double p1 = 0.0; + double q1 = 0.0; + double xLoop = x; + double yLoop = y; while (1 == 1) { - var result = ParallaxHAL2870(xLoop, yLoop, rc, rp, rs, tp); - var p2 = result.p - xLoop; - var q2 = result.q - yLoop; + (double p, double q) result = ParallaxHAL2870(xLoop, yLoop, rc, rp, rs, tp); + double p2 = result.p - xLoop; + double q2 = result.q - yLoop; - var aa = Math.Abs(p2 - p1); - var bb = Math.Abs(q2 - q1); + double aa = Math.Abs(p2 - p1); + double bb = Math.Abs(q2 - q1); if ((aa < 0.000001) && (bb < 0.000001)) { - var p = x1 - p2; + double p = x1 - p2; return DecimalDegreesToDegreeHours(Degrees(p)); } @@ -1010,18 +1010,18 @@ public static double ParallaxHA(double hh, double hm, double hs, double dd, doub /// public static (double p, double q) ParallaxHAL2870(double x, double y, double rc, double rp, double rs, double tp) { - var cx = x.Cosine(); - var sy = y.Sine(); - var cy = y.Cosine(); + double cx = x.Cosine(); + double sy = y.Sine(); + double cy = y.Cosine(); - var aa = rc * x.Sine() / ((rp * cy) - (rc * cx)); + double aa = rc * x.Sine() / ((rp * cy) - (rc * cx)); - var dx = aa.AngleTangent(); - var p = x + dx; - var cp = p.Cosine(); + double dx = aa.AngleTangent(); + double p = x + dx; + double cp = p.Cosine(); p = p - tp * (p / tp).Floor(); - var q = (cp * (rp * sy - rs) / (rp * cy * cx - rc)).AngleTangent(); + double q = (cp * (rp * sy - rs) / (rp * cy * cx - rc)).AngleTangent(); return (p, q); } @@ -1039,53 +1039,53 @@ public static (double p, double q) ParallaxHAL2870(double x, double y, double rc /// public static double ParallaxDec(double hh, double hm, double hs, double dd, double dm, double ds, PACoordinateType sw, double gp, double ht, double hp) { - var a = gp.ToRadians(); - var c1 = a.Cosine(); - var s1 = a.Sine(); + double a = gp.ToRadians(); + double c1 = a.Cosine(); + double s1 = a.Sine(); - var u = (0.996647 * s1 / c1).AngleTangent(); + double u = (0.996647 * s1 / c1).AngleTangent(); - var c2 = u.Cosine(); - var s2 = u.Sine(); - var b = ht / 6378160; - var rs = (0.996647 * s2) + (b * s1); + double c2 = u.Cosine(); + double s2 = u.Sine(); + double b = ht / 6378160; + double rs = (0.996647 * s2) + (b * s1); - var rc = c2 + (b * c1); - var tp = 6.283185308; + double rc = c2 + (b * c1); + double tp = 6.283185308; - var rp = 1.0 / hp.ToRadians().Sine(); + double rp = 1.0 / hp.ToRadians().Sine(); - var x = DegreeHoursToDecimalDegrees(HMStoDH(hh, hm, hs)).ToRadians(); - var x1 = x; + double x = DegreeHoursToDecimalDegrees(HMStoDH(hh, hm, hs)).ToRadians(); + double x1 = x; - var y = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); - var y1 = y; + double y = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); + double y1 = y; - var d = sw.Equals(PACoordinateType.True) ? 1.0 : -1.0; + double d = sw.Equals(PACoordinateType.True) ? 1.0 : -1.0; if (d == 1) { - var result = ParallaxDecL2870(x, y, rc, rp, rs, tp); + (double p, double q) result = ParallaxDecL2870(x, y, rc, rp, rs, tp); return Degrees(result.q); } - var p1 = 0.0; - var q1 = 0.0; + double p1 = 0.0; + double q1 = 0.0; - var xLoop = x; - var yLoop = y; + double xLoop = x; + double yLoop = y; while (1 == 1) { - var result = ParallaxDecL2870(xLoop, yLoop, rc, rp, rs, tp); - var p2 = result.p - xLoop; - var q2 = result.q - yLoop; - var aa = Math.Abs(p2 - p1); + (double p, double q) result = ParallaxDecL2870(xLoop, yLoop, rc, rp, rs, tp); + double p2 = result.p - xLoop; + double q2 = result.q - yLoop; + double aa = Math.Abs(p2 - p1); if ((aa < 0.000001) && (b < 0.000001)) { - var q = y1 - q2; + double q = y1 - q2; return Degrees(q); } @@ -1103,17 +1103,17 @@ public static double ParallaxDec(double hh, double hm, double hs, double dd, dou /// public static (double p, double q) ParallaxDecL2870(double x, double y, double rc, double rp, double rs, double tp) { - var cx = x.Cosine(); - var sy = y.Sine(); - var cy = y.Cosine(); + double cx = x.Cosine(); + double sy = y.Sine(); + double cy = y.Cosine(); - var aa = rc * x.Sine() / ((rp * cy) - (rc * cx)); - var dx = aa.AngleTangent(); - var p = x + dx; - var cp = p.Cosine(); + double aa = rc * x.Sine() / ((rp * cy) - (rc * cx)); + double dx = aa.AngleTangent(); + double p = x + dx; + double cp = p.Cosine(); p = p - tp * (p / tp).Floor(); - var q = (cp * (rp * sy - rs) / (rp * cy * cx - rc)).AngleTangent(); + double q = (cp * (rp * sy - rs) / (rp * cy * cx - rc)).AngleTangent(); return (p, q); } @@ -1126,7 +1126,7 @@ public static (double p, double q) ParallaxDecL2870(double x, double y, double r /// public static double SunDia(double lch, double lcm, double lcs, int ds, int zc, double ld, int lm, int ly) { - var a = SunDist(lch, lcm, lcs, ds, zc, ld, lm, ly); + double a = SunDist(lch, lcm, lcs, ds, zc, ld, lm, ly); return 0.533128 / a; } @@ -1139,43 +1139,43 @@ public static double SunDia(double lch, double lcm, double lcs, int ds, int zc, /// public static double SunDist(double lch, double lcm, double lcs, int ds, int zc, double ld, int lm, int ly) { - var aa = LocalCivilTimeGreenwichDay(lch, lcm, lcs, ds, zc, ld, lm, ly); - var bb = LocalCivilTimeGreenwichMonth(lch, lcm, lcs, ds, zc, ld, lm, ly); - var cc = LocalCivilTimeGreenwichYear(lch, lcm, lcs, ds, zc, ld, lm, ly); - var ut = LocalCivilTimeToUniversalTime(lch, lcm, lcs, ds, zc, ld, lm, ly); - var dj = CivilDateToJulianDate(aa, bb, cc) - 2415020; + double aa = LocalCivilTimeGreenwichDay(lch, lcm, lcs, ds, zc, ld, lm, ly); + int bb = LocalCivilTimeGreenwichMonth(lch, lcm, lcs, ds, zc, ld, lm, ly); + int cc = LocalCivilTimeGreenwichYear(lch, lcm, lcs, ds, zc, ld, lm, ly); + double ut = LocalCivilTimeToUniversalTime(lch, lcm, lcs, ds, zc, ld, lm, ly); + double dj = CivilDateToJulianDate(aa, bb, cc) - 2415020; - var t = (dj / 36525) + (ut / 876600); - var t2 = t * t; + double t = (dj / 36525) + (ut / 876600); + double t2 = t * t; - var a = 100.0021359 * t; - var b = 360 * (a - a.Floor()); + double a = 100.0021359 * t; + double b = 360 * (a - a.Floor()); a = 99.99736042 * t; b = 360 * (a - a.Floor()); - var m1 = 358.47583 - (0.00015 + 0.0000033 * t) * t2 + b; - var ec = 0.01675104 - 0.0000418 * t - 0.000000126 * t2; + double m1 = 358.47583 - (0.00015 + 0.0000033 * t) * t2 + b; + double ec = 0.01675104 - 0.0000418 * t - 0.000000126 * t2; - var am = m1.ToRadians(); - var ae = EccentricAnomaly(am, ec); + double am = m1.ToRadians(); + double ae = EccentricAnomaly(am, ec); a = 62.55209472 * t; b = 360 * (a - a.Floor()); - var a1 = (153.23 + b).ToRadians(); + double a1 = (153.23 + b).ToRadians(); a = 125.1041894 * t; b = 360 * (a - a.Floor()); - var b1 = (216.57 + b).ToRadians(); + double b1 = (216.57 + b).ToRadians(); a = 91.56766028 * t; b = 360 * (a - a.Floor()); - var c1 = (312.69 + b).ToRadians(); + double c1 = (312.69 + b).ToRadians(); a = 1236.853095 * t; b = 360 * (a - a.Floor()); - var d1 = (350.74 - 0.00144 * t2 + b).ToRadians(); - var e1 = (231.19 + 20.2 * t).ToRadians(); + double d1 = (350.74 - 0.00144 * t2 + b).ToRadians(); + double e1 = (231.19 + 20.2 * t).ToRadians(); a = 183.1353208 * t; b = 360 * (a - a.Floor()); - var h1 = (353.4 + b).ToRadians(); + double h1 = (353.4 + b).ToRadians(); - var d3 = 0.00000543 * a1.Sine() + 0.00001575 * b1.Sine() + (0.00001627 * c1.Sine() + 0.00003076 * d1.Cosine()) + (0.00000927 * h1.Sine()); + double d3 = 0.00000543 * a1.Sine() + 0.00001575 * b1.Sine() + (0.00001627 * c1.Sine() + 0.00003076 * d1.Cosine()) + (0.00000927 * h1.Sine()); return 1.0000002 * (1 - ec * ae.Cosine()) + d3; } @@ -1188,20 +1188,20 @@ public static double SunDist(double lch, double lcm, double lcs, int ds, int zc, /// public static double MoonLong(double lh, double lm, double ls, int ds, int zc, double dy, int mn, int yr) { - var ut = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); - var gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); - var gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); - var gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); - var t = ((CivilDateToJulianDate(gd, gm, gy) - 2415020) / 36525) + (ut / 876600); - var t2 = t * t; - - var m1 = 27.32158213; - var m2 = 365.2596407; - var m3 = 27.55455094; - var m4 = 29.53058868; - var m5 = 27.21222039; - var m6 = 6798.363307; - var q = CivilDateToJulianDate(gd, gm, gy) - 2415020 + (ut / 24); + double ut = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); + double gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); + int gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); + int gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); + double t = ((CivilDateToJulianDate(gd, gm, gy) - 2415020) / 36525) + (ut / 876600); + double t2 = t * t; + + double m1 = 27.32158213; + double m2 = 365.2596407; + double m3 = 27.55455094; + double m4 = 29.53058868; + double m5 = 27.21222039; + double m6 = 6798.363307; + double q = CivilDateToJulianDate(gd, gm, gy) - 2415020 + (ut / 24); m1 = q / m1; m2 = q / m2; m3 = q / m3; @@ -1215,33 +1215,33 @@ public static double MoonLong(double lh, double lm, double ls, int ds, int zc, d m5 = 360 * (m5 - m5.Floor()); m6 = 360 * (m6 - m6.Floor()); - var ml = 270.434164 + m1 - (0.001133 - 0.0000019 * t) * t2; - var ms = 358.475833 + m2 - (0.00015 + 0.0000033 * t) * t2; - var md = 296.104608 + m3 + (0.009192 + 0.0000144 * t) * t2; - var me1 = 350.737486 + m4 - (0.001436 - 0.0000019 * t) * t2; - var mf = 11.250889 + m5 - (0.003211 + 0.0000003 * t) * t2; - var na = 259.183275 - m6 + (0.002078 + 0.0000022 * t) * t2; - var a = (51.2 + 20.2 * t).ToRadians(); - var s1 = a.Sine(); - var s2 = na.ToRadians().Sine(); - var b = 346.56 + (132.87 - 0.0091731 * t) * t; - var s3 = 0.003964 * b.ToRadians().Sine(); - var c = (na + 275.05 - 2.3 * t).ToRadians(); - var s4 = c.Sine(); + double ml = 270.434164 + m1 - (0.001133 - 0.0000019 * t) * t2; + double ms = 358.475833 + m2 - (0.00015 + 0.0000033 * t) * t2; + double md = 296.104608 + m3 + (0.009192 + 0.0000144 * t) * t2; + double me1 = 350.737486 + m4 - (0.001436 - 0.0000019 * t) * t2; + double mf = 11.250889 + m5 - (0.003211 + 0.0000003 * t) * t2; + double na = 259.183275 - m6 + (0.002078 + 0.0000022 * t) * t2; + double a = (51.2 + 20.2 * t).ToRadians(); + double s1 = a.Sine(); + double s2 = na.ToRadians().Sine(); + double b = 346.56 + (132.87 - 0.0091731 * t) * t; + double s3 = 0.003964 * b.ToRadians().Sine(); + double c = (na + 275.05 - 2.3 * t).ToRadians(); + double s4 = c.Sine(); ml = ml + 0.000233 * s1 + s3 + 0.001964 * s2; ms = ms - 0.001778 * s1; md = md + 0.000817 * s1 + s3 + 0.002541 * s2; mf = mf + s3 - 0.024691 * s2 - 0.004328 * s4; me1 = me1 + 0.002011 * s1 + s3 + 0.001964 * s2; - var e = 1.0 - (0.002495 + 0.00000752 * t) * t; - var e2 = e * e; + double e = 1.0 - (0.002495 + 0.00000752 * t) * t; + double e2 = e * e; ml = ml.ToRadians(); ms = ms.ToRadians(); me1 = me1.ToRadians(); mf = mf.ToRadians(); md = md.ToRadians(); - var l = 6.28875 * md.Sine() + 1.274018 * (2.0 * me1 - md).Sine(); + double l = 6.28875 * md.Sine() + 1.274018 * (2.0 * me1 - md).Sine(); l = l + 0.658309 * (2.0 * me1).Sine() + 0.213616 * (2.0 * md).Sine(); l = l - e * 0.185596 * ms.Sine() - 0.114336 * (2.0 * mf).Sine(); l = l + 0.058793 * (2.0 * (me1 - md)).Sine(); @@ -1269,7 +1269,7 @@ public static double MoonLong(double lh, double lm, double ls, int ds, int zc, d l = l + 0.00055 * (md + 4.0 * me1).Sine() + 0.000538 * (4.0 * md).Sine(); l = l + e * 0.000521 * (4.0 * me1 - ms).Sine() + 0.000486 * (2.0 * md - me1).Sine(); l = l + e2 * 0.000717 * (md - 2.0 * ms).Sine(); - var mm = Unwind(ml + l.ToRadians()); + double mm = Unwind(ml + l.ToRadians()); return Degrees(mm); } @@ -1282,20 +1282,20 @@ public static double MoonLong(double lh, double lm, double ls, int ds, int zc, d /// public static double MoonLat(double lh, double lm, double ls, int ds, int zc, double dy, int mn, int yr) { - var ut = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); - var gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); - var gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); - var gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); - var t = ((CivilDateToJulianDate(gd, gm, gy) - 2415020) / 36525) + (ut / 876600); - var t2 = t * t; - - var m1 = 27.32158213; - var m2 = 365.2596407; - var m3 = 27.55455094; - var m4 = 29.53058868; - var m5 = 27.21222039; - var m6 = 6798.363307; - var q = CivilDateToJulianDate(gd, gm, gy) - 2415020 + (ut / 24); + double ut = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); + double gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); + int gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); + int gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); + double t = ((CivilDateToJulianDate(gd, gm, gy) - 2415020) / 36525) + (ut / 876600); + double t2 = t * t; + + double m1 = 27.32158213; + double m2 = 365.2596407; + double m3 = 27.55455094; + double m4 = 29.53058868; + double m5 = 27.21222039; + double m6 = 6798.363307; + double q = CivilDateToJulianDate(gd, gm, gy) - 2415020 + (ut / 24); m1 = q / m1; m2 = q / m2; m3 = q / m3; @@ -1309,33 +1309,33 @@ public static double MoonLat(double lh, double lm, double ls, int ds, int zc, do m5 = 360 * (m5 - m5.Floor()); m6 = 360 * (m6 - m6.Floor()); - var ml = 270.434164 + m1 - (0.001133 - 0.0000019 * t) * t2; - var ms = 358.475833 + m2 - (0.00015 + 0.0000033 * t) * t2; - var md = 296.104608 + m3 + (0.009192 + 0.0000144 * t) * t2; - var me1 = 350.737486 + m4 - (0.001436 - 0.0000019 * t) * t2; - var mf = 11.250889 + m5 - (0.003211 + 0.0000003 * t) * t2; - var na = 259.183275 - m6 + (0.002078 + 0.0000022 * t) * t2; - var a = (51.2 + 20.2 * t).ToRadians(); - var s1 = a.Sine(); - var s2 = na.ToRadians().Sine(); - var b = 346.56 + (132.87 - 0.0091731 * t) * t; - var s3 = 0.003964 * b.ToRadians().Sine(); - var c = (na + 275.05 - 2.3 * t).ToRadians(); - var s4 = c.Sine(); + double ml = 270.434164 + m1 - (0.001133 - 0.0000019 * t) * t2; + double ms = 358.475833 + m2 - (0.00015 + 0.0000033 * t) * t2; + double md = 296.104608 + m3 + (0.009192 + 0.0000144 * t) * t2; + double me1 = 350.737486 + m4 - (0.001436 - 0.0000019 * t) * t2; + double mf = 11.250889 + m5 - (0.003211 + 0.0000003 * t) * t2; + double na = 259.183275 - m6 + (0.002078 + 0.0000022 * t) * t2; + double a = (51.2 + 20.2 * t).ToRadians(); + double s1 = a.Sine(); + double s2 = na.ToRadians().Sine(); + double b = 346.56 + (132.87 - 0.0091731 * t) * t; + double s3 = 0.003964 * b.ToRadians().Sine(); + double c = (na + 275.05 - 2.3 * t).ToRadians(); + double s4 = c.Sine(); ml = ml + 0.000233 * s1 + s3 + 0.001964 * s2; ms = ms - 0.001778 * s1; md = md + 0.000817 * s1 + s3 + 0.002541 * s2; mf = mf + s3 - 0.024691 * s2 - 0.004328 * s4; me1 = me1 + 0.002011 * s1 + s3 + 0.001964 * s2; - var e = 1.0 - (0.002495 + 0.00000752 * t) * t; - var e2 = e * e; + double e = 1.0 - (0.002495 + 0.00000752 * t) * t; + double e2 = e * e; ms = ms.ToRadians(); na = na.ToRadians(); me1 = me1.ToRadians(); mf = mf.ToRadians(); md = md.ToRadians(); - var g = 5.128189 * mf.Sine() + 0.280606 * (md + mf).Sine(); + double g = 5.128189 * mf.Sine() + 0.280606 * (md + mf).Sine(); g = g + 0.277693 * (md - mf).Sine() + 0.173238 * (2.0 * me1 - mf).Sine(); g = g + 0.055413 * (2.0 * me1 + mf - md).Sine() + 0.046272 * (2.0 * me1 - mf - md).Sine(); g = g + 0.032573 * (2.0 * me1 + mf).Sine() + 0.017198 * (2.0 * md + mf).Sine(); @@ -1360,9 +1360,9 @@ public static double MoonLat(double lh, double lm, double ls, int ds, int zc, do g = g - e * 0.000353 * (ms + mf + 2.0 * me1).Sine() + 0.000331 * (mf + 4.0 * me1).Sine(); g = g + e * 0.000317 * (2.0 * me1 + mf - ms + md).Sine(); g = g + e2 * 0.000306 * (2.0 * (me1 - ms) - mf).Sine() - 0.000283 * (md + 3.0 * mf).Sine(); - var w1 = 0.0004664 * na.Cosine(); - var w2 = 0.0000754 * c.Cosine(); - var bm = g.ToRadians() * (1.0 - w1 - w2); + double w1 = 0.0004664 * na.Cosine(); + double w2 = 0.0000754 * c.Cosine(); + double bm = g.ToRadians() * (1.0 - w1 - w2); return Degrees(bm); } @@ -1375,20 +1375,20 @@ public static double MoonLat(double lh, double lm, double ls, int ds, int zc, do /// public static double MoonHP(double lh, double lm, double ls, int ds, int zc, double dy, int mn, int yr) { - var ut = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); - var gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); - var gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); - var gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); - var t = ((CivilDateToJulianDate(gd, gm, gy) - 2415020) / 36525) + (ut / 876600); - var t2 = t * t; - - var m1 = 27.32158213; - var m2 = 365.2596407; - var m3 = 27.55455094; - var m4 = 29.53058868; - var m5 = 27.21222039; - var m6 = 6798.363307; - var q = CivilDateToJulianDate(gd, gm, gy) - 2415020 + (ut / 24); + double ut = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); + double gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); + int gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); + int gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); + double t = ((CivilDateToJulianDate(gd, gm, gy) - 2415020) / 36525) + (ut / 876600); + double t2 = t * t; + + double m1 = 27.32158213; + double m2 = 365.2596407; + double m3 = 27.55455094; + double m4 = 29.53058868; + double m5 = 27.21222039; + double m6 = 6798.363307; + double q = CivilDateToJulianDate(gd, gm, gy) - 2415020 + (ut / 24); m1 = q / m1; m2 = q / m2; m3 = q / m3; @@ -1402,32 +1402,32 @@ public static double MoonHP(double lh, double lm, double ls, int ds, int zc, dou m5 = 360 * (m5 - m5.Floor()); m6 = 360 * (m6 - m6.Floor()); - var ml = 270.434164 + m1 - (0.001133 - 0.0000019 * t) * t2; - var ms = 358.475833 + m2 - (0.00015 + 0.0000033 * t) * t2; - var md = 296.104608 + m3 + (0.009192 + 0.0000144 * t) * t2; - var me1 = 350.737486 + m4 - (0.001436 - 0.0000019 * t) * t2; - var mf = 11.250889 + m5 - (0.003211 + 0.0000003 * t) * t2; - var na = 259.183275 - m6 + (0.002078 + 0.0000022 * t) * t2; - var a = (51.2 + 20.2 * t).ToRadians(); - var s1 = a.Sine(); - var s2 = na.ToRadians().Sine(); - var b = 346.56 + (132.87 - 0.0091731 * t) * t; - var s3 = 0.003964 * b.ToRadians().Sine(); - var c = (na + 275.05 - 2.3 * t).ToRadians(); - var s4 = c.Sine(); + double ml = 270.434164 + m1 - (0.001133 - 0.0000019 * t) * t2; + double ms = 358.475833 + m2 - (0.00015 + 0.0000033 * t) * t2; + double md = 296.104608 + m3 + (0.009192 + 0.0000144 * t) * t2; + double me1 = 350.737486 + m4 - (0.001436 - 0.0000019 * t) * t2; + double mf = 11.250889 + m5 - (0.003211 + 0.0000003 * t) * t2; + double na = 259.183275 - m6 + (0.002078 + 0.0000022 * t) * t2; + double a = (51.2 + 20.2 * t).ToRadians(); + double s1 = a.Sine(); + double s2 = na.ToRadians().Sine(); + double b = 346.56 + (132.87 - 0.0091731 * t) * t; + double s3 = 0.003964 * b.ToRadians().Sine(); + double c = (na + 275.05 - 2.3 * t).ToRadians(); + double s4 = c.Sine(); ml = ml + 0.000233 * s1 + s3 + 0.001964 * s2; ms = ms - 0.001778 * s1; md = md + 0.000817 * s1 + s3 + 0.002541 * s2; mf = mf + s3 - 0.024691 * s2 - 0.004328 * s4; me1 = me1 + 0.002011 * s1 + s3 + 0.001964 * s2; - var e = 1.0 - (0.002495 + 0.00000752 * t) * t; - var e2 = e * e; + double e = 1.0 - (0.002495 + 0.00000752 * t) * t; + double e2 = e * e; ms = ms.ToRadians(); me1 = me1.ToRadians(); mf = mf.ToRadians(); md = md.ToRadians(); - var pm = 0.950724 + 0.051818 * md.Cosine() + 0.009531 * (2.0 * me1 - md).Cosine(); + double pm = 0.950724 + 0.051818 * md.Cosine() + 0.009531 * (2.0 * me1 - md).Cosine(); pm = pm + 0.007843 * (2.0 * me1).Cosine() + 0.002824 * (2.0 * md).Cosine(); pm = pm + 0.000857 * (2.0 * me1 + md).Cosine() + e * 0.000533 * (2.0 * me1 - ms).Cosine(); pm = pm + e * 0.000401 * (2.0 * me1 - md - ms).Cosine(); @@ -1455,8 +1455,8 @@ public static double MoonHP(double lh, double lm, double ls, int ds, int zc, dou /// public static double MoonDist(double lh, double lm, double ls, int ds, int zc, double dy, int mn, int yr) { - var hp = MoonHP(lh, lm, ls, ds, zc, dy, mn, yr).ToRadians(); - var r = 6378.14 / hp.Sine(); + double hp = MoonHP(lh, lm, ls, ds, zc, dy, mn, yr).ToRadians(); + double r = 6378.14 / hp.Sine(); return r; } @@ -1469,9 +1469,9 @@ public static double MoonDist(double lh, double lm, double ls, int ds, int zc, d /// public static double MoonSize(double lh, double lm, double ls, int ds, int zc, double dy, int mn, int yr) { - var hp = MoonHP(lh, lm, ls, ds, zc, dy, mn, yr).ToRadians(); - var r = 6378.14 / hp.Sine(); - var th = 384401.0 * 0.5181 / r; + double hp = MoonHP(lh, lm, ls, ds, zc, dy, mn, yr).ToRadians(); + double r = 6378.14 / hp.Sine(); + double th = 384401.0 * 0.5181 / r; return th; } @@ -1506,9 +1506,9 @@ public static double UnwindDeg(double w) /// public static double SunELong(double gd, int gm, int gy) { - var t = (CivilDateToJulianDate(gd, gm, gy) - 2415020) / 36525; - var t2 = t * t; - var x = 279.6966778 + 36000.76892 * t + 0.0003025 * t2; + double t = (CivilDateToJulianDate(gd, gm, gy) - 2415020) / 36525; + double t2 = t * t; + double x = 279.6966778 + 36000.76892 * t + 0.0003025 * t2; return x - 360 * (x / 360).Floor(); } @@ -1521,9 +1521,9 @@ public static double SunELong(double gd, int gm, int gy) /// public static double SunPeri(double gd, int gm, int gy) { - var t = (CivilDateToJulianDate(gd, gm, gy) - 2415020) / 36525; - var t2 = t * t; - var x = 281.2208444 + 1.719175 * t + 0.000452778 * t2; + double t = (CivilDateToJulianDate(gd, gm, gy) - 2415020) / 36525; + double t2 = t * t; + double x = 281.2208444 + 1.719175 * t + 0.000452778 * t2; return x - 360 * (x / 360).Floor(); } @@ -1536,8 +1536,8 @@ public static double SunPeri(double gd, int gm, int gy) /// public static double SunEcc(double gd, int gm, int gy) { - var t = (CivilDateToJulianDate(gd, gm, gy) - 2415020) / 36525; - var t2 = t * t; + double t = (CivilDateToJulianDate(gd, gm, gy) - 2415020) / 36525; + double t2 = t * t; return 0.01675104 - 0.0000418 * t - 0.000000126 * t2; } @@ -1550,10 +1550,10 @@ public static double SunEcc(double gd, int gm, int gy) /// public static double EcDec(double eld, double elm, double els, double bd, double bm, double bs, double gd, int gm, int gy) { - var a = DegreesMinutesSecondsToDecimalDegrees(eld, elm, els).ToRadians(); - var b = DegreesMinutesSecondsToDecimalDegrees(bd, bm, bs).ToRadians(); - var c = Obliq(gd, gm, gy).ToRadians(); - var d = b.Sine() * c.Cosine() + b.Cosine() * c.Sine() * a.Sine(); + double a = DegreesMinutesSecondsToDecimalDegrees(eld, elm, els).ToRadians(); + double b = DegreesMinutesSecondsToDecimalDegrees(bd, bm, bs).ToRadians(); + double c = Obliq(gd, gm, gy).ToRadians(); + double d = b.Sine() * c.Cosine() + b.Cosine() * c.Sine() * a.Sine(); return Degrees(d.ASine()); } @@ -1566,12 +1566,12 @@ public static double EcDec(double eld, double elm, double els, double bd, double /// public static double EcRA(double eld, double elm, double els, double bd, double bm, double bs, double gd, int gm, int gy) { - var a = DegreesMinutesSecondsToDecimalDegrees(eld, elm, els).ToRadians(); - var b = DegreesMinutesSecondsToDecimalDegrees(bd, bm, bs).ToRadians(); - var c = Obliq(gd, gm, gy).ToRadians(); - var d = a.Sine() * c.Cosine() - b.Tangent() * c.Sine(); - var e = a.Cosine(); - var f = Degrees(d.AngleTangent2(e)); + double a = DegreesMinutesSecondsToDecimalDegrees(eld, elm, els).ToRadians(); + double b = DegreesMinutesSecondsToDecimalDegrees(bd, bm, bs).ToRadians(); + double c = Obliq(gd, gm, gy).ToRadians(); + double d = a.Sine() * c.Cosine() - b.Tangent() * c.Sine(); + double e = a.Cosine(); + double f = Degrees(d.AngleTangent2(e)); return f - 360 * (f / 360).Floor(); } @@ -1584,22 +1584,22 @@ public static double EcRA(double eld, double elm, double els, double bd, double /// public static double SunTrueAnomaly(double lch, double lcm, double lcs, int ds, int zc, double ld, int lm, int ly) { - var aa = LocalCivilTimeGreenwichDay(lch, lcm, lcs, ds, zc, ld, lm, ly); - var bb = LocalCivilTimeGreenwichMonth(lch, lcm, lcs, ds, zc, ld, lm, ly); - var cc = LocalCivilTimeGreenwichYear(lch, lcm, lcs, ds, zc, ld, lm, ly); - var ut = LocalCivilTimeToUniversalTime(lch, lcm, lcs, ds, zc, ld, lm, ly); - var dj = CivilDateToJulianDate(aa, bb, cc) - 2415020; + double aa = LocalCivilTimeGreenwichDay(lch, lcm, lcs, ds, zc, ld, lm, ly); + int bb = LocalCivilTimeGreenwichMonth(lch, lcm, lcs, ds, zc, ld, lm, ly); + int cc = LocalCivilTimeGreenwichYear(lch, lcm, lcs, ds, zc, ld, lm, ly); + double ut = LocalCivilTimeToUniversalTime(lch, lcm, lcs, ds, zc, ld, lm, ly); + double dj = CivilDateToJulianDate(aa, bb, cc) - 2415020; - var t = (dj / 36525) + (ut / 876600); - var t2 = t * t; + double t = (dj / 36525) + (ut / 876600); + double t2 = t * t; - var a = 99.99736042 * t; - var b = 360 * (a - a.Floor()); + double a = 99.99736042 * t; + double b = 360 * (a - a.Floor()); - var m1 = 358.47583 - (0.00015 + 0.0000033 * t) * t2 + b; - var ec = 0.01675104 - 0.0000418 * t - 0.000000126 * t2; + double m1 = 358.47583 - (0.00015 + 0.0000033 * t) * t2 + b; + double ec = 0.01675104 - 0.0000418 * t - 0.000000126 * t2; - var am = m1.ToRadians(); + double am = m1.ToRadians(); return Degrees(TrueAnomaly(am, ec)); } @@ -1612,17 +1612,17 @@ public static double SunTrueAnomaly(double lch, double lcm, double lcs, int ds, /// public static double SunMeanAnomaly(double lch, double lcm, double lcs, int ds, int zc, double ld, int lm, int ly) { - var aa = LocalCivilTimeGreenwichDay(lch, lcm, lcs, ds, zc, ld, lm, ly); - var bb = LocalCivilTimeGreenwichMonth(lch, lcm, lcs, ds, zc, ld, lm, ly); - var cc = LocalCivilTimeGreenwichYear(lch, lcm, lcs, ds, zc, ld, lm, ly); - var ut = LocalCivilTimeToUniversalTime(lch, lcm, lcs, ds, zc, ld, lm, ly); - var dj = CivilDateToJulianDate(aa, bb, cc) - 2415020; - var t = (dj / 36525) + (ut / 876600); - var t2 = t * t; - var a = 100.0021359 * t; - var b = 360 * (a - a.Floor()); - var m1 = 358.47583 - (0.00015 + 0.0000033 * t) * t2 + b; - var am = Unwind(m1.ToRadians()); + double aa = LocalCivilTimeGreenwichDay(lch, lcm, lcs, ds, zc, ld, lm, ly); + int bb = LocalCivilTimeGreenwichMonth(lch, lcm, lcs, ds, zc, ld, lm, ly); + int cc = LocalCivilTimeGreenwichYear(lch, lcm, lcs, ds, zc, ld, lm, ly); + double ut = LocalCivilTimeToUniversalTime(lch, lcm, lcs, ds, zc, ld, lm, ly); + double dj = CivilDateToJulianDate(aa, bb, cc) - 2415020; + double t = (dj / 36525) + (ut / 876600); + double t2 = t * t; + double a = 100.0021359 * t; + double b = 360 * (a - a.Floor()); + double m1 = 358.47583 - (0.00015 + 0.0000033 * t) * t2 + b; + double am = Unwind(m1.ToRadians()); return am; } @@ -1635,13 +1635,13 @@ public static double SunMeanAnomaly(double lch, double lcm, double lcs, int ds, /// public static double SunriseLCT(double ld, int lm, int ly, int ds, int zc, double gl, double gp) { - var di = 0.8333333; - var gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); - var gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); - var gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); - var sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); + double di = 0.8333333; + double gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); + int gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); + int gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); + double sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); - var result1 = SunriseLCTL3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result1 = SunriseLCTL3710(gd, gm, gy, sr, di, gp); double xx; if (!result1.s.Equals("OK")) @@ -1650,8 +1650,8 @@ public static double SunriseLCT(double ld, int lm, int ly, int ds, int zc, doubl } else { - var x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); - var ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); + double x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); + double ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); if (!EGstUt(x, 0, 0, gd, gm, gy).Equals(PAWarningFlag.OK)) { @@ -1660,7 +1660,7 @@ public static double SunriseLCT(double ld, int lm, int ly, int ds, int zc, doubl else { sr = SunLong(ut, 0, 0, 0, 0, gd, gm, gy); - var result2 = SunriseLCTL3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result2 = SunriseLCTL3710(gd, gm, gy, sr, di, gp); if (!result2.s.Equals("OK")) { @@ -1683,11 +1683,11 @@ public static double SunriseLCT(double ld, int lm, int ly, int ds, int zc, doubl /// public static (double a, double x, double y, double la, string s) SunriseLCTL3710(double gd, int gm, int gy, double sr, double di, double gp) { - var a = sr + NutatLong(gd, gm, gy) - 0.005694; - var x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); - var y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); - var la = RiseSetLocalSiderealTimeRise(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); - var s = ERS(DecimalDegreesToDegreeHours(x), 0.0, 0.0, y, 0.0, 0.0, di, gp); + double a = sr + NutatLong(gd, gm, gy) - 0.005694; + double x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); + double y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); + double la = RiseSetLocalSiderealTimeRise(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + string s = ERS(DecimalDegreesToDegreeHours(x), 0.0, 0.0, y, 0.0, 0.0, di, gp); return (a, x, y, la, s); } @@ -1697,13 +1697,13 @@ public static (double a, double x, double y, double la, string s) SunriseLCTL371 /// Original macro name: SunsetLCT public static double SunsetLCT(double ld, int lm, int ly, int ds, int zc, double gl, double gp) { - var di = 0.8333333; - var gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); - var gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); - var gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); - var sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); + double di = 0.8333333; + double gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); + int gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); + int gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); + double sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); - var result1 = SunsetLCTL3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result1 = SunsetLCTL3710(gd, gm, gy, sr, di, gp); double xx; if (!result1.s.Equals("OK")) @@ -1712,8 +1712,8 @@ public static double SunsetLCT(double ld, int lm, int ly, int ds, int zc, double } else { - var x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); - var ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); + double x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); + double ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); if (!EGstUt(x, 0, 0, gd, gm, gy).Equals(PAWarningFlag.OK)) { @@ -1722,7 +1722,7 @@ public static double SunsetLCT(double ld, int lm, int ly, int ds, int zc, double else { sr = SunLong(ut, 0, 0, 0, 0, gd, gm, gy); - var result2 = SunsetLCTL3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result2 = SunsetLCTL3710(gd, gm, gy, sr, di, gp); if (!result2.s.Equals("OK")) { @@ -1744,11 +1744,11 @@ public static double SunsetLCT(double ld, int lm, int ly, int ds, int zc, double /// public static (double a, double x, double y, double la, string s) SunsetLCTL3710(double gd, int gm, int gy, double sr, double di, double gp) { - var a = sr + NutatLong(gd, gm, gy) - 0.005694; - var x = EcRA(a, 0.0, 0.0, 0.0, 0.0, 0.0, gd, gm, gy); - var y = EcDec(a, 0.0, 0.0, 0.0, 0.0, 0.0, gd, gm, gy); - var la = RiseSetLocalSiderealTimeSet(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); - var s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + double a = sr + NutatLong(gd, gm, gy) - 0.005694; + double x = EcRA(a, 0.0, 0.0, 0.0, 0.0, 0.0, gd, gm, gy); + double y = EcDec(a, 0.0, 0.0, 0.0, 0.0, 0.0, gd, gm, gy); + double la = RiseSetLocalSiderealTimeSet(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + string s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); return (a, x, y, la, s); } @@ -1761,14 +1761,14 @@ public static (double a, double x, double y, double la, string s) SunsetLCTL3710 /// public static double RiseSetLocalSiderealTimeRise(double rah, double ram, double ras, double dd, double dm, double ds, double vd, double g) { - var a = HMStoDH(rah, ram, ras); - var b = DegreeHoursToDecimalDegrees(a).ToRadians(); - var c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); - var d = vd.ToRadians(); - var e = g.ToRadians(); - var f = -(d.Sine() + e.Sine() * c.Sine()) / (e.Cosine() * c.Cosine()); - var h = (Math.Abs(f) < 1) ? f.ACosine() : 0; - var i = DecimalDegreesToDegreeHours(Degrees(b - h)); + double a = HMStoDH(rah, ram, ras); + double b = DegreeHoursToDecimalDegrees(a).ToRadians(); + double c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); + double d = vd.ToRadians(); + double e = g.ToRadians(); + double f = -(d.Sine() + e.Sine() * c.Sine()) / (e.Cosine() * c.Cosine()); + double h = (Math.Abs(f) < 1) ? f.ACosine() : 0; + double i = DecimalDegreesToDegreeHours(Degrees(b - h)); return i - 24 * (i / 24).Floor(); } @@ -1781,14 +1781,14 @@ public static double RiseSetLocalSiderealTimeRise(double rah, double ram, double /// public static double RiseSetLocalSiderealTimeSet(double rah, double ram, double ras, double dd, double dm, double ds, double vd, double g) { - var a = HMStoDH(rah, ram, ras); - var b = DegreeHoursToDecimalDegrees(a).ToRadians(); - var c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); - var d = vd.ToRadians(); - var e = g.ToRadians(); - var f = -(d.Sine() + e.Sine() * c.Sine()) / (e.Cosine() * c.Cosine()); - var h = (Math.Abs(f) < 1) ? f.ACosine() : 0; - var i = DecimalDegreesToDegreeHours(Degrees(b + h)); + double a = HMStoDH(rah, ram, ras); + double b = DegreeHoursToDecimalDegrees(a).ToRadians(); + double c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); + double d = vd.ToRadians(); + double e = g.ToRadians(); + double f = -(d.Sine() + e.Sine() * c.Sine()) / (e.Cosine() * c.Cosine()); + double h = (Math.Abs(f) < 1) ? f.ACosine() : 0; + double i = DecimalDegreesToDegreeHours(Degrees(b + h)); return i - 24 * (i / 24).Floor(); } @@ -1801,13 +1801,13 @@ public static double RiseSetLocalSiderealTimeSet(double rah, double ram, double /// public static double RiseSetAzimuthRise(double rah, double ram, double ras, double dd, double dm, double ds, double vd, double g) { - var a = HMStoDH(rah, ram, ras); - var c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); - var d = vd.ToRadians(); - var e = g.ToRadians(); - var f = (c.Sine() + d.Sine() * e.Sine()) / (d.Cosine() * e.Cosine()); - var h = ERS(rah, ram, ras, dd, dm, ds, vd, g).Equals("OK") ? f.ACosine() : 0; - var i = Degrees(h); + double a = HMStoDH(rah, ram, ras); + double c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); + double d = vd.ToRadians(); + double e = g.ToRadians(); + double f = (c.Sine() + d.Sine() * e.Sine()) / (d.Cosine() * e.Cosine()); + double h = ERS(rah, ram, ras, dd, dm, ds, vd, g).Equals("OK") ? f.ACosine() : 0; + double i = Degrees(h); return i - 360 * (i / 360).Floor(); } @@ -1820,13 +1820,13 @@ public static double RiseSetAzimuthRise(double rah, double ram, double ras, doub /// public static double RiseSetAzimuthSet(double rah, double ram, double ras, double dd, double dm, double ds, double vd, double g) { - var a = HMStoDH(rah, ram, ras); - var c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); - var d = vd.ToRadians(); - var e = g.ToRadians(); - var f = (c.Sine() + d.Sine() * e.Sine()) / (d.Cosine() * e.Cosine()); - var h = ERS(rah, ram, ras, dd, dm, ds, vd, g).Equals("OK") ? f.ACosine() : 0; - var i = 360 - Degrees(h); + double a = HMStoDH(rah, ram, ras); + double c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); + double d = vd.ToRadians(); + double e = g.ToRadians(); + double f = (c.Sine() + d.Sine() * e.Sine()) / (d.Cosine() * e.Cosine()); + double h = ERS(rah, ram, ras, dd, dm, ds, vd, g).Equals("OK") ? f.ACosine() : 0; + double i = 360 - Degrees(h); return i - 360 * (i / 360).Floor(); } @@ -1840,13 +1840,13 @@ public static double RiseSetAzimuthSet(double rah, double ram, double ras, doubl /// public static string ERS(double rah, double ram, double ras, double dd, double dm, double ds, double vd, double g) { - var a = HMStoDH(rah, ram, ras); - var c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); - var d = vd.ToRadians(); - var e = g.ToRadians(); - var f = -(d.Sine() + e.Sine() * c.Sine()) / (e.Cosine() * c.Cosine()); + double a = HMStoDH(rah, ram, ras); + double c = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); + double d = vd.ToRadians(); + double e = g.ToRadians(); + double f = -(d.Sine() + e.Sine() * c.Sine()) / (e.Cosine() * c.Cosine()); - var returnValue = "OK"; + string returnValue = "OK"; if (f >= 1) returnValue = "** never rises"; if (f <= -1) @@ -1861,13 +1861,13 @@ public static string ERS(double rah, double ram, double ras, double dd, double d /// Original macro name: eSunRS public static string ESunRS(double ld, int lm, int ly, int ds, int zc, double gl, double gp) { - var di = 0.8333333; - var gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); - var gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); - var gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); - var sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); + double di = 0.8333333; + double gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); + int gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); + int gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); + double sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); - var result1 = ESunRS_L3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result1 = ESunRS_L3710(gd, gm, gy, sr, di, gp); if (!result1.s.Equals("OK")) { @@ -1875,10 +1875,10 @@ public static string ESunRS(double ld, int lm, int ly, int ds, int zc, double gl } else { - var x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); - var ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); + double x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); + double ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); sr = SunLong(ut, 0, 0, 0, 0, gd, gm, gy); - var result2 = ESunRS_L3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result2 = ESunRS_L3710(gd, gm, gy, sr, di, gp); if (!result2.s.Equals("OK")) { return result2.s; @@ -1889,7 +1889,7 @@ public static string ESunRS(double ld, int lm, int ly, int ds, int zc, double gl if (!EGstUt(x, 0, 0, gd, gm, gy).Equals(PAWarningFlag.OK)) { - var s = result2.s + " GST to UT conversion warning"; + string s = result2.s + " GST to UT conversion warning"; return s; } @@ -1904,11 +1904,11 @@ public static string ESunRS(double ld, int lm, int ly, int ds, int zc, double gl /// public static (double a, double x, double y, double la, string s) ESunRS_L3710(double gd, int gm, int gy, double sr, double di, double gp) { - var a = sr + NutatLong(gd, gm, gy) - 0.005694; - var x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); - var y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); - var la = RiseSetLocalSiderealTimeRise(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); - var s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + double a = sr + NutatLong(gd, gm, gy) - 0.005694; + double x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); + double y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); + double la = RiseSetLocalSiderealTimeRise(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + string s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); return (a, x, y, la, s); } @@ -1918,21 +1918,21 @@ public static (double a, double x, double y, double la, string s) ESunRS_L3710(d /// Original macro name: SunriseAz public static double SunriseAZ(double ld, int lm, int ly, int ds, int zc, double gl, double gp) { - var di = 0.8333333; - var gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); - var gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); - var gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); - var sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); + double di = 0.8333333; + double gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); + int gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); + int gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); + double sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); - var result1 = SunriseAZ_L3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result1 = SunriseAZ_L3710(gd, gm, gy, sr, di, gp); if (!result1.s.Equals("OK")) { return -99.0; } - var x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); - var ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); + double x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); + double ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); if (!EGstUt(x, 0, 0, gd, gm, gy).Equals(PAWarningFlag.OK)) { @@ -1940,7 +1940,7 @@ public static double SunriseAZ(double ld, int lm, int ly, int ds, int zc, double } sr = SunLong(ut, 0, 0, 0, 0, gd, gm, gy); - var result2 = SunriseAZ_L3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result2 = SunriseAZ_L3710(gd, gm, gy, sr, di, gp); if (!result2.s.Equals("OK")) { @@ -1955,11 +1955,11 @@ public static double SunriseAZ(double ld, int lm, int ly, int ds, int zc, double /// public static (double a, double x, double y, double la, string s) SunriseAZ_L3710(double gd, int gm, int gy, double sr, double di, double gp) { - var a = sr + NutatLong(gd, gm, gy) - 0.005694; - var x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); - var y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); - var la = RiseSetLocalSiderealTimeRise(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); - var s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + double a = sr + NutatLong(gd, gm, gy) - 0.005694; + double x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); + double y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); + double la = RiseSetLocalSiderealTimeRise(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + string s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); return (a, x, y, la, s); } @@ -1972,21 +1972,21 @@ public static (double a, double x, double y, double la, string s) SunriseAZ_L371 /// public static double SunsetAZ(double ld, int lm, int ly, int ds, int zc, double gl, double gp) { - var di = 0.8333333; - var gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); - var gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); - var gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); - var sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); + double di = 0.8333333; + double gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); + int gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); + int gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); + double sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); - var result1 = SunsetAZ_L3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result1 = SunsetAZ_L3710(gd, gm, gy, sr, di, gp); if (!result1.s.Equals("OK")) { return -99.0; } - var x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); - var ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); + double x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); + double ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); if (!EGstUt(x, 0, 0, gd, gm, gy).Equals(PAWarningFlag.OK)) { @@ -1995,7 +1995,7 @@ public static double SunsetAZ(double ld, int lm, int ly, int ds, int zc, double sr = SunLong(ut, 0, 0, 0, 0, gd, gm, gy); - var result2 = SunsetAZ_L3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result2 = SunsetAZ_L3710(gd, gm, gy, sr, di, gp); if (!result2.s.Equals("OK")) { @@ -2009,11 +2009,11 @@ public static double SunsetAZ(double ld, int lm, int ly, int ds, int zc, double /// public static (double a, double x, double y, double la, string s) SunsetAZ_L3710(double gd, int gm, int gy, double sr, double di, double gp) { - var a = sr + NutatLong(gd, gm, gy) - 0.005694; - var x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); - var y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); - var la = RiseSetLocalSiderealTimeSet(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); - var s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + double a = sr + NutatLong(gd, gm, gy) - 0.005694; + double x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); + double y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); + double la = RiseSetLocalSiderealTimeSet(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + string s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); return (a, x, y, la, s); } @@ -2027,27 +2027,27 @@ public static (double a, double x, double y, double la, string s) SunsetAZ_L3710 /// public static double TwilightAMLCT(double ld, int lm, int ly, int ds, int zc, double gl, double gp, PATwilightType tt) { - var di = (double)tt; + double di = (double)tt; - var gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); - var gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); - var gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); - var sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); + double gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); + int gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); + int gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); + double sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); - var result1 = TwilightAMLCT_L3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result1 = TwilightAMLCT_L3710(gd, gm, gy, sr, di, gp); if (!result1.s.Equals("OK")) return -99.0; - var x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); - var ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); + double x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); + double ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); if (!EGstUt(x, 0, 0, gd, gm, gy).Equals(PAWarningFlag.OK)) return -99.0; sr = SunLong(ut, 0, 0, 0, 0, gd, gm, gy); - var result2 = TwilightAMLCT_L3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result2 = TwilightAMLCT_L3710(gd, gm, gy, sr, di, gp); if (!result2.s.Equals("OK")) return -99.0; @@ -2055,7 +2055,7 @@ public static double TwilightAMLCT(double ld, int lm, int ly, int ds, int zc, do x = LocalSiderealTimeToGreenwichSiderealTime(result2.la, 0, 0, gl); ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); - var xx = UniversalTimeToLocalCivilTime(ut, 0, 0, ds, zc, gd, gm, gy); + double xx = UniversalTimeToLocalCivilTime(ut, 0, 0, ds, zc, gd, gm, gy); return xx; } @@ -2065,11 +2065,11 @@ public static double TwilightAMLCT(double ld, int lm, int ly, int ds, int zc, do /// public static (double a, double x, double y, double la, string s) TwilightAMLCT_L3710(double gd, int gm, int gy, double sr, double di, double gp) { - var a = sr + NutatLong(gd, gm, gy) - 0.005694; - var x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); - var y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); - var la = RiseSetLocalSiderealTimeRise(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); - var s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + double a = sr + NutatLong(gd, gm, gy) - 0.005694; + double x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); + double y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); + double la = RiseSetLocalSiderealTimeRise(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + string s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); return (a, x, y, la, s); } @@ -2083,27 +2083,27 @@ public static (double a, double x, double y, double la, string s) TwilightAMLCT_ /// public static double TwilightPMLCT(double ld, int lm, int ly, int ds, int zc, double gl, double gp, PATwilightType tt) { - var di = (double)tt; + double di = (double)tt; - var gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); - var gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); - var gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); - var sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); + double gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); + int gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); + int gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); + double sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); - var result1 = TwilightPMLCT_L3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result1 = TwilightPMLCT_L3710(gd, gm, gy, sr, di, gp); if (!result1.s.Equals("OK")) return 0.0; - var x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); - var ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); + double x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); + double ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); if (!EGstUt(x, 0, 0, gd, gm, gy).Equals(PAWarningFlag.OK)) return 0.0; sr = SunLong(ut, 0, 0, 0, 0, gd, gm, gy); - var result2 = TwilightPMLCT_L3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result2 = TwilightPMLCT_L3710(gd, gm, gy, sr, di, gp); if (!result2.s.Equals("OK")) return 0.0; @@ -2119,11 +2119,11 @@ public static double TwilightPMLCT(double ld, int lm, int ly, int ds, int zc, do /// public static (double a, double x, double y, double la, string s) TwilightPMLCT_L3710(double gd, int gm, int gy, double sr, double di, double gp) { - var a = sr + NutatLong(gd, gm, gy) - 0.005694; - var x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); - var y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); - var la = RiseSetLocalSiderealTimeSet(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); - var s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + double a = sr + NutatLong(gd, gm, gy) - 0.005694; + double x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); + double y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); + double la = RiseSetLocalSiderealTimeSet(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + string s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); return (a, x, y, la, s); } @@ -2138,25 +2138,25 @@ public static (double a, double x, double y, double la, string s) TwilightPMLCT_ /// One of: "OK", "** lasts all night", or "** Sun too far below horizon" public static string ETwilight(double ld, int lm, int ly, int ds, int zc, double gl, double gp, PATwilightType tt) { - var di = (double)tt; + double di = (double)tt; - var gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); - var gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); - var gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); - var sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); + double gd = LocalCivilTimeGreenwichDay(12, 0, 0, ds, zc, ld, lm, ly); + int gm = LocalCivilTimeGreenwichMonth(12, 0, 0, ds, zc, ld, lm, ly); + int gy = LocalCivilTimeGreenwichYear(12, 0, 0, ds, zc, ld, lm, ly); + double sr = SunLong(12, 0, 0, ds, zc, ld, lm, ly); - var result1 = ETwilight_L3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result1 = ETwilight_L3710(gd, gm, gy, sr, di, gp); if (!result1.s.Equals("OK")) { return result1.s; } - var x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); - var ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); + double x = LocalSiderealTimeToGreenwichSiderealTime(result1.la, 0, 0, gl); + double ut = GreenwichSiderealTimeToUniversalTime(x, 0, 0, gd, gm, gy); sr = SunLong(ut, 0, 0, 0, 0, gd, gm, gy); - var result2 = ETwilight_L3710(gd, gm, gy, sr, di, gp); + (double a, double x, double y, double la, string s) result2 = ETwilight_L3710(gd, gm, gy, sr, di, gp); if (!result2.s.Equals("OK")) { @@ -2180,11 +2180,11 @@ public static string ETwilight(double ld, int lm, int ly, int ds, int zc, double /// public static (double a, double x, double y, double la, string s) ETwilight_L3710(double gd, int gm, int gy, double sr, double di, double gp) { - var a = sr + NutatLong(gd, gm, gy) - 0.005694; - var x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); - var y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); - var la = RiseSetLocalSiderealTimeRise(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); - var s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + double a = sr + NutatLong(gd, gm, gy) - 0.005694; + double x = EcRA(a, 0, 0, 0, 0, 0, gd, gm, gy); + double y = EcDec(a, 0, 0, 0, 0, 0, gd, gm, gy); + double la = RiseSetLocalSiderealTimeRise(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); + string s = ERS(DecimalDegreesToDegreeHours(x), 0, 0, y, 0, 0, di, gp); if (s.Length > 2) { @@ -2213,15 +2213,15 @@ public static (double a, double x, double y, double la, string s) ETwilight_L371 public static double Angle(double xx1, double xm1, double xs1, double dd1, double dm1, double ds1, double xx2, double xm2, double xs2, double dd2, double dm2, double ds2, PAAngleMeasure s ) { - var a = s.Equals(PAAngleMeasure.Hours) ? DegreeHoursToDecimalDegrees(HMStoDH(xx1, xm1, xs1)) : DegreesMinutesSecondsToDecimalDegrees(xx1, xm1, xs1); - var b = a.ToRadians(); - var c = DegreesMinutesSecondsToDecimalDegrees(dd1, dm1, ds1); - var d = c.ToRadians(); - var e = s.Equals(PAAngleMeasure.Hours) ? DegreeHoursToDecimalDegrees(HMStoDH(xx2, xm2, xs2)) : DegreesMinutesSecondsToDecimalDegrees(xx2, xm2, xs2); - var f = e.ToRadians(); - var g = DegreesMinutesSecondsToDecimalDegrees(dd2, dm2, ds2); - var h = g.ToRadians(); - var i = (d.Sine() * h.Sine() + d.Cosine() * h.Cosine() * (b - f).Cosine()).ACosine(); + double a = s.Equals(PAAngleMeasure.Hours) ? DegreeHoursToDecimalDegrees(HMStoDH(xx1, xm1, xs1)) : DegreesMinutesSecondsToDecimalDegrees(xx1, xm1, xs1); + double b = a.ToRadians(); + double c = DegreesMinutesSecondsToDecimalDegrees(dd1, dm1, ds1); + double d = c.ToRadians(); + double e = s.Equals(PAAngleMeasure.Hours) ? DegreeHoursToDecimalDegrees(HMStoDH(xx2, xm2, xs2)) : DegreesMinutesSecondsToDecimalDegrees(xx2, xm2, xs2); + double f = e.ToRadians(); + double g = DegreesMinutesSecondsToDecimalDegrees(dd2, dm2, ds2); + double h = g.ToRadians(); + double i = (d.Sine() * h.Sine() + d.Cosine() * h.Cosine() * (b - f).Cosine()).ACosine(); return Degrees(i); } @@ -2252,212 +2252,212 @@ public static double Angle(double xx1, double xm1, double xs1, double dd1, doubl /// public static (double planetLongitude, double planetLatitude, double planetDistanceAU, double planetHLong1, double planetHLong2, double planetHLat, double planetRVect) PlanetCoordinates(double lh, double lm, double ls, int ds, int zc, double dy, int mn, int yr, string s) { - var a11 = 178.179078; - var a12 = 415.2057519; - var a13 = 0.0003011; - var a14 = 0.0; - var a21 = 75.899697; - var a22 = 1.5554889; - var a23 = 0.0002947; - var a24 = 0.0; - var a31 = 0.20561421; - var a32 = 0.00002046; - var a33 = -0.00000003; - var a34 = 0.0; - var a41 = 7.002881; - var a42 = 0.0018608; - var a43 = -0.0000183; - var a44 = 0.0; - var a51 = 47.145944; - var a52 = 1.1852083; - var a53 = 0.0001739; - var a54 = 0.0; - var a61 = 0.3870986; - var a62 = 6.74; - var a63 = -0.42; - - var b11 = 342.767053; - var b12 = 162.5533664; - var b13 = 0.0003097; - var b14 = 0.0; - var b21 = 130.163833; - var b22 = 1.4080361; - var b23 = -0.0009764; - var b24 = 0.0; - var b31 = 0.00682069; - var b32 = -0.00004774; - var b33 = 0.000000091; - var b34 = 0.0; - var b41 = 3.393631; - var b42 = 0.0010058; - var b43 = -0.000001; - var b44 = 0.0; - var b51 = 75.779647; - var b52 = 0.89985; - var b53 = 0.00041; - var b54 = 0.0; - var b61 = 0.7233316; - var b62 = 16.92; - var b63 = -4.4; - - var c11 = 293.737334; - var c12 = 53.17137642; - var c13 = 0.0003107; - var c14 = 0.0; - var c21 = 334.218203; - var c22 = 1.8407584; - var c23 = 0.0001299; - var c24 = -0.00000119; - var c31 = 0.0933129; - var c32 = 0.000092064; - var c33 = -0.000000077; - var c34 = 0.0; - var c41 = 1.850333; - var c42 = -0.000675; - var c43 = 0.0000126; - var c44 = 0.0; - var c51 = 48.786442; - var c52 = 0.7709917; - var c53 = -0.0000014; - var c54 = -0.00000533; - var c61 = 1.5236883; - var c62 = 9.36; - var c63 = -1.52; - - var d11 = 238.049257; - var d12 = 8.434172183; - var d13 = 0.0003347; - var d14 = -0.00000165; - var d21 = 12.720972; - var d22 = 1.6099617; - var d23 = 0.00105627; - var d24 = -0.00000343; - var d31 = 0.04833475; - var d32 = 0.00016418; - var d33 = -0.0000004676; - var d34 = -0.0000000017; - var d41 = 1.308736; - var d42 = -0.0056961; - var d43 = 0.0000039; - var d44 = 0.0; - var d51 = 99.443414; - var d52 = 1.01053; - var d53 = 0.00035222; - var d54 = -0.00000851; - var d61 = 5.202561; - var d62 = 196.74; - var d63 = -9.4; - - var e11 = 266.564377; - var e12 = 3.398638567; - var e13 = 0.0003245; - var e14 = -0.0000058; - var e21 = 91.098214; - var e22 = 1.9584158; - var e23 = 0.00082636; - var e24 = 0.00000461; - var e31 = 0.05589232; - var e32 = -0.0003455; - var e33 = -0.000000728; - var e34 = 0.00000000074; - var e41 = 2.492519; - var e42 = -0.0039189; - var e43 = -0.00001549; - var e44 = 0.00000004; - var e51 = 112.790414; - var e52 = 0.8731951; - var e53 = -0.00015218; - var e54 = -0.00000531; - var e61 = 9.554747; - var e62 = 165.6; - var e63 = -8.88; - - var f11 = 244.19747; - var f12 = 1.194065406; - var f13 = 0.000316; - var f14 = -0.0000006; - var f21 = 171.548692; - var f22 = 1.4844328; - var f23 = 0.0002372; - var f24 = -0.00000061; - var f31 = 0.0463444; - var f32a = -0.00002658; - var f33 = 0.000000077; - var f34 = 0.0; - var f41 = 0.772464; - var f42 = 0.0006253; - var f43 = 0.0000395; - var f44 = 0.0; - var f51 = 73.477111; - var f52 = 0.4986678; - var f53 = 0.0013117; - var f54 = 0.0; - var f61 = 19.21814; - var f62 = 65.8; - var f63 = -7.19; - - var g11 = 84.457994; - var g12 = 0.6107942056; - var g13 = 0.0003205; - var g14 = -0.0000006; - var g21 = 46.727364; - var g22 = 1.4245744; - var g23 = 0.00039082; - var g24 = -0.000000605; - var g31 = 0.00899704; - var g32 = 0.00000633; - var g33 = -0.000000002; - var g34 = 0.0; - var g41 = 1.779242; - var g42 = -0.0095436; - var g43 = -0.0000091; - var g44 = 0.0; - var g51 = 130.681389; - var g52 = 1.098935; - var g53 = 0.00024987; - var g54 = -0.000004718; - var g61 = 30.10957; - var g62 = 62.2; - var g63 = -6.87; - - var pl = new List(); + double a11 = 178.179078; + double a12 = 415.2057519; + double a13 = 0.0003011; + double a14 = 0.0; + double a21 = 75.899697; + double a22 = 1.5554889; + double a23 = 0.0002947; + double a24 = 0.0; + double a31 = 0.20561421; + double a32 = 0.00002046; + double a33 = -0.00000003; + double a34 = 0.0; + double a41 = 7.002881; + double a42 = 0.0018608; + double a43 = -0.0000183; + double a44 = 0.0; + double a51 = 47.145944; + double a52 = 1.1852083; + double a53 = 0.0001739; + double a54 = 0.0; + double a61 = 0.3870986; + double a62 = 6.74; + double a63 = -0.42; + + double b11 = 342.767053; + double b12 = 162.5533664; + double b13 = 0.0003097; + double b14 = 0.0; + double b21 = 130.163833; + double b22 = 1.4080361; + double b23 = -0.0009764; + double b24 = 0.0; + double b31 = 0.00682069; + double b32 = -0.00004774; + double b33 = 0.000000091; + double b34 = 0.0; + double b41 = 3.393631; + double b42 = 0.0010058; + double b43 = -0.000001; + double b44 = 0.0; + double b51 = 75.779647; + double b52 = 0.89985; + double b53 = 0.00041; + double b54 = 0.0; + double b61 = 0.7233316; + double b62 = 16.92; + double b63 = -4.4; + + double c11 = 293.737334; + double c12 = 53.17137642; + double c13 = 0.0003107; + double c14 = 0.0; + double c21 = 334.218203; + double c22 = 1.8407584; + double c23 = 0.0001299; + double c24 = -0.00000119; + double c31 = 0.0933129; + double c32 = 0.000092064; + double c33 = -0.000000077; + double c34 = 0.0; + double c41 = 1.850333; + double c42 = -0.000675; + double c43 = 0.0000126; + double c44 = 0.0; + double c51 = 48.786442; + double c52 = 0.7709917; + double c53 = -0.0000014; + double c54 = -0.00000533; + double c61 = 1.5236883; + double c62 = 9.36; + double c63 = -1.52; + + double d11 = 238.049257; + double d12 = 8.434172183; + double d13 = 0.0003347; + double d14 = -0.00000165; + double d21 = 12.720972; + double d22 = 1.6099617; + double d23 = 0.00105627; + double d24 = -0.00000343; + double d31 = 0.04833475; + double d32 = 0.00016418; + double d33 = -0.0000004676; + double d34 = -0.0000000017; + double d41 = 1.308736; + double d42 = -0.0056961; + double d43 = 0.0000039; + double d44 = 0.0; + double d51 = 99.443414; + double d52 = 1.01053; + double d53 = 0.00035222; + double d54 = -0.00000851; + double d61 = 5.202561; + double d62 = 196.74; + double d63 = -9.4; + + double e11 = 266.564377; + double e12 = 3.398638567; + double e13 = 0.0003245; + double e14 = -0.0000058; + double e21 = 91.098214; + double e22 = 1.9584158; + double e23 = 0.00082636; + double e24 = 0.00000461; + double e31 = 0.05589232; + double e32 = -0.0003455; + double e33 = -0.000000728; + double e34 = 0.00000000074; + double e41 = 2.492519; + double e42 = -0.0039189; + double e43 = -0.00001549; + double e44 = 0.00000004; + double e51 = 112.790414; + double e52 = 0.8731951; + double e53 = -0.00015218; + double e54 = -0.00000531; + double e61 = 9.554747; + double e62 = 165.6; + double e63 = -8.88; + + double f11 = 244.19747; + double f12 = 1.194065406; + double f13 = 0.000316; + double f14 = -0.0000006; + double f21 = 171.548692; + double f22 = 1.4844328; + double f23 = 0.0002372; + double f24 = -0.00000061; + double f31 = 0.0463444; + double f32a = -0.00002658; + double f33 = 0.000000077; + double f34 = 0.0; + double f41 = 0.772464; + double f42 = 0.0006253; + double f43 = 0.0000395; + double f44 = 0.0; + double f51 = 73.477111; + double f52 = 0.4986678; + double f53 = 0.0013117; + double f54 = 0.0; + double f61 = 19.21814; + double f62 = 65.8; + double f63 = -7.19; + + double g11 = 84.457994; + double g12 = 0.6107942056; + double g13 = 0.0003205; + double g14 = -0.0000006; + double g21 = 46.727364; + double g22 = 1.4245744; + double g23 = 0.00039082; + double g24 = -0.000000605; + double g31 = 0.00899704; + double g32 = 0.00000633; + double g33 = -0.000000002; + double g34 = 0.0; + double g41 = 1.779242; + double g42 = -0.0095436; + double g43 = -0.0000091; + double g44 = 0.0; + double g51 = 130.681389; + double g52 = 1.098935; + double g53 = 0.00024987; + double g54 = -0.000004718; + double g61 = 30.10957; + double g62 = 62.2; + double g63 = -6.87; + + List pl = new List(); pl.Add(new PlanetDataPrecise() { Name = "", Value1 = 0, Value2 = 0, Value3 = 0, Value4 = 0, Value5 = 0, Value6 = 0, Value7 = 0, Value8 = 0, Value9 = 0 }); - var ip = 0; - var b = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); - var gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); - var gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); - var gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); - var a = CivilDateToJulianDate(gd, gm, gy); - var t = ((a - 2415020.0) / 36525.0) + (b / 876600.0); - - var a0 = a11; - var a1 = a12; - var a2 = a13; - var a3 = a14; - var b0 = a21; - var b1 = a22; - var b2 = a23; - var b3 = a24; - var c0 = a31; - var c1 = a32; - var c2 = a33; - var c3 = a34; - var d0 = a41; - var d1 = a42; - var d2 = a43; - var d3 = a44; - var e0 = a51; - var e1 = a52; - var e2 = a53; - var e3 = a54; - var f = a61; - var g = a62; - var h = a63; - var aa = a1 * t; + int ip = 0; + double b = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); + double gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); + int gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); + int gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); + double a = CivilDateToJulianDate(gd, gm, gy); + double t = ((a - 2415020.0) / 36525.0) + (b / 876600.0); + + double a0 = a11; + double a1 = a12; + double a2 = a13; + double a3 = a14; + double b0 = a21; + double b1 = a22; + double b2 = a23; + double b3 = a24; + double c0 = a31; + double c1 = a32; + double c2 = a33; + double c3 = a34; + double d0 = a41; + double d1 = a42; + double d2 = a43; + double d3 = a44; + double e0 = a51; + double e1 = a52; + double e2 = a53; + double e3 = a54; + double f = a61; + double g = a62; + double h = a63; + double aa = a1 * t; b = 360.0 * (aa - aa.Floor()); - var c = a0 + b + (a3 * t + a2) * t * t; + double c = a0 + b + (a3 * t + a2) * t * t; pl.Add(new PlanetDataPrecise() { @@ -2724,39 +2724,39 @@ public static (double planetLongitude, double planetLatitude, double planetDista Value9 = h }); - var checkPlanet = pl.Where(x => x.Name.ToLower() == s.ToLower()).Select(x => x).FirstOrDefault(); + PlanetDataPrecise checkPlanet = pl.Where(x => x.Name.ToLower() == s.ToLower()).Select(x => x).FirstOrDefault(); if (checkPlanet == null) return (Degrees(Unwind(0)), Degrees(Unwind(0)), Degrees(Unwind(0)), Degrees(Unwind(0)), Degrees(Unwind(0)), Degrees(Unwind(0)), Degrees(Unwind(0))); - var li = 0.0; - var ms = SunMeanAnomaly(lh, lm, ls, ds, zc, dy, mn, yr); - var sr = SunLong(lh, lm, ls, ds, zc, dy, mn, yr).ToRadians(); - var re = SunDist(lh, lm, ls, ds, zc, dy, mn, yr); - var lg = sr + Math.PI; - - var l0 = 0.0; - var s0 = 0.0; - var p0 = 0.0; - var vo = 0.0; - var lp1 = 0.0; - var ll = 0.0; - var rd = 0.0; - var pd = 0.0; - var sp = 0.0; - var ci = 0.0; + double li = 0.0; + double ms = SunMeanAnomaly(lh, lm, ls, ds, zc, dy, mn, yr); + double sr = SunLong(lh, lm, ls, ds, zc, dy, mn, yr).ToRadians(); + double re = SunDist(lh, lm, ls, ds, zc, dy, mn, yr); + double lg = sr + Math.PI; + + double l0 = 0.0; + double s0 = 0.0; + double p0 = 0.0; + double vo = 0.0; + double lp1 = 0.0; + double ll = 0.0; + double rd = 0.0; + double pd = 0.0; + double sp = 0.0; + double ci = 0.0; for (int k = 1; k <= 3; k++) { - foreach (var planet in pl) + foreach (PlanetDataPrecise planet in pl) planet.APValue = (planet.Value1 - planet.Value3 - li * planet.Value2).ToRadians(); - var qa = 0.0; - var qb = 0.0; - var qc = 0.0; - var qd = 0.0; - var qe = 0.0; - var qf = 0.0; - var qg = 0.0; + double qa = 0.0; + double qb = 0.0; + double qc = 0.0; + double qd = 0.0; + double qe = 0.0; + double qf = 0.0; + double qg = 0.0; if (s == "Mercury") (qa, qb) = PlanetLong_L4685(pl); @@ -2766,7 +2766,7 @@ public static (double planetLongitude, double planetLatitude, double planetDista if (s == "Mars") { - var returnValue = PlanetLong_L4810(pl, ms); + (double a, double sa, double ca, double qc, double qe, double qa, double qb) returnValue = PlanetLong_L4810(pl, ms); qc = returnValue.qc; qe = returnValue.qe; @@ -2774,33 +2774,33 @@ public static (double planetLongitude, double planetLatitude, double planetDista qb = returnValue.qb; } - var matchPlanet = pl.Where(x => x.Name.ToLower() == s.ToLower()).Select(x => x).FirstOrDefault(); + PlanetDataPrecise matchPlanet = pl.Where(x => x.Name.ToLower() == s.ToLower()).Select(x => x).FirstOrDefault(); if (new string[] { "Jupiter", "Saturn", "Uranus", "Neptune" }.Contains(s)) (qa, qb, qc, qd, qe, qf, qg) = PlanetLong_L4945(t, matchPlanet); - var ec = matchPlanet.Value4 + qd; - var am = matchPlanet.APValue + qe; - var at = TrueAnomaly(am, ec); - var pvv = (matchPlanet.Value7 + qf) * (1.0 - ec * ec) / (1.0 + ec * at.Cosine()); - var lp = Degrees(at) + matchPlanet.Value3 + Degrees(qc - qe); + double ec = matchPlanet.Value4 + qd; + double am = matchPlanet.APValue + qe; + double at = TrueAnomaly(am, ec); + double pvv = (matchPlanet.Value7 + qf) * (1.0 - ec * ec) / (1.0 + ec * at.Cosine()); + double lp = Degrees(at) + matchPlanet.Value3 + Degrees(qc - qe); lp = lp.ToRadians(); - var om = matchPlanet.Value6.ToRadians(); - var lo = lp - om; - var so = lo.Sine(); - var co = lo.Cosine(); - var inn = matchPlanet.Value5.ToRadians(); + double om = matchPlanet.Value6.ToRadians(); + double lo = lp - om; + double so = lo.Sine(); + double co = lo.Cosine(); + double inn = matchPlanet.Value5.ToRadians(); pvv = pvv + qb; sp = so * inn.Sine(); - var y = so * inn.Cosine(); - var ps = sp.ASine() + qg; + double y = so * inn.Cosine(); + double ps = sp.ASine() + qg; sp = ps.Sine(); pd = y.AngleTangent2(co) + om + qa.ToRadians(); pd = Unwind(pd); ci = ps.Cosine(); rd = pvv * ci; ll = pd - lg; - var rh = re * re + pvv * pvv - 2.0 * re * pvv * ci * ll.Cosine(); + double rh = re * re + pvv * pvv - 2.0 * re * pvv * ci * ll.Cosine(); rh = rh.SquareRoot(); li = rh * 0.005775518; @@ -2814,21 +2814,21 @@ public static (double planetLongitude, double planetLatitude, double planetDista } } - var l1 = ll.Sine(); - var l2 = ll.Cosine(); + double l1 = ll.Sine(); + double l2 = ll.Cosine(); - var ep = (ip < 3) ? (-1.0 * rd * l1 / (re - rd * l2)).AngleTangent() + lg + Math.PI : (re * l1 / (rd - re * l2)).AngleTangent() + pd; + double ep = (ip < 3) ? (-1.0 * rd * l1 / (re - rd * l2)).AngleTangent() + lg + Math.PI : (re * l1 / (rd - re * l2)).AngleTangent() + pd; ep = Unwind(ep); - var bp = (rd * sp * (ep - pd).Sine() / (ci * re * l1)).AngleTangent(); + double bp = (rd * sp * (ep - pd).Sine() / (ci * re * l1)).AngleTangent(); - var planetLongitude = Degrees(Unwind(ep)); - var planetLatitude = Degrees(Unwind(bp)); - var planetDistanceAU = vo; - var planetHLong1 = Degrees(lp1); - var planetHLong2 = Degrees(l0); - var planetHLat = Degrees(s0); - var planetRVect = p0; + double planetLongitude = Degrees(Unwind(ep)); + double planetLatitude = Degrees(Unwind(bp)); + double planetDistanceAU = vo; + double planetHLong1 = Degrees(lp1); + double planetHLong2 = Degrees(l0); + double planetHLat = Degrees(s0); + double planetRVect = p0; return (planetLongitude, planetLatitude, planetDistanceAU, planetHLong1, planetHLong2, planetHLat, planetRVect); } @@ -2838,12 +2838,12 @@ public static (double planetLongitude, double planetLatitude, double planetDista /// public static (double qa, double qb) PlanetLong_L4685(List pl) { - var qa = 0.00204 * (5.0 * pl[2].APValue - 2.0 * pl[1].APValue + 0.21328).Cosine(); + double qa = 0.00204 * (5.0 * pl[2].APValue - 2.0 * pl[1].APValue + 0.21328).Cosine(); qa = qa + 0.00103 * (2.0 * pl[2].APValue - pl[1].APValue - 2.8046).Cosine(); qa = qa + 0.00091 * (2.0 * pl[4].APValue - pl[1].APValue - 0.64582).Cosine(); qa = qa + 0.00078 * (5.0 * pl[2].APValue - 3.0 * pl[1].APValue + 0.17692).Cosine(); - var qb = 0.000007525 * (2.0 * pl[4].APValue - pl[1].APValue + 0.925251).Cosine(); + double qb = 0.000007525 * (2.0 * pl[4].APValue - pl[1].APValue + 0.925251).Cosine(); qb = qb + 0.000006802 * (5.0 * pl[2].APValue - 3.0 * pl[1].APValue - 4.53642).Cosine(); qb = qb + 0.000005457 * (2.0 * pl[2].APValue - 2.0 * pl[1].APValue - 1.24246).Cosine(); qb = qb + 0.000003569 * (5.0 * pl[2].APValue - pl[1].APValue - 1.35699).Cosine(); @@ -2856,17 +2856,17 @@ public static (double qa, double qb) PlanetLong_L4685(List pl /// public static (double qa, double qb, double qc, double qe) PlanetLong_L4735(List pl, double ms, double t) { - var qc = 0.00077 * (4.1406 + t * 2.6227).Sine(); + double qc = 0.00077 * (4.1406 + t * 2.6227).Sine(); qc = qc.ToRadians(); - var qe = qc; + double qe = qc; - var qa = 0.00313 * (2.0 * ms - 2.0 * pl[2].APValue - 2.587).Cosine(); + double qa = 0.00313 * (2.0 * ms - 2.0 * pl[2].APValue - 2.587).Cosine(); qa = qa + 0.00198 * (3.0 * ms - 3.0 * pl[2].APValue + 0.044768).Cosine(); qa = qa + 0.00136 * (ms - pl[2].APValue - 2.0788).Cosine(); qa = qa + 0.00096 * (3.0 * ms - 2.0 * pl[2].APValue - 2.3721).Cosine(); qa = qa + 0.00082 * (pl[4].APValue - pl[2].APValue - 3.6318).Cosine(); - var qb = 0.000022501 * (2.0 * ms - 2.0 * pl[2].APValue - 1.01592).Cosine(); + double qb = 0.000022501 * (2.0 * ms - 2.0 * pl[2].APValue - 1.01592).Cosine(); qb = qb + 0.000019045 * (3.0 * ms - 3.0 * pl[2].APValue + 1.61577).Cosine(); qb = qb + 0.000006887 * (pl[4].APValue - pl[2].APValue - 2.06106).Cosine(); qb = qb + 0.000005172 * (ms - pl[2].APValue - 0.508065).Cosine(); @@ -2882,14 +2882,14 @@ public static (double qa, double qb, double qc, double qe) PlanetLong_L4735(List /// public static (double a, double sa, double ca, double qc, double qe, double qa, double qb) PlanetLong_L4810(List pl, double ms) { - var a = 3.0 * pl[4].APValue - 8.0 * pl[3].APValue + 4.0 * ms; - var sa = a.Sine(); - var ca = a.Cosine(); - var qc = -(0.01133 * sa + 0.00933 * ca); + double a = 3.0 * pl[4].APValue - 8.0 * pl[3].APValue + 4.0 * ms; + double sa = a.Sine(); + double ca = a.Cosine(); + double qc = -(0.01133 * sa + 0.00933 * ca); qc = qc.ToRadians(); - var qe = qc; + double qe = qc; - var qa = 0.00705 * (pl[4].APValue - pl[3].APValue - 0.85448).Cosine(); + double qa = 0.00705 * (pl[4].APValue - pl[3].APValue - 0.85448).Cosine(); qa = qa + 0.00607 * (2.0 * pl[4].APValue - pl[3].APValue - 3.2873).Cosine(); qa = qa + 0.00445 * (2.0 * pl[4].APValue - 2.0 * pl[3].APValue - 3.3492).Cosine(); qa = qa + 0.00388 * (ms - 2.0 * pl[3].APValue + 0.35771).Cosine(); @@ -2899,7 +2899,7 @@ public static (double a, double sa, double ca, double qc, double qe, double qa, qa = qa + 0.00136 * (2.0 * ms - 4.0 * pl[3].APValue + 2.6894).Cosine(); qa = qa + 0.00104 * (pl[4].APValue + 0.30749).Cosine(); - var qb = 0.000053227 * (pl[4].APValue - pl[3].APValue + 0.717864).Cosine(); + double qb = 0.000053227 * (pl[4].APValue - pl[3].APValue + 0.717864).Cosine(); qb = qb + 0.000050989 * (2.0 * pl[4].APValue - 2.0 * pl[3].APValue - 1.77997).Cosine(); qb = qb + 0.000038278 * (2.0 * pl[4].APValue - pl[3].APValue - 1.71617).Cosine(); qb = qb + 0.000015996 * (ms - pl[3].APValue - 0.969618).Cosine(); @@ -2921,62 +2921,62 @@ public static (double a, double sa, double ca, double qc, double qe, double qa, /// public static (double qa, double qb, double qc, double qd, double qe, double qf, double qg) PlanetLong_L4945(double t, PlanetDataPrecise planet) { - var qa = 0.0; - var qb = 0.0; - var qc = 0.0; - var qd = 0.0; - var qe = 0.0; - var qf = 0.0; - var qg = 0.0; - var vk = 0.0; - var ja = 0.0; - var jb = 0.0; - var jc = 0.0; - - var j1 = t / 5.0 + 0.1; - var j2 = Unwind(4.14473 + 52.9691 * t); - var j3 = Unwind(4.641118 + 21.32991 * t); - var j4 = Unwind(4.250177 + 7.478172 * t); - var j5 = 5.0 * j3 - 2.0 * j2; - var j6 = 2.0 * j2 - 6.0 * j3 + 3.0 * j4; + double qa = 0.0; + double qb = 0.0; + double qc = 0.0; + double qd = 0.0; + double qe = 0.0; + double qf = 0.0; + double qg = 0.0; + double vk = 0.0; + double ja = 0.0; + double jb = 0.0; + double jc = 0.0; + + double j1 = t / 5.0 + 0.1; + double j2 = Unwind(4.14473 + 52.9691 * t); + double j3 = Unwind(4.641118 + 21.32991 * t); + double j4 = Unwind(4.250177 + 7.478172 * t); + double j5 = 5.0 * j3 - 2.0 * j2; + double j6 = 2.0 * j2 - 6.0 * j3 + 3.0 * j4; if (new string[] { "Mercury", "Venus", "Mars" }.Contains(planet.Name)) return (qa, qb, qc, qd, qe, qf, qg); if (new string[] { "Jupiter", "Saturn" }.Contains(planet.Name)) { - var j7 = j3 - j2; - var u1 = j3.Sine(); - var u2 = j3.Cosine(); - var u3 = (2.0 * j3).Sine(); - var u4 = (2.0 * j3).Cosine(); - var u5 = j5.Sine(); - var u6 = j5.Cosine(); - var u7 = (2.0 * j5).Sine(); - var u8a = j6.Sine(); - var u9 = j7.Sine(); - var ua = j7.Cosine(); - var ub = (2.0 * j7).Sine(); - var uc = (2.0 * j7).Cosine(); - var ud = (3.0 * j7).Sine(); - var ue = (3.0 * j7).Cosine(); - var uf = (4.0 * j7).Sine(); - var ug = (4.0 * j7).Cosine(); - var vh = (5.0 * j7).Cosine(); + double j7 = j3 - j2; + double u1 = j3.Sine(); + double u2 = j3.Cosine(); + double u3 = (2.0 * j3).Sine(); + double u4 = (2.0 * j3).Cosine(); + double u5 = j5.Sine(); + double u6 = j5.Cosine(); + double u7 = (2.0 * j5).Sine(); + double u8a = j6.Sine(); + double u9 = j7.Sine(); + double ua = j7.Cosine(); + double ub = (2.0 * j7).Sine(); + double uc = (2.0 * j7).Cosine(); + double ud = (3.0 * j7).Sine(); + double ue = (3.0 * j7).Cosine(); + double uf = (4.0 * j7).Sine(); + double ug = (4.0 * j7).Cosine(); + double vh = (5.0 * j7).Cosine(); if (planet.Name == "Saturn") { - var ui = (3.0 * j3).Sine(); - var uj = (3.0 * j3).Cosine(); - var uk = (4.0 * j3).Sine(); - var ul = (4.0 * j3).Cosine(); - var vi = (2.0 * j5).Cosine(); - var un = (5.0 * j7).Sine(); - var j8 = j4 - j3; - var uo = (2.0 * j8).Sine(); - var up = (2.0 * j8).Cosine(); - var uq = (3.0 * j8).Sine(); - var ur = (3.0 * j8).Cosine(); + double ui = (3.0 * j3).Sine(); + double uj = (3.0 * j3).Cosine(); + double uk = (4.0 * j3).Sine(); + double ul = (4.0 * j3).Cosine(); + double vi = (2.0 * j5).Cosine(); + double un = (5.0 * j7).Sine(); + double j8 = j4 - j3; + double uo = (2.0 * j8).Sine(); + double up = (2.0 * j8).Cosine(); + double uq = (3.0 * j8).Sine(); + double ur = (3.0 * j8).Cosine(); qc = 0.007581 * u7 - 0.007986 * u8a - 0.148811 * u9; qc = qc - (0.814181 - (0.01815 - 0.016714 * j1) * j1) * u5; @@ -3089,12 +3089,12 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, if (new string[] { "Uranus", "Neptune" }.Contains(planet.Name)) { - var j8 = Unwind(1.46205 + 3.81337 * t); - var j9 = 2.0 * j8 - j4; - var vj = j9.Sine(); - var uu = j9.Cosine(); - var uv = (2.0 * j9).Sine(); - var uw = (2.0 * j9).Cosine(); + double j8 = Unwind(1.46205 + 3.81337 * t); + double j9 = 2.0 * j8 - j4; + double vj = j9.Sine(); + double uu = j9.Cosine(); + double uv = (2.0 * j9).Sine(); + double uw = (2.0 * j9).Cosine(); if (planet.Name == "Neptune") { @@ -3115,10 +3115,10 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, qf = 8189.0 * uu - 817.0 * vj + 781.0 * uw; qf = qf * 0.000001; - var vd = (2.0 * jc).Sine(); - var ve = (2.0 * jc).Cosine(); - var vf = j8.Sine(); - var vg = j8.Cosine(); + double vd = (2.0 * jc).Sine(); + double ve = (2.0 * jc).Cosine(); + double vf = j8.Sine(); + double vg = j8.Cosine(); qa = -0.009556 * ja.Sine() - 0.005178 * jb.Sine(); qa = qa + 0.002572 * vd - 0.002972 * ve * vf - 0.002833 * vd * vg; @@ -3151,18 +3151,18 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, qa = (-0.038581 + (0.002031 - 0.00191 * j1) * j1) * (j4 + jb).Cosine(); qa = qa + (0.010122 - 0.000988 * j1) * (j4 + jb).Sine(); - var a = (0.034964 - (0.001038 - 0.000868 * j1) * j1) * (2.0 * j4 + jb).Cosine(); + double a = (0.034964 - (0.001038 - 0.000868 * j1) * j1) * (2.0 * j4 + jb).Cosine(); qa = a + qa + 0.005594 * (j4 + 3.0 * jc).Sine() - 0.014808 * ja.Sine(); qa = qa - 0.005794 * jb.Sine() + 0.002347 * jb.Cosine(); qa = qa + 0.009872 * jc.Sine() + 0.008803 * (2.0 * jc).Sine(); qa = qa - 0.004308 * (3.0 * jc).Sine(); - var ux = jb.Sine(); - var uy = jb.Cosine(); - var uz = j4.Sine(); - var va = j4.Cosine(); - var vb = (2.0 * j4).Sine(); - var vc = (2.0 * j4).Cosine(); + double ux = jb.Sine(); + double uy = jb.Cosine(); + double uz = j4.Sine(); + double va = j4.Cosine(); + double vb = (2.0 * j4).Sine(); + double vc = (2.0 * j4).Cosine(); qg = (0.000458 * ux - 0.000642 * uy - 0.000517 * (4.0 * jc).Cosine()) * uz; qg = qg - (0.000347 * ux + 0.000853 * uy + 0.000517 * (4.0 * jb).Sine()) * va; qg = qg + 0.000403 * ((2.0 * jc).Cosine() * vb + (2.0 * jc).Sine() * vc); @@ -3188,12 +3188,12 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, /// public static double SolveCubic(double w) { - var s = w / 3.0; + double s = w / 3.0; while (1 == 1) { - var s2 = s * s; - var d = (s2 + 3.0) * s - w; + double s2 = s * s; + double d = (s2 + 3.0) * s - w; if (Math.Abs(d) < 0.000001) { @@ -3232,41 +3232,41 @@ public static double SolveCubic(double w) /// public static (double cometLongDeg, double cometLatDeg, double cometDistAU) PCometLongLatDist(double lh, double lm, double ls, int ds, int zc, double dy, int mn, int yr, double td, int tm, int ty, double q, double i, double p, double n) { - var gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); - var gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); - var gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); - var ut = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); - var tpe = (ut / 365.242191) + CivilDateToJulianDate(gd, gm, gy) - CivilDateToJulianDate(td, tm, ty); - var lg = (SunLong(lh, lm, ls, ds, zc, dy, mn, yr) + 180.0).ToRadians(); - var re = SunDist(lh, lm, ls, ds, zc, dy, mn, yr); - - var rh2 = 0.0; - var rd = 0.0; - var s3 = 0.0; - var c3 = 0.0; - var lc = 0.0; - var s2 = 0.0; - var c2 = 0.0; + double gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); + int gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); + int gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); + double ut = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); + double tpe = (ut / 365.242191) + CivilDateToJulianDate(gd, gm, gy) - CivilDateToJulianDate(td, tm, ty); + double lg = (SunLong(lh, lm, ls, ds, zc, dy, mn, yr) + 180.0).ToRadians(); + double re = SunDist(lh, lm, ls, ds, zc, dy, mn, yr); + + double rh2 = 0.0; + double rd = 0.0; + double s3 = 0.0; + double c3 = 0.0; + double lc = 0.0; + double s2 = 0.0; + double c2 = 0.0; for (int k = 1; k < 3; k++) { - var s = SolveCubic(0.0364911624 * tpe / (q * q.SquareRoot())); - var nu = 2.0 * s.AngleTangent(); - var r = q * (1.0 + s * s); - var l = nu + p.ToRadians(); - var s1 = l.Sine(); - var c1 = l.Cosine(); - var i1 = i.ToRadians(); + double s = SolveCubic(0.0364911624 * tpe / (q * q.SquareRoot())); + double nu = 2.0 * s.AngleTangent(); + double r = q * (1.0 + s * s); + double l = nu + p.ToRadians(); + double s1 = l.Sine(); + double c1 = l.Cosine(); + double i1 = i.ToRadians(); s2 = s1 * i1.Sine(); - var ps = s2.ASine(); - var y = s1 * i1.Cosine(); + double ps = s2.ASine(); + double y = s1 * i1.Cosine(); lc = y.AngleTangent2(c1) + n.ToRadians(); c2 = ps.Cosine(); rd = r * c2; - var ll = lc - lg; + double ll = lc - lg; c3 = ll.Cosine(); s3 = ll.Sine(); - var rh = ((re * re) + (r * r) - (2.0 * re * rd * c3 * ps.Cosine())).SquareRoot(); + double rh = ((re * re) + (r * r) - (2.0 * re * rd * c3 * ps.Cosine())).SquareRoot(); if (k == 1) { rh2 = ((re * re) + (r * r) - (2.0 * re * r * ps.Cosine() * (l + n.ToRadians() - lg).Cosine())).SquareRoot(); @@ -3278,12 +3278,12 @@ public static (double cometLongDeg, double cometLatDeg, double cometDistAU) PCom ep = (rd < re) ? (-rd * s3 / (re - (rd * c3))).AngleTangent() + lg + 3.141592654 : (re * s3 / (rd - (re * c3))).AngleTangent() + lc; ep = Unwind(ep); - var tb = rd * s2 * (ep - lc).Sine() / (c2 * re * s3); - var bp = tb.AngleTangent(); + double tb = rd * s2 * (ep - lc).Sine() / (c2 * re * s3); + double bp = tb.AngleTangent(); - var cometLongDeg = Degrees(ep); - var cometLatDeg = Degrees(bp); - var cometDistAU = rh2; + double cometLongDeg = Degrees(ep); + double cometLatDeg = Degrees(bp); + double cometDistAU = rh2; return (cometLongDeg, cometLatDeg, cometDistAU); } @@ -3309,20 +3309,20 @@ public static (double cometLongDeg, double cometLatDeg, double cometDistAU) PCom /// public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLongLatHP(double lh, double lm, double ls, int ds, int zc, double dy, int mn, int yr) { - var ut = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); - var gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); - var gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); - var gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); - var t = ((CivilDateToJulianDate(gd, gm, gy) - 2415020.0) / 36525.0) + (ut / 876600.0); - var t2 = t * t; - - var m1 = 27.32158213; - var m2 = 365.2596407; - var m3 = 27.55455094; - var m4 = 29.53058868; - var m5 = 27.21222039; - var m6 = 6798.363307; - var q = CivilDateToJulianDate(gd, gm, gy) - 2415020.0 + (ut / 24.0); + double ut = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); + double gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); + int gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); + int gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); + double t = ((CivilDateToJulianDate(gd, gm, gy) - 2415020.0) / 36525.0) + (ut / 876600.0); + double t2 = t * t; + + double m1 = 27.32158213; + double m2 = 365.2596407; + double m3 = 27.55455094; + double m4 = 29.53058868; + double m5 = 27.21222039; + double m6 = 6798.363307; + double q = CivilDateToJulianDate(gd, gm, gy) - 2415020.0 + (ut / 24.0); m1 = q / m1; m2 = q / m2; m3 = q / m3; @@ -3336,26 +3336,26 @@ public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLo m5 = 360.0 * (m5 - m5.Floor()); m6 = 360.0 * (m6 - m6.Floor()); - var ml = 270.434164 + m1 - (0.001133 - 0.0000019 * t) * t2; - var ms = 358.475833 + m2 - (0.00015 + 0.0000033 * t) * t2; - var md = 296.104608 + m3 + (0.009192 + 0.0000144 * t) * t2; - var me1 = 350.737486 + m4 - (0.001436 - 0.0000019 * t) * t2; - var mf = 11.250889 + m5 - (0.003211 + 0.0000003 * t) * t2; - var na = 259.183275 - m6 + (0.002078 + 0.0000022 * t) * t2; - var a = (51.2 + 20.2 * t).ToRadians(); - var s1 = a.Sine(); - var s2 = na.ToRadians().Sine(); - var b = 346.56 + (132.87 - 0.0091731 * t) * t; - var s3 = 0.003964 * b.ToRadians().Sine(); - var c = (na + 275.05 - 2.3 * t).ToRadians(); - var s4 = c.Sine(); + double ml = 270.434164 + m1 - (0.001133 - 0.0000019 * t) * t2; + double ms = 358.475833 + m2 - (0.00015 + 0.0000033 * t) * t2; + double md = 296.104608 + m3 + (0.009192 + 0.0000144 * t) * t2; + double me1 = 350.737486 + m4 - (0.001436 - 0.0000019 * t) * t2; + double mf = 11.250889 + m5 - (0.003211 + 0.0000003 * t) * t2; + double na = 259.183275 - m6 + (0.002078 + 0.0000022 * t) * t2; + double a = (51.2 + 20.2 * t).ToRadians(); + double s1 = a.Sine(); + double s2 = na.ToRadians().Sine(); + double b = 346.56 + (132.87 - 0.0091731 * t) * t; + double s3 = 0.003964 * b.ToRadians().Sine(); + double c = (na + 275.05 - 2.3 * t).ToRadians(); + double s4 = c.Sine(); ml = ml + 0.000233 * s1 + s3 + 0.001964 * s2; ms = ms - 0.001778 * s1; md = md + 0.000817 * s1 + s3 + 0.002541 * s2; mf = mf + s3 - 0.024691 * s2 - 0.004328 * s4; me1 = me1 + 0.002011 * s1 + s3 + 0.001964 * s2; - var e = 1.0 - (0.002495 + 0.00000752 * t) * t; - var e2 = e * e; + double e = 1.0 - (0.002495 + 0.00000752 * t) * t; + double e2 = e * e; ml = ml.ToRadians(); ms = ms.ToRadians(); na = na.ToRadians(); @@ -3364,7 +3364,7 @@ public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLo md = md.ToRadians(); // Longitude-specific - var l = 6.28875 * md.Sine() + 1.274018 * (2.0 * me1 - md).Sine(); + double l = 6.28875 * md.Sine() + 1.274018 * (2.0 * me1 - md).Sine(); l = l + 0.658309 * (2.0 * me1).Sine() + 0.213616 * (2.0 * md).Sine(); l = l - e * 0.185596 * ms.Sine() - 0.114336 * (2.0 * mf).Sine(); l = l + 0.058793 * (2.0 * (me1 - md)).Sine(); @@ -3392,10 +3392,10 @@ public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLo l = l + 0.00055 * (md + 4.0 * me1).Sine() + 0.000538 * (4.0 * md).Sine(); l = l + e * 0.000521 * (4.0 * me1 - ms).Sine() + 0.000486 * (2.0 * md - me1).Sine(); l = l + e2 * 0.000717 * (md - 2.0 * ms).Sine(); - var mm = Unwind(ml + l.ToRadians()); + double mm = Unwind(ml + l.ToRadians()); // Latitude-specific - var g = 5.128189 * mf.Sine() + 0.280606 * (md + mf).Sine(); + double g = 5.128189 * mf.Sine() + 0.280606 * (md + mf).Sine(); g = g + 0.277693 * (md - mf).Sine() + 0.173238 * (2.0 * me1 - mf).Sine(); g = g + 0.055413 * (2.0 * me1 + mf - md).Sine() + 0.046272 * (2.0 * me1 - mf - md).Sine(); g = g + 0.032573 * (2.0 * me1 + mf).Sine() + 0.017198 * (2.0 * md + mf).Sine(); @@ -3420,12 +3420,12 @@ public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLo g = g - e * 0.000353 * (ms + mf + 2.0 * me1).Sine() + 0.000331 * (mf + 4.0 * me1).Sine(); g = g + e * 0.000317 * (2.0 * me1 + mf - ms + md).Sine(); g = g + e2 * 0.000306 * (2.0 * (me1 - ms) - mf).Sine() - 0.000283 * (md + 3.0 * mf).Sine(); - var w1 = 0.0004664 * na.Cosine(); - var w2 = 0.0000754 * c.Cosine(); - var bm = g.ToRadians() * (1.0 - w1 - w2); + double w1 = 0.0004664 * na.Cosine(); + double w2 = 0.0000754 * c.Cosine(); + double bm = g.ToRadians() * (1.0 - w1 - w2); // Horizontal parallax-specific - var pm = 0.950724 + 0.051818 * md.Cosine() + 0.009531 * (2.0 * me1 - md).Cosine(); + double pm = 0.950724 + 0.051818 * md.Cosine() + 0.009531 * (2.0 * me1 - md).Cosine(); pm = pm + 0.007843 * (2.0 * me1).Cosine() + 0.002824 * (2.0 * md).Cosine(); pm = pm + 0.000857 * (2.0 * me1 + md).Cosine() + e * 0.000533 * (2.0 * me1 - ms).Cosine(); pm = pm + e * 0.000401 * (2.0 * me1 - md - ms).Cosine(); @@ -3442,9 +3442,9 @@ public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLo pm = pm + e2 * 0.000026 * (2.0 * (me1 - ms)).Cosine() - 0.000023 * (2.0 * (mf - me1) + md).Cosine(); pm = pm + e * 0.000019 * (4.0 * me1 - ms - md).Cosine(); - var moonLongDeg = Degrees(mm); - var moonLatDeg = Degrees(bm); - var moonHorPara = pm; + double moonLongDeg = Degrees(mm); + double moonLatDeg = Degrees(bm); + double moonHorPara = pm; return (moonLongDeg, moonLatDeg, moonHorPara); } @@ -3457,15 +3457,15 @@ public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLo /// public static double MoonPhase(double lh, double lm, double ls, int ds, int zc, double dy, int mn, int yr) { - var moonResult = MoonLongLatHP(lh, lm, ls, ds, zc, dy, mn, yr); + (double moonLongDeg, double moonLatDeg, double moonHorPara) moonResult = MoonLongLatHP(lh, lm, ls, ds, zc, dy, mn, yr); - var cd = (moonResult.moonLongDeg - SunLong(lh, lm, ls, ds, zc, dy, mn, yr)).ToRadians().Cosine() * moonResult.moonLatDeg.ToRadians().Cosine(); - var d = cd.ACosine(); - var sd = d.Sine(); - var i = 0.1468 * sd * (1.0 - 0.0549 * MoonMeanAnomaly(lh, lm, ls, ds, zc, dy, mn, yr).Sine()); + double cd = (moonResult.moonLongDeg - SunLong(lh, lm, ls, ds, zc, dy, mn, yr)).ToRadians().Cosine() * moonResult.moonLatDeg.ToRadians().Cosine(); + double d = cd.ACosine(); + double sd = d.Sine(); + double i = 0.1468 * sd * (1.0 - 0.0549 * MoonMeanAnomaly(lh, lm, ls, ds, zc, dy, mn, yr).Sine()); i = i / (1.0 - 0.0167 * SunMeanAnomaly(lh, lm, ls, ds, zc, dy, mn, yr).Sine()); i = 3.141592654 - d - i.ToRadians(); - var k = (1.0 + i.Cosine()) / 2.0; + double k = (1.0 + i.Cosine()) / 2.0; return Math.Round(k, 2); } @@ -3478,20 +3478,20 @@ public static double MoonPhase(double lh, double lm, double ls, int ds, int zc, /// public static double MoonMeanAnomaly(double lh, double lm, double ls, int ds, int zc, double dy, int mn, int yr) { - var ut = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); - var gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); - var gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); - var gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); - var t = ((CivilDateToJulianDate(gd, gm, gy) - 2415020.0) / 36525.0) + (ut / 876600.0); - var t2 = t * t; - - var m1 = 27.32158213; - var m2 = 365.2596407; - var m3 = 27.55455094; - var m4 = 29.53058868; - var m5 = 27.21222039; - var m6 = 6798.363307; - var q = CivilDateToJulianDate(gd, gm, gy) - 2415020.0 + (ut / 24.0); + double ut = LocalCivilTimeToUniversalTime(lh, lm, ls, ds, zc, dy, mn, yr); + double gd = LocalCivilTimeGreenwichDay(lh, lm, ls, ds, zc, dy, mn, yr); + int gm = LocalCivilTimeGreenwichMonth(lh, lm, ls, ds, zc, dy, mn, yr); + int gy = LocalCivilTimeGreenwichYear(lh, lm, ls, ds, zc, dy, mn, yr); + double t = ((CivilDateToJulianDate(gd, gm, gy) - 2415020.0) / 36525.0) + (ut / 876600.0); + double t2 = t * t; + + double m1 = 27.32158213; + double m2 = 365.2596407; + double m3 = 27.55455094; + double m4 = 29.53058868; + double m5 = 27.21222039; + double m6 = 6798.363307; + double q = CivilDateToJulianDate(gd, gm, gy) - 2415020.0 + (ut / 24.0); m1 = q / m1; m2 = q / m2; m3 = q / m3; @@ -3505,16 +3505,16 @@ public static double MoonMeanAnomaly(double lh, double lm, double ls, int ds, in m5 = 360.0 * (m5 - m5.Floor()); m6 = 360.0 * (m6 - m6.Floor()); - var ml = 270.434164 + m1 - (0.001133 - 0.0000019 * t) * t2; - var ms = 358.475833 + m2 - (0.00015 + 0.0000033 * t) * t2; - var md = 296.104608 + m3 + (0.009192 + 0.0000144 * t) * t2; - var na = 259.183275 - m6 + (0.002078 + 0.0000022 * t) * t2; - var a = (51.2 + 20.2 * t).ToRadians(); - var s1 = a.Sine(); - var s2 = na.ToRadians().Sine(); - var b = 346.56 + (132.87 - 0.0091731 * t) * t; - var s3 = 0.003964 * b.ToRadians().Sine(); - var c = (na + 275.05 - 2.3 * t).ToRadians(); + double ml = 270.434164 + m1 - (0.001133 - 0.0000019 * t) * t2; + double ms = 358.475833 + m2 - (0.00015 + 0.0000033 * t) * t2; + double md = 296.104608 + m3 + (0.009192 + 0.0000144 * t) * t2; + double na = 259.183275 - m6 + (0.002078 + 0.0000022 * t) * t2; + double a = (51.2 + 20.2 * t).ToRadians(); + double s1 = a.Sine(); + double s2 = na.ToRadians().Sine(); + double b = 346.56 + (132.87 - 0.0091731 * t) * t; + double s3 = 0.003964 * b.ToRadians().Sine(); + double c = (na + 275.05 - 2.3 * t).ToRadians(); md = md + 0.000817 * s1 + s3 + 0.002541 * s2; return md.ToRadians(); @@ -3533,22 +3533,22 @@ public static double MoonMeanAnomaly(double lh, double lm, double ls, int ds, in /// Local date, year part. public static double NewMoon(int ds, int zc, double dy, int mn, int yr) { - var d0 = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var m0 = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var y0 = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - - var j0 = CivilDateToJulianDate(0.0, 1, y0) - 2415020.0; - var dj = CivilDateToJulianDate(d0, m0, y0) - 2415020.0; - var k = Lint(((y0 - 1900.0 + ((dj - j0) / 365.0)) * 12.3685) + 0.5); - var tn = k / 1236.85; - var tf = (k + 0.5) / 1236.85; - var t = tn; - var nmfmResult1 = NewMoonFullMoon_L6855(k, t); - var ni = nmfmResult1.a; - var nf = nmfmResult1.b; + double d0 = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int m0 = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int y0 = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + + double j0 = CivilDateToJulianDate(0.0, 1, y0) - 2415020.0; + double dj = CivilDateToJulianDate(d0, m0, y0) - 2415020.0; + double k = Lint(((y0 - 1900.0 + ((dj - j0) / 365.0)) * 12.3685) + 0.5); + double tn = k / 1236.85; + double tf = (k + 0.5) / 1236.85; + double t = tn; + (double a, double b, double f) nmfmResult1 = NewMoonFullMoon_L6855(k, t); + double ni = nmfmResult1.a; + double nf = nmfmResult1.b; t = tf; k = k + 0.5; - var nmfmResult2 = NewMoonFullMoon_L6855(k, t); + (double a, double b, double f) nmfmResult2 = NewMoonFullMoon_L6855(k, t); return ni + 2415020.0 + nf; } @@ -3566,22 +3566,22 @@ public static double NewMoon(int ds, int zc, double dy, int mn, int yr) /// Local date, year part. public static double FullMoon(int ds, int zc, double dy, int mn, int yr) { - var d0 = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var m0 = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var y0 = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - - var j0 = CivilDateToJulianDate(0.0, 1, y0) - 2415020.0; - var dj = CivilDateToJulianDate(d0, m0, y0) - 2415020.0; - var k = Lint(((y0 - 1900.0 + ((dj - j0) / 365.0)) * 12.3685) + 0.5); - var tn = k / 1236.85; - var tf = (k + 0.5) / 1236.85; - var t = tn; - var nmfnResult1 = NewMoonFullMoon_L6855(k, t); + double d0 = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int m0 = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int y0 = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + + double j0 = CivilDateToJulianDate(0.0, 1, y0) - 2415020.0; + double dj = CivilDateToJulianDate(d0, m0, y0) - 2415020.0; + double k = Lint(((y0 - 1900.0 + ((dj - j0) / 365.0)) * 12.3685) + 0.5); + double tn = k / 1236.85; + double tf = (k + 0.5) / 1236.85; + double t = tn; + (double a, double b, double f) nmfnResult1 = NewMoonFullMoon_L6855(k, t); t = tf; k = k + 0.5; - var nmfnResult2 = NewMoonFullMoon_L6855(k, t); - var fi = nmfnResult2.a; - var ff = nmfnResult2.b; + (double a, double b, double f) nmfnResult2 = NewMoonFullMoon_L6855(k, t); + double fi = nmfnResult2.a; + double ff = nmfnResult2.b; return fi + 2415020.0 + ff; } @@ -3591,18 +3591,18 @@ public static double FullMoon(int ds, int zc, double dy, int mn, int yr) /// public static (double a, double b, double f) NewMoonFullMoon_L6855(double k, double t) { - var t2 = t * t; - var e = 29.53 * k; - var c = 166.56 + (132.87 - 0.009173 * t) * t; + double t2 = t * t; + double e = 29.53 * k; + double c = 166.56 + (132.87 - 0.009173 * t) * t; c = c.ToRadians(); - var b = 0.00058868 * k + (0.0001178 - 0.000000155 * t) * t2; + double b = 0.00058868 * k + (0.0001178 - 0.000000155 * t) * t2; b = b + 0.00033 * c.Sine() + 0.75933; - var a = k / 12.36886; - var a1 = 359.2242 + 360.0 * Fract(a) - (0.0000333 + 0.00000347 * t) * t2; - var a2 = 306.0253 + 360.0 * Fract(k / 0.9330851); + double a = k / 12.36886; + double a1 = 359.2242 + 360.0 * Fract(a) - (0.0000333 + 0.00000347 * t) * t2; + double a2 = 306.0253 + 360.0 * Fract(k / 0.9330851); a2 = a2 + (0.0107306 + 0.00001236 * t) * t2; a = k / 0.9214926; - var f = 21.2964 + 360.0 * Fract(a) - (0.0016528 + 0.00000239 * t) * t2; + double f = 21.2964 + 360.0 * Fract(a) - (0.0016528 + 0.00000239 * t) * t2; a1 = UnwindDeg(a1); a2 = UnwindDeg(a2); f = UnwindDeg(f); @@ -3610,15 +3610,15 @@ public static (double a, double b, double f) NewMoonFullMoon_L6855(double k, dou a2 = a2.ToRadians(); f = f.ToRadians(); - var dd = (0.1734 - 0.000393 * t) * a1.Sine() + 0.0021 * (2.0 * a1).Sine(); + double dd = (0.1734 - 0.000393 * t) * a1.Sine() + 0.0021 * (2.0 * a1).Sine(); dd = dd - 0.4068 * a2.Sine() + 0.0161 * (2.0 * a2).Sine() - 0.0004 * (3.0 * a2).Sine(); dd = dd + 0.0104 * (2.0 * f).Sine() - 0.0051 * (a1 + a2).Sine(); dd = dd - 0.0074 * (a1 - a2).Sine() + 0.0004 * (2.0 * f + a1).Sine(); dd = dd - 0.0004 * (2.0 * f - a1).Sine() - 0.0006 * (2.0 * f + a2).Sine() + 0.001 * (2.0 * f - a2).Sine(); dd = dd + 0.0005 * (a1 + 2.0 * a2).Sine(); - var e1 = e.Floor(); + double e1 = e.Floor(); b = b + dd + (e - e1); - var b1 = b.Floor(); + double b1 = b.Floor(); a = e1 + b1; b = b - b1; @@ -3656,7 +3656,7 @@ public static double IInt(double w) /// signValue -- Sign value: -1, 0, or 1 public static double Sign(double numberToCheck) { - var signValue = 0.0; + double signValue = 0.0; if (numberToCheck < 0.0) signValue = -1.0; @@ -3672,7 +3672,7 @@ public static double Sign(double numberToCheck) /// public static double UTDayAdjust(double ut, double g1) { - var returnValue = ut; + double returnValue = ut; if ((ut - g1) < -6.0) returnValue = ut + 24.0; @@ -3696,10 +3696,10 @@ public static double FPart(double w) /// public static double EQELat(double rah, double ram, double ras, double dd, double dm, double ds, double gd, int gm, int gy) { - var a = DegreeHoursToDecimalDegrees(HMStoDH(rah, ram, ras)).ToRadians(); - var b = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); - var c = Obliq(gd, gm, gy).ToRadians(); - var d = b.Sine() * c.Cosine() - b.Cosine() * c.Sine() * a.Sine(); + double a = DegreeHoursToDecimalDegrees(HMStoDH(rah, ram, ras)).ToRadians(); + double b = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); + double c = Obliq(gd, gm, gy).ToRadians(); + double d = b.Sine() * c.Cosine() - b.Cosine() * c.Sine() * a.Sine(); return Degrees(d.ASine()); } @@ -3709,12 +3709,12 @@ public static double EQELat(double rah, double ram, double ras, double dd, doubl /// public static double EQELong(double rah, double ram, double ras, double dd, double dm, double ds, double gd, int gm, int gy) { - var a = DegreeHoursToDecimalDegrees(HMStoDH(rah, ram, ras)).ToRadians(); - var b = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); - var c = Obliq(gd, gm, gy).ToRadians(); - var d = a.Sine() * c.Cosine() + b.Tangent() * c.Sine(); - var e = a.Cosine(); - var f = Degrees(d.AngleTangent2(e)); + double a = DegreeHoursToDecimalDegrees(HMStoDH(rah, ram, ras)).ToRadians(); + double b = DegreesMinutesSecondsToDecimalDegrees(dd, dm, ds).ToRadians(); + double c = Obliq(gd, gm, gy).ToRadians(); + double d = a.Sine() * c.Cosine() + b.Tangent() * c.Sine(); + double e = a.Cosine(); + double f = Degrees(d.AngleTangent2(e)); return f - 360.0 * (f / 360.0).Floor(); } @@ -3728,27 +3728,27 @@ public static double EQELong(double rah, double ram, double ras, double dd, doub /// hours public static double MoonRiseLCT(double dy, int mn, int yr, int ds, int zc, double gLong, double gLat) { - var gdy = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var gmn = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var gyr = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var lct = 12.0; - var dy1 = dy; - var mn1 = mn; - var yr1 = yr; + double gdy = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int gmn = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int gyr = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + double lct = 12.0; + double dy1 = dy; + int mn1 = mn; + int yr1 = yr; - var lct6700result1 = MoonRiseLCT_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); - var lu = lct6700result1.lu; + (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct) lct6700result1 = MoonRiseLCT_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); + double lu = lct6700result1.lu; lct = lct6700result1.lct; if (lct == -99.0) return lct; - var la = lu; + double la = lu; double x; double ut; - var g1 = 0.0; - var gu = 0.0; + double g1 = 0.0; + double gu = 0.0; for (int k = 1; k < 9; k++) { @@ -3760,7 +3760,7 @@ public static double MoonRiseLCT(double dy, int mn, int yr, int ds, int zc, doub gu = ut; ut = gu; - var lct6680result = MoonRiseLCT_L6680(x, ds, zc, gdy, gmn, gyr, g1, ut); + (double ut, double lct, double dy1, int mn1, int yr1, double gdy, int gmn, int gyr) lct6680result = MoonRiseLCT_L6680(x, ds, zc, gdy, gmn, gyr, g1, ut); lct = lct6680result.lct; dy1 = lct6680result.dy1; mn1 = lct6680result.mn1; @@ -3769,7 +3769,7 @@ public static double MoonRiseLCT(double dy, int mn, int yr, int ds, int zc, doub gmn = lct6680result.gmn; gyr = lct6680result.gyr; - var lct6700result2 = MoonRiseLCT_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); + (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct) lct6700result2 = MoonRiseLCT_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); lu = lct6700result2.lu; lct = lct6700result2.lct; @@ -3802,10 +3802,10 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, ut = ut + 23.93447; ut = UTDayAdjust(ut, g1); - var lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var mn1 = UniversalTime_LocalCivilMonth(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var yr1 = UniversalTime_LocalCivilYear(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + double lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + double dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + int mn1 = UniversalTime_LocalCivilMonth(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + int yr1 = UniversalTime_LocalCivilYear(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); gdy = LocalCivilTimeGreenwichDay(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gmn = LocalCivilTimeGreenwichMonth(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gyr = LocalCivilTimeGreenwichYear(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); @@ -3819,15 +3819,15 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, /// public static (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct) MoonRiseLCT_L6700(double lct, int ds, int zc, double dy1, int mn1, int yr1, double gdy, int gmn, int gyr, double gLat) { - var mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); - var dp = NutatLong(gdy, gmn, gyr); - var th = 0.27249 * pm.Sine(); - var di = th + 0.0098902 - pm; - var p = DecimalDegreesToDegreeHours(EcRA(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr)); - var q = EcDec(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr); - var lu = RiseSetLocalSiderealTimeRise(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); + double mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); + double bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); + double pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); + double dp = NutatLong(gdy, gmn, gyr); + double th = 0.27249 * pm.Sine(); + double di = th + 0.0098902 - pm; + double p = DecimalDegreesToDegreeHours(EcRA(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr)); + double q = EcDec(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr); + double lu = RiseSetLocalSiderealTimeRise(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); if (!ERS(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat).Equals("OK")) lct = -99.0; @@ -3848,27 +3848,27 @@ public static (double mm, double bm, double pm, double dp, double th, double di, /// public static (double dy1, int mn1, int yr1) MoonRiseLcDMY(double dy, int mn, int yr, int ds, int zc, double gLong, double gLat) { - var gdy = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var gmn = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var gyr = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var lct = 12.0; - var dy1 = dy; - var mn1 = mn; - var yr1 = yr; + double gdy = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int gmn = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int gyr = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + double lct = 12.0; + double dy1 = dy; + int mn1 = mn; + int yr1 = yr; - var lct6700result1 = MoonRiseLcDMY_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); - var lu = lct6700result1.lu; + (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct) lct6700result1 = MoonRiseLcDMY_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); + double lu = lct6700result1.lu; lct = lct6700result1.lct; if (lct == -99.0) return (lct, (int)lct, (int)lct); - var la = lu; + double la = lu; double x; double ut; - var g1 = 0.0; - var gu = 0.0; + double g1 = 0.0; + double gu = 0.0; for (int k = 1; k < 9; k++) { x = LocalSiderealTimeToGreenwichSiderealTime(la, 0.0, 0.0, gLong); @@ -3879,7 +3879,7 @@ public static (double dy1, int mn1, int yr1) MoonRiseLcDMY(double dy, int mn, in gu = ut; ut = gu; - var lct6680result1 = MoonRiseLcDMY_L6680(x, ds, zc, gdy, gmn, gyr, g1, ut); + (double ut, double lct, double dy1, int mn1, int yr1, double gdy, int gmn, int gyr) lct6680result1 = MoonRiseLcDMY_L6680(x, ds, zc, gdy, gmn, gyr, g1, ut); lct = lct6680result1.lct; dy1 = lct6680result1.dy1; mn1 = lct6680result1.mn1; @@ -3888,7 +3888,7 @@ public static (double dy1, int mn1, int yr1) MoonRiseLcDMY(double dy, int mn, in gmn = lct6680result1.gmn; gyr = lct6680result1.gyr; - var lct6700result2 = MoonRiseLcDMY_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); + (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct) lct6700result2 = MoonRiseLcDMY_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); lu = lct6700result2.lu; lct = lct6700result2.lct; @@ -3924,10 +3924,10 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, ut = ut + 23.93447; ut = UTDayAdjust(ut, g1); - var lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var mn1 = UniversalTime_LocalCivilMonth(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var yr1 = UniversalTime_LocalCivilYear(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + double lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + double dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + int mn1 = UniversalTime_LocalCivilMonth(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + int yr1 = UniversalTime_LocalCivilYear(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); gdy = LocalCivilTimeGreenwichDay(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gmn = LocalCivilTimeGreenwichMonth(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gyr = LocalCivilTimeGreenwichYear(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); @@ -3941,15 +3941,15 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, /// public static (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct) MoonRiseLcDMY_L6700(double lct, int ds, int zc, double dy1, int mn1, int yr1, double gdy, int gmn, int gyr, double gLat) { - var mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); - var dp = NutatLong(gdy, gmn, gyr); - var th = 0.27249 * pm.Sine(); - var di = th + 0.0098902 - pm; - var p = DecimalDegreesToDegreeHours(EcRA(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr)); - var q = EcDec(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr); - var lu = RiseSetLocalSiderealTimeRise(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); + double mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); + double bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); + double pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); + double dp = NutatLong(gdy, gmn, gyr); + double th = 0.27249 * pm.Sine(); + double di = th + 0.0098902 - pm; + double p = DecimalDegreesToDegreeHours(EcRA(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr)); + double q = EcDec(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr); + double lu = RiseSetLocalSiderealTimeRise(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); return (mm, bm, pm, dp, th, di, p, q, lu, lct); } @@ -3963,29 +3963,29 @@ public static (double mm, double bm, double pm, double dp, double th, double di, /// degrees public static double MoonRiseAz(double dy, int mn, int yr, int ds, int zc, double gLong, double gLat) { - var gdy = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var gmn = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var gyr = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var lct = 12.0; - var dy1 = dy; - var mn1 = mn; - var yr1 = yr; + double gdy = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int gmn = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int gyr = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + double lct = 12.0; + double dy1 = dy; + int mn1 = mn; + int yr1 = yr; - var az6700result1 = MoonRiseAz_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); - var lu = az6700result1.lu; + (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct, double au) az6700result1 = MoonRiseAz_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); + double lu = az6700result1.lu; lct = az6700result1.lct; double au; if (lct == -99.0) return lct; - var la = lu; + double la = lu; double x; double ut; double g1; - var gu = 0.0; - var aa = 0.0; + double gu = 0.0; + double aa = 0.0; for (int k = 1; k < 9; k++) { x = LocalSiderealTimeToGreenwichSiderealTime(la, 0.0, 0.0, gLong); @@ -3996,7 +3996,7 @@ public static double MoonRiseAz(double dy, int mn, int yr, int ds, int zc, doubl gu = ut; ut = gu; - var az6680result1 = MoonRiseAz_L6680(x, ds, zc, gdy, gmn, gyr, g1, ut); + (double ut, double lct, double dy1, int mn1, int yr1, double gdy, int gmn, int gyr) az6680result1 = MoonRiseAz_L6680(x, ds, zc, gdy, gmn, gyr, g1, ut); lct = az6680result1.lct; dy1 = az6680result1.dy1; mn1 = az6680result1.mn1; @@ -4005,7 +4005,7 @@ public static double MoonRiseAz(double dy, int mn, int yr, int ds, int zc, doubl gmn = az6680result1.gmn; gyr = az6680result1.gyr; - var az6700result2 = MoonRiseAz_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); + (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct, double au) az6700result2 = MoonRiseAz_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); lu = az6700result2.lu; lct = az6700result2.lct; au = az6700result2.au; @@ -4032,10 +4032,10 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, ut = ut + 23.93447; ut = UTDayAdjust(ut, g1); - var lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var mn1 = UniversalTime_LocalCivilMonth(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var yr1 = UniversalTime_LocalCivilYear(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + double lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + double dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + int mn1 = UniversalTime_LocalCivilMonth(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + int yr1 = UniversalTime_LocalCivilYear(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); gdy = LocalCivilTimeGreenwichDay(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gmn = LocalCivilTimeGreenwichMonth(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gyr = LocalCivilTimeGreenwichYear(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); @@ -4049,16 +4049,16 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, /// public static (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct, double au) MoonRiseAz_L6700(double lct, int ds, int zc, double dy1, int mn1, int yr1, double gdy, int gmn, int gyr, double gLat) { - var mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); - var dp = NutatLong(gdy, gmn, gyr); - var th = 0.27249 * pm.Sine(); - var di = th + 0.0098902 - pm; - var p = DecimalDegreesToDegreeHours(EcRA(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr)); - var q = EcDec(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr); - var lu = RiseSetLocalSiderealTimeRise(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); - var au = RiseSetAzimuthRise(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); + double mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); + double bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); + double pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); + double dp = NutatLong(gdy, gmn, gyr); + double th = 0.27249 * pm.Sine(); + double di = th + 0.0098902 - pm; + double p = DecimalDegreesToDegreeHours(EcRA(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr)); + double q = EcDec(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr); + double lu = RiseSetLocalSiderealTimeRise(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); + double au = RiseSetAzimuthRise(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); return (mm, bm, pm, dp, th, di, p, q, lu, lct, au); } @@ -4072,27 +4072,27 @@ public static (double mm, double bm, double pm, double dp, double th, double di, /// hours public static double MoonSetLCT(double dy, int mn, int yr, int ds, int zc, double gLong, double gLat) { - var gdy = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var gmn = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var gyr = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var lct = 12.0; - var dy1 = dy; - var mn1 = mn; - var yr1 = yr; + double gdy = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int gmn = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int gyr = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + double lct = 12.0; + double dy1 = dy; + int mn1 = mn; + int yr1 = yr; - var lct6700result1 = MoonSetLCT_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); - var lu = lct6700result1.lu; + (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct) lct6700result1 = MoonSetLCT_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); + double lu = lct6700result1.lu; lct = lct6700result1.lct; if (lct == -99.0) return lct; - var la = lu; + double la = lu; double x; double ut; - var g1 = 0.0; - var gu = 0.0; + double g1 = 0.0; + double gu = 0.0; for (int k = 1; k < 9; k++) { x = LocalSiderealTimeToGreenwichSiderealTime(la, 0.0, 0.0, gLong); @@ -4103,7 +4103,7 @@ public static double MoonSetLCT(double dy, int mn, int yr, int ds, int zc, doubl gu = ut; ut = gu; - var lct6680result1 = MoonSetLCT_L6680(x, ds, zc, gdy, gmn, gyr, g1, ut); + (double ut, double lct, double dy1, int mn1, int yr1, double gdy, int gmn, int gyr) lct6680result1 = MoonSetLCT_L6680(x, ds, zc, gdy, gmn, gyr, g1, ut); lct = lct6680result1.lct; dy1 = lct6680result1.dy1; mn1 = lct6680result1.mn1; @@ -4112,7 +4112,7 @@ public static double MoonSetLCT(double dy, int mn, int yr, int ds, int zc, doubl gmn = lct6680result1.gmn; gyr = lct6680result1.gyr; - var lct6700result2 = MoonSetLCT_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); + (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct) lct6700result2 = MoonSetLCT_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); lu = lct6700result2.lu; lct = lct6700result2.lct; @@ -4145,10 +4145,10 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, ut = ut + 23.93447; ut = UTDayAdjust(ut, g1); - var lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var mn1 = UniversalTime_LocalCivilMonth(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var yr1 = UniversalTime_LocalCivilYear(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + double lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + double dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + int mn1 = UniversalTime_LocalCivilMonth(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + int yr1 = UniversalTime_LocalCivilYear(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); gdy = LocalCivilTimeGreenwichDay(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gmn = LocalCivilTimeGreenwichMonth(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gyr = LocalCivilTimeGreenwichYear(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); @@ -4162,15 +4162,15 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, /// public static (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct) MoonSetLCT_L6700(double lct, int ds, int zc, double dy1, int mn1, int yr1, double gdy, int gmn, int gyr, double gLat) { - var mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); - var dp = NutatLong(gdy, gmn, gyr); - var th = 0.27249 * pm.Sine(); - var di = th + 0.0098902 - pm; - var p = DecimalDegreesToDegreeHours(EcRA(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr)); - var q = EcDec(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr); - var lu = RiseSetLocalSiderealTimeSet(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); + double mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); + double bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); + double pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); + double dp = NutatLong(gdy, gmn, gyr); + double th = 0.27249 * pm.Sine(); + double di = th + 0.0098902 - pm; + double p = DecimalDegreesToDegreeHours(EcRA(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr)); + double q = EcDec(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr); + double lu = RiseSetLocalSiderealTimeSet(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); if (!ERS(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat).Equals("OK")) lct = -99.0; @@ -4191,27 +4191,27 @@ public static (double mm, double bm, double pm, double dp, double th, double di, /// public static (double dy1, int mn1, int yr1) MoonSetLcDMY(double dy, int mn, int yr, int ds, int zc, double gLong, double gLat) { - var gdy = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var gmn = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var gyr = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var lct = 12.0; - var dy1 = dy; - var mn1 = mn; - var yr1 = yr; + double gdy = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int gmn = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int gyr = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + double lct = 12.0; + double dy1 = dy; + int mn1 = mn; + int yr1 = yr; - var dmy6700result1 = MoonSetLcDMY_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); - var lu = dmy6700result1.lu; + (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct) dmy6700result1 = MoonSetLcDMY_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); + double lu = dmy6700result1.lu; lct = dmy6700result1.lct; if (lct == -99.0) return (lct, (int)lct, (int)lct); - var la = lu; + double la = lu; double x; double ut; - var g1 = 0.0; - var gu = 0.0; + double g1 = 0.0; + double gu = 0.0; for (int k = 1; k < 9; k++) { x = LocalSiderealTimeToGreenwichSiderealTime(la, 0.0, 0.0, gLong); @@ -4222,7 +4222,7 @@ public static (double dy1, int mn1, int yr1) MoonSetLcDMY(double dy, int mn, int gu = ut; ut = gu; - var dmy6680result1 = MoonSetLcDMY_L6680(x, ds, zc, gdy, gmn, gyr, g1, ut); + (double ut, double lct, double dy1, int mn1, int yr1, double gdy, int gmn, int gyr) dmy6680result1 = MoonSetLcDMY_L6680(x, ds, zc, gdy, gmn, gyr, g1, ut); lct = dmy6680result1.lct; dy1 = dmy6680result1.dy1; mn1 = dmy6680result1.mn1; @@ -4231,7 +4231,7 @@ public static (double dy1, int mn1, int yr1) MoonSetLcDMY(double dy, int mn, int gmn = dmy6680result1.gmn; gyr = dmy6680result1.gyr; - var dmy6700result2 = MoonSetLcDMY_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); + (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct) dmy6700result2 = MoonSetLcDMY_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); lu = dmy6700result2.lu; lct = dmy6700result2.lct; @@ -4266,10 +4266,10 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, ut = ut + 23.93447; ut = UTDayAdjust(ut, g1); - var lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var mn1 = UniversalTime_LocalCivilMonth(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var yr1 = UniversalTime_LocalCivilYear(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + double lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + double dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + int mn1 = UniversalTime_LocalCivilMonth(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + int yr1 = UniversalTime_LocalCivilYear(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); gdy = LocalCivilTimeGreenwichDay(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gmn = LocalCivilTimeGreenwichMonth(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gyr = LocalCivilTimeGreenwichYear(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); @@ -4283,15 +4283,15 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, /// public static (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct) MoonSetLcDMY_L6700(double lct, int ds, int zc, double dy1, int mn1, int yr1, double gdy, int gmn, int gyr, double gLat) { - var mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); - var dp = NutatLong(gdy, gmn, gyr); - var th = 0.27249 * pm.Sine(); - var di = th + 0.0098902 - pm; - var p = DecimalDegreesToDegreeHours(EcRA(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr)); - var q = EcDec(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr); - var lu = RiseSetLocalSiderealTimeSet(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); + double mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); + double bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); + double pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); + double dp = NutatLong(gdy, gmn, gyr); + double th = 0.27249 * pm.Sine(); + double di = th + 0.0098902 - pm; + double p = DecimalDegreesToDegreeHours(EcRA(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr)); + double q = EcDec(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr); + double lu = RiseSetLocalSiderealTimeSet(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); return (mm, bm, pm, dp, th, di, p, q, lu, lct); } @@ -4305,16 +4305,16 @@ public static (double mm, double bm, double pm, double dp, double th, double di, /// degrees public static double MoonSetAz(double dy, int mn, int yr, int ds, int zc, double gLong, double gLat) { - var gdy = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var gmn = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var gyr = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var lct = 12.0; - var dy1 = dy; - var mn1 = mn; - var yr1 = yr; + double gdy = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int gmn = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int gyr = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + double lct = 12.0; + double dy1 = dy; + int mn1 = mn; + int yr1 = yr; - var az6700result1 = MoonSetAz_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); - var lu = az6700result1.lu; + (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct, double au) az6700result1 = MoonSetAz_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); + double lu = az6700result1.lu; lct = az6700result1.lct; double au; @@ -4322,13 +4322,13 @@ public static double MoonSetAz(double dy, int mn, int yr, int ds, int zc, double if (lct == -99.0) return lct; - var la = lu; + double la = lu; double x; double ut; double g1; - var gu = 0.0; - var aa = 0.0; + double gu = 0.0; + double aa = 0.0; for (int k = 1; k < 9; k++) { x = LocalSiderealTimeToGreenwichSiderealTime(la, 0.0, 0.0, gLong); @@ -4339,7 +4339,7 @@ public static double MoonSetAz(double dy, int mn, int yr, int ds, int zc, double gu = ut; ut = gu; - var az6680result1 = MoonSetAz_L6680(x, ds, zc, gdy, gmn, gyr, g1, ut); + (double ut, double lct, double dy1, int mn1, int yr1, double gdy, int gmn, int gyr) az6680result1 = MoonSetAz_L6680(x, ds, zc, gdy, gmn, gyr, g1, ut); lct = az6680result1.lct; dy1 = az6680result1.dy1; mn1 = az6680result1.mn1; @@ -4348,7 +4348,7 @@ public static double MoonSetAz(double dy, int mn, int yr, int ds, int zc, double gmn = az6680result1.gmn; gyr = az6680result1.gyr; - var az6700result2 = MoonSetAz_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); + (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct, double au) az6700result2 = MoonSetAz_L6700(lct, ds, zc, dy1, mn1, yr1, gdy, gmn, gyr, gLat); lu = az6700result2.lu; lct = az6700result2.lct; au = az6700result2.au; @@ -4375,10 +4375,10 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, ut = ut + 23.93447; ut = UTDayAdjust(ut, g1); - var lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var mn1 = UniversalTime_LocalCivilMonth(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); - var yr1 = UniversalTime_LocalCivilYear(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + double lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + double dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + int mn1 = UniversalTime_LocalCivilMonth(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); + int yr1 = UniversalTime_LocalCivilYear(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); gdy = LocalCivilTimeGreenwichDay(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gmn = LocalCivilTimeGreenwichMonth(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gyr = LocalCivilTimeGreenwichYear(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); @@ -4392,16 +4392,16 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, /// public static (double mm, double bm, double pm, double dp, double th, double di, double p, double q, double lu, double lct, double au) MoonSetAz_L6700(double lct, int ds, int zc, double dy1, int mn1, int yr1, double gdy, int gmn, int gyr, double gLat) { - var mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - var pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); - var dp = NutatLong(gdy, gmn, gyr); - var th = 0.27249 * pm.Sine(); - var di = th + 0.0098902 - pm; - var p = DecimalDegreesToDegreeHours(EcRA(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr)); - var q = EcDec(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr); - var lu = RiseSetLocalSiderealTimeSet(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); - var au = RiseSetAzimuthSet(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); + double mm = MoonLong(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); + double bm = MoonLat(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); + double pm = MoonHP(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1).ToRadians(); + double dp = NutatLong(gdy, gmn, gyr); + double th = 0.27249 * pm.Sine(); + double di = th + 0.0098902 - pm; + double p = DecimalDegreesToDegreeHours(EcRA(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr)); + double q = EcDec(mm + dp, 0.0, 0.0, bm, 0.0, 0.0, gdy, gmn, gyr); + double lu = RiseSetLocalSiderealTimeSet(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); + double au = RiseSetAzimuthSet(p, 0.0, 0.0, q, 0.0, 0.0, Degrees(di), gLat); return (mm, bm, pm, dp, th, di, p, q, lu, lct, au); } @@ -4414,29 +4414,29 @@ public static (double mm, double bm, double pm, double dp, double th, double di, /// public static string LunarEclipseOccurrence(int ds, int zc, double dy, int mn, int yr) { - var d0 = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var m0 = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var y0 = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + double d0 = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int m0 = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int y0 = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var j0 = CivilDateToJulianDate(0.0, 1, y0); - var dj = CivilDateToJulianDate(d0, m0, y0); - var k = (y0 - 1900.0 + ((dj - j0) * 1.0 / 365.0)) * 12.3685; + double j0 = CivilDateToJulianDate(0.0, 1, y0); + double dj = CivilDateToJulianDate(d0, m0, y0); + double k = (y0 - 1900.0 + ((dj - j0) * 1.0 / 365.0)) * 12.3685; k = Lint(k + 0.5); - var tn = k / 1236.85; - var tf = (k + 0.5) / 1236.85; - var t = tn; - var l6855result1 = LunarEclipseOccurrence_L6855(t, k); + double tn = k / 1236.85; + double tf = (k + 0.5) / 1236.85; + double t = tn; + (double f, double dd, double e1, double b1, double a, double b) l6855result1 = LunarEclipseOccurrence_L6855(t, k); t = tf; k = k + 0.5; - var l6855result2 = LunarEclipseOccurrence_L6855(t, k); - var fb = l6855result2.f; + (double f, double dd, double e1, double b1, double a, double b) l6855result2 = LunarEclipseOccurrence_L6855(t, k); + double fb = l6855result2.f; - var df = Math.Abs(fb - 3.141592654 * Lint(fb / 3.141592654)); + double df = Math.Abs(fb - 3.141592654 * Lint(fb / 3.141592654)); if (df > 0.37) df = 3.141592654 - df; - var s = "Lunar eclipse certain"; + string s = "Lunar eclipse certain"; if (df >= 0.242600766) { s = "Lunar eclipse possible"; @@ -4453,18 +4453,18 @@ public static string LunarEclipseOccurrence(int ds, int zc, double dy, int mn, i /// public static (double f, double dd, double e1, double b1, double a, double b) LunarEclipseOccurrence_L6855(double t, double k) { - var t2 = t * t; - var e = 29.53 * k; - var c = 166.56 + (132.87 - 0.009173 * t) * t; + double t2 = t * t; + double e = 29.53 * k; + double c = 166.56 + (132.87 - 0.009173 * t) * t; c = c.ToRadians(); - var b = 0.00058868 * k + (0.0001178 - 0.000000155 * t) * t2; + double b = 0.00058868 * k + (0.0001178 - 0.000000155 * t) * t2; b = b + 0.00033 * c.Sine() + 0.75933; - var a = k / 12.36886; - var a1 = 359.2242 + 360.0 * FPart(a) - (0.0000333 + 0.00000347 * t) * t2; - var a2 = 306.0253 + 360.0 * FPart(k / 0.9330851); + double a = k / 12.36886; + double a1 = 359.2242 + 360.0 * FPart(a) - (0.0000333 + 0.00000347 * t) * t2; + double a2 = 306.0253 + 360.0 * FPart(k / 0.9330851); a2 = a2 + (0.0107306 + 0.00001236 * t) * t2; a = k / 0.9214926; - var f = 21.2964 + 360.0 * FPart(a) - (0.0016528 + 0.00000239 * t) * t2; + double f = 21.2964 + 360.0 * FPart(a) - (0.0016528 + 0.00000239 * t) * t2; a1 = UnwindDeg(a1); a2 = UnwindDeg(a2); f = UnwindDeg(f); @@ -4472,15 +4472,15 @@ public static (double f, double dd, double e1, double b1, double a, double b) Lu a2 = a2.ToRadians(); f = f.ToRadians(); - var dd = (0.1734 - 0.000393 * t) * a1.Sine() + 0.0021 * (2.0 * a1).Sine(); + double dd = (0.1734 - 0.000393 * t) * a1.Sine() + 0.0021 * (2.0 * a1).Sine(); dd = dd - 0.4068 * a2.Sine() + 0.0161 * (2.0 * a2).Sine() - 0.0004 * (3.0 * a2).Sine(); dd = dd + 0.0104 * (2.0 * f).Sine() - 0.0051 * (a1 + a2).Sine(); dd = dd - 0.0074 * (a1 - a2).Sine() + 0.0004 * (2.0 * f + a1).Sine(); dd = dd - 0.0004 * (2.0 * f - a1).Sine() - 0.0006 * (2.0 * f + a2).Sine() + 0.001 * (2.0 * f - a2).Sine(); dd = dd + 0.0005 * (a1 + 2.0 * a2).Sine(); - var e1 = e.Floor(); + double e1 = e.Floor(); b = b + dd + (e - e1); - var b1 = b.Floor(); + double b1 = b.Floor(); a = e1 + b1; b = b - b1; @@ -4495,64 +4495,64 @@ public static (double f, double dd, double e1, double b1, double a, double b) Lu /// public static double UTMaxLunarEclipse(double dy, int mn, int yr, int ds, int zc) { - var tp = 2.0 * Math.PI; + double tp = 2.0 * Math.PI; if (LunarEclipseOccurrence(ds, zc, dy, mn, yr).Equals("No lunar eclipse")) return -99.0; - var dj = FullMoon(ds, zc, dy, mn, yr); - var gday = JulianDateDay(dj); - var gmonth = JulianDateMonth(dj); - var gyear = JulianDateYear(dj); - var igday = gday.Floor(); - var xi = gday - igday; - var utfm = xi * 24.0; - var ut = utfm - 1.0; - var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double dj = FullMoon(ds, zc, dy, mn, yr); + double gday = JulianDateDay(dj); + int gmonth = JulianDateMonth(dj); + int gyear = JulianDateYear(dj); + double igday = gday.Floor(); + double xi = gday - igday; + double utfm = xi * 24.0; + double ut = utfm - 1.0; + double ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; - var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + double mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; - var xh = utfm; - var x0 = xh + 1.0 - (2.0 * bz / (bz - by)); - var dm = mz - my; + double xh = utfm; + double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); + double dm = mz - my; if (dm < 0.0) dm = dm + tp; - var lj = (dm - sb) / 2.0; - var q = 0.0; - var mr = my + (dm * (x0 - xh + 1.0) / 2.0); + double lj = (dm - sb) / 2.0; + double q = 0.0; + double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; - var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); + double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; bz = bz - q; - var p3 = 0.00004263; - var zh = (sr - mr) / lj; - var tc = x0 + zh; - var sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; - var s2 = sh * sh; - var z2 = zh * zh; - var ps = p3 / (rr * lj); - var z1 = (zh * z2 / (z2 + s2)) + x0; - var h0 = (hy + hz) / (2.0 * lj); - var rm = 0.272446 * h0; - var rn = 0.00465242 / (lj * rr); - var hd = h0 * 0.99834; - var rp = (hd + rn + ps) * 1.02; - var r = rm + rp; - var dd = z1 - x0; + double p3 = 0.00004263; + double zh = (sr - mr) / lj; + double tc = x0 + zh; + double sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; + double s2 = sh * sh; + double z2 = zh * zh; + double ps = p3 / (rr * lj); + double z1 = (zh * z2 / (z2 + s2)) + x0; + double h0 = (hy + hz) / (2.0 * lj); + double rm = 0.272446 * h0; + double rn = 0.00465242 / (lj * rr); + double hd = h0 * 0.99834; + double rp = (hd + rn + ps) * 1.02; + double r = rm + rp; + double dd = z1 - x0; dd = dd * dd - ((z2 - (r * r)) * dd / zh); if (dd < 0.0) @@ -4569,71 +4569,71 @@ public static double UTMaxLunarEclipse(double dy, int mn, int yr, int ds, int zc /// public static double UTFirstContactLunarEclipse(double dy, int mn, int yr, int ds, int zc) { - var tp = 2.0 * Math.PI; + double tp = 2.0 * Math.PI; if (LunarEclipseOccurrence(ds, zc, dy, mn, yr).Equals("No lunar eclipse")) return -99.0; - var dj = FullMoon(ds, zc, dy, mn, yr); - var gday = JulianDateDay(dj); - var gmonth = JulianDateMonth(dj); - var gyear = JulianDateYear(dj); - var igday = gday.Floor(); - var xi = gday - igday; - var utfm = xi * 24.0; - var ut = utfm - 1.0; - var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double dj = FullMoon(ds, zc, dy, mn, yr); + double gday = JulianDateDay(dj); + int gmonth = JulianDateMonth(dj); + int gyear = JulianDateYear(dj); + double igday = gday.Floor(); + double xi = gday - igday; + double utfm = xi * 24.0; + double ut = utfm - 1.0; + double ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; - var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + double mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; - var xh = utfm; - var x0 = xh + 1.0 - (2.0 * bz / (bz - by)); - var dm = mz - my; + double xh = utfm; + double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); + double dm = mz - my; if (dm < 0.0) dm = dm + tp; - var lj = (dm - sb) / 2.0; - var q = 0.0; - var mr = my + (dm * (x0 - xh + 1.0) / 2.0); + double lj = (dm - sb) / 2.0; + double q = 0.0; + double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; - var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); + double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; bz = bz - q; - var p3 = 0.00004263; - var zh = (sr - mr) / lj; - var tc = x0 + zh; - var sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; - var s2 = sh * sh; - var z2 = zh * zh; - var ps = p3 / (rr * lj); - var z1 = (zh * z2 / (z2 + s2)) + x0; - var h0 = (hy + hz) / (2.0 * lj); - var rm = 0.272446 * h0; - var rn = 0.00465242 / (lj * rr); - var hd = h0 * 0.99834; - var rp = (hd + rn + ps) * 1.02; - var r = rm + rp; - var dd = z1 - x0; + double p3 = 0.00004263; + double zh = (sr - mr) / lj; + double tc = x0 + zh; + double sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; + double s2 = sh * sh; + double z2 = zh * zh; + double ps = p3 / (rr * lj); + double z1 = (zh * z2 / (z2 + s2)) + x0; + double h0 = (hy + hz) / (2.0 * lj); + double rm = 0.272446 * h0; + double rn = 0.00465242 / (lj * rr); + double hd = h0 * 0.99834; + double rp = (hd + rn + ps) * 1.02; + double r = rm + rp; + double dd = z1 - x0; dd = dd * dd - ((z2 - (r * r)) * dd / zh); if (dd < 0.0) return -99.0; - var zd = dd.SquareRoot(); - var z6 = z1 - zd; + double zd = dd.SquareRoot(); + double z6 = z1 - zd; if (z6 < 0.0) z6 = z6 + 24.0; @@ -4649,71 +4649,71 @@ public static double UTFirstContactLunarEclipse(double dy, int mn, int yr, int d /// public static double UTLastContactLunarEclipse(double dy, int mn, int yr, int ds, int zc) { - var tp = 2.0 * Math.PI; + double tp = 2.0 * Math.PI; if (LunarEclipseOccurrence(ds, zc, dy, mn, yr).Equals("No lunar eclipse")) return -99.0; - var dj = FullMoon(ds, zc, dy, mn, yr); - var gday = JulianDateDay(dj); - var gmonth = JulianDateMonth(dj); - var gyear = JulianDateYear(dj); - var igday = gday.Floor(); - var xi = gday - igday; - var utfm = xi * 24.0; - var ut = utfm - 1.0; - var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double dj = FullMoon(ds, zc, dy, mn, yr); + double gday = JulianDateDay(dj); + int gmonth = JulianDateMonth(dj); + int gyear = JulianDateYear(dj); + double igday = gday.Floor(); + double xi = gday - igday; + double utfm = xi * 24.0; + double ut = utfm - 1.0; + double ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; - var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + double mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; - var xh = utfm; - var x0 = xh + 1.0 - (2.0 * bz / (bz - by)); - var dm = mz - my; + double xh = utfm; + double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); + double dm = mz - my; if (dm < 0.0) dm = dm + tp; - var lj = (dm - sb) / 2.0; - var q = 0.0; - var mr = my + (dm * (x0 - xh + 1.0) / 2.0); + double lj = (dm - sb) / 2.0; + double q = 0.0; + double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; - var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); + double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; bz = bz - q; - var p3 = 0.00004263; - var zh = (sr - mr) / lj; - var tc = x0 + zh; - var sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; - var s2 = sh * sh; - var z2 = zh * zh; - var ps = p3 / (rr * lj); - var z1 = (zh * z2 / (z2 + s2)) + x0; - var h0 = (hy + hz) / (2.0 * lj); - var rm = 0.272446 * h0; - var rn = 0.00465242 / (lj * rr); - var hd = h0 * 0.99834; - var rp = (hd + rn + ps) * 1.02; - var r = rm + rp; - var dd = z1 - x0; + double p3 = 0.00004263; + double zh = (sr - mr) / lj; + double tc = x0 + zh; + double sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; + double s2 = sh * sh; + double z2 = zh * zh; + double ps = p3 / (rr * lj); + double z1 = (zh * z2 / (z2 + s2)) + x0; + double h0 = (hy + hz) / (2.0 * lj); + double rm = 0.272446 * h0; + double rn = 0.00465242 / (lj * rr); + double hd = h0 * 0.99834; + double rp = (hd + rn + ps) * 1.02; + double r = rm + rp; + double dd = z1 - x0; dd = dd * dd - ((z2 - (r * r)) * dd / zh); if (dd < 0.0) return -99.0; - var zd = dd.SquareRoot(); - var z7 = z1 + zd - Lint((z1 + zd) / 24.0) * 24.0; + double zd = dd.SquareRoot(); + double z7 = z1 + zd - Lint((z1 + zd) / 24.0) * 24.0; return z7; } @@ -4726,73 +4726,73 @@ public static double UTLastContactLunarEclipse(double dy, int mn, int yr, int ds /// public static double UTStartUmbraLunarEclipse(double dy, int mn, int yr, int ds, int zc) { - var tp = 2.0 * Math.PI; + double tp = 2.0 * Math.PI; if (LunarEclipseOccurrence(ds, zc, dy, mn, yr).Equals("No lunar eclipse")) return -99.0; - var dj = FullMoon(ds, zc, dy, mn, yr); - var gday = JulianDateDay(dj); - var gmonth = JulianDateMonth(dj); - var gyear = JulianDateYear(dj); - var igday = gday.Floor(); - var xi = gday - igday; - var utfm = xi * 24.0; - var ut = utfm - 1.0; - var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double dj = FullMoon(ds, zc, dy, mn, yr); + double gday = JulianDateDay(dj); + int gmonth = JulianDateMonth(dj); + int gyear = JulianDateYear(dj); + double igday = gday.Floor(); + double xi = gday - igday; + double utfm = xi * 24.0; + double ut = utfm - 1.0; + double ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; - var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + double mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; - var xh = utfm; - var x0 = xh + 1.0 - (2.0 * bz / (bz - by)); - var dm = mz - my; + double xh = utfm; + double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); + double dm = mz - my; if (dm < 0.0) dm = dm + tp; - var lj = (dm - sb) / 2.0; - var q = 0.0; - var mr = my + (dm * (x0 - xh + 1.0) / 2.0); + double lj = (dm - sb) / 2.0; + double q = 0.0; + double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; - var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); + double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; bz = bz - q; - var p3 = 0.00004263; - var zh = (sr - mr) / lj; - var tc = x0 + zh; - var sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; - var s2 = sh * sh; - var z2 = zh * zh; - var ps = p3 / (rr * lj); - var z1 = (zh * z2 / (z2 + s2)) + x0; - var h0 = (hy + hz) / (2.0 * lj); - var rm = 0.272446 * h0; - var rn = 0.00465242 / (lj * rr); - var hd = h0 * 0.99834; - var ru = (hd - rn + ps) * 1.02; - var rp = (hd + rn + ps) * 1.02; - var pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); - var r = rm + rp; - var dd = z1 - x0; + double p3 = 0.00004263; + double zh = (sr - mr) / lj; + double tc = x0 + zh; + double sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; + double s2 = sh * sh; + double z2 = zh * zh; + double ps = p3 / (rr * lj); + double z1 = (zh * z2 / (z2 + s2)) + x0; + double h0 = (hy + hz) / (2.0 * lj); + double rm = 0.272446 * h0; + double rn = 0.00465242 / (lj * rr); + double hd = h0 * 0.99834; + double ru = (hd - rn + ps) * 1.02; + double rp = (hd + rn + ps) * 1.02; + double pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); + double r = rm + rp; + double dd = z1 - x0; dd = dd * dd - ((z2 - (r * r)) * dd / zh); if (dd < 0.0) return -99.0; - var zd = dd.SquareRoot(); - var z6 = z1 - zd; + double zd = dd.SquareRoot(); + double z6 = z1 - zd; r = rm + ru; dd = z1 - x0; @@ -4802,7 +4802,7 @@ public static double UTStartUmbraLunarEclipse(double dy, int mn, int yr, int ds, return -99.0; zd = dd.SquareRoot(); - var z8 = z1 - zd; + double z8 = z1 - zd; if (z8 < 0.0) z8 = z8 + 24.0; @@ -4818,73 +4818,73 @@ public static double UTStartUmbraLunarEclipse(double dy, int mn, int yr, int ds, /// public static double UTEndUmbraLunarEclipse(double dy, int mn, int yr, int ds, int zc) { - var tp = 2.0 * Math.PI; + double tp = 2.0 * Math.PI; if (LunarEclipseOccurrence(ds, zc, dy, mn, yr).Equals("No lunar eclipse")) return -99.0; - var dj = FullMoon(ds, zc, dy, mn, yr); - var gday = JulianDateDay(dj); - var gmonth = JulianDateMonth(dj); - var gyear = JulianDateYear(dj); - var igday = gday.Floor(); - var xi = gday - igday; - var utfm = xi * 24.0; - var ut = utfm - 1.0; - var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double dj = FullMoon(ds, zc, dy, mn, yr); + double gday = JulianDateDay(dj); + int gmonth = JulianDateMonth(dj); + int gyear = JulianDateYear(dj); + double igday = gday.Floor(); + double xi = gday - igday; + double utfm = xi * 24.0; + double ut = utfm - 1.0; + double ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; - var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + double mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; - var xh = utfm; - var x0 = xh + 1.0 - (2.0 * bz / (bz - by)); - var dm = mz - my; + double xh = utfm; + double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); + double dm = mz - my; if (dm < 0.0) dm = dm + tp; - var lj = (dm - sb) / 2.0; - var q = 0.0; - var mr = my + (dm * (x0 - xh + 1.0) / 2.0); + double lj = (dm - sb) / 2.0; + double q = 0.0; + double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; - var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); + double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; bz = bz - q; - var p3 = 0.00004263; - var zh = (sr - mr) / lj; - var tc = x0 + zh; - var sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; - var s2 = sh * sh; - var z2 = zh * zh; - var ps = p3 / (rr * lj); - var z1 = (zh * z2 / (z2 + s2)) + x0; - var h0 = (hy + hz) / (2.0 * lj); - var rm = 0.272446 * h0; - var rn = 0.00465242 / (lj * rr); - var hd = h0 * 0.99834; - var ru = (hd - rn + ps) * 1.02; - var rp = (hd + rn + ps) * 1.02; - var pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); - var r = rm + rp; - var dd = z1 - x0; + double p3 = 0.00004263; + double zh = (sr - mr) / lj; + double tc = x0 + zh; + double sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; + double s2 = sh * sh; + double z2 = zh * zh; + double ps = p3 / (rr * lj); + double z1 = (zh * z2 / (z2 + s2)) + x0; + double h0 = (hy + hz) / (2.0 * lj); + double rm = 0.272446 * h0; + double rn = 0.00465242 / (lj * rr); + double hd = h0 * 0.99834; + double ru = (hd - rn + ps) * 1.02; + double rp = (hd + rn + ps) * 1.02; + double pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); + double r = rm + rp; + double dd = z1 - x0; dd = dd * dd - ((z2 - (r * r)) * dd / zh); if (dd < 0.0) return -99.0; - var zd = dd.SquareRoot(); - var z6 = z1 - zd; + double zd = dd.SquareRoot(); + double z6 = z1 - zd; r = rm + ru; dd = z1 - x0; @@ -4894,7 +4894,7 @@ public static double UTEndUmbraLunarEclipse(double dy, int mn, int yr, int ds, i return -99.0; zd = dd.SquareRoot(); - var z9 = z1 + zd - Lint((z1 + zd) / 24.0) * 24.0; + double z9 = z1 + zd - Lint((z1 + zd) / 24.0) * 24.0; return z9; } @@ -4907,73 +4907,73 @@ public static double UTEndUmbraLunarEclipse(double dy, int mn, int yr, int ds, i /// public static double UTStartTotalLunarEclipse(double dy, int mn, int yr, int ds, int zc) { - var tp = 2.0 * Math.PI; + double tp = 2.0 * Math.PI; if (LunarEclipseOccurrence(ds, zc, dy, mn, yr).Equals("No lunar eclipse")) return -99.0; - var dj = FullMoon(ds, zc, dy, mn, yr); - var gday = JulianDateDay(dj); - var gmonth = JulianDateMonth(dj); - var gyear = JulianDateYear(dj); - var igday = gday.Floor(); - var xi = gday - igday; - var utfm = xi * 24.0; - var ut = utfm - 1.0; - var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double dj = FullMoon(ds, zc, dy, mn, yr); + double gday = JulianDateDay(dj); + int gmonth = JulianDateMonth(dj); + int gyear = JulianDateYear(dj); + double igday = gday.Floor(); + double xi = gday - igday; + double utfm = xi * 24.0; + double ut = utfm - 1.0; + double ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; - var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + double mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; - var xh = utfm; - var x0 = xh + 1.0 - (2.0 * bz / (bz - by)); - var dm = mz - my; + double xh = utfm; + double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); + double dm = mz - my; if (dm < 0.0) dm = dm + tp; - var lj = (dm - sb) / 2.0; - var q = 0.0; - var mr = my + (dm * (x0 - xh + 1.0) / 2.0); + double lj = (dm - sb) / 2.0; + double q = 0.0; + double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; - var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); + double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; bz = bz - q; - var p3 = 0.00004263; - var zh = (sr - mr) / lj; - var tc = x0 + zh; - var sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; - var s2 = sh * sh; - var z2 = zh * zh; - var ps = p3 / (rr * lj); - var z1 = (zh * z2 / (z2 + s2)) + x0; - var h0 = (hy + hz) / (2.0 * lj); - var rm = 0.272446 * h0; - var rn = 0.00465242 / (lj * rr); - var hd = h0 * 0.99834; - var ru = (hd - rn + ps) * 1.02; - var rp = (hd + rn + ps) * 1.02; - var pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); - var r = rm + rp; - var dd = z1 - x0; + double p3 = 0.00004263; + double zh = (sr - mr) / lj; + double tc = x0 + zh; + double sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; + double s2 = sh * sh; + double z2 = zh * zh; + double ps = p3 / (rr * lj); + double z1 = (zh * z2 / (z2 + s2)) + x0; + double h0 = (hy + hz) / (2.0 * lj); + double rm = 0.272446 * h0; + double rn = 0.00465242 / (lj * rr); + double hd = h0 * 0.99834; + double ru = (hd - rn + ps) * 1.02; + double rp = (hd + rn + ps) * 1.02; + double pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); + double r = rm + rp; + double dd = z1 - x0; dd = dd * dd - ((z2 - (r * r)) * dd / zh); if (dd < 0.0) return -99.0; - var zd = dd.SquareRoot(); - var z6 = z1 - zd; + double zd = dd.SquareRoot(); + double z6 = z1 - zd; r = rm + ru; dd = z1 - x0; @@ -4983,7 +4983,7 @@ public static double UTStartTotalLunarEclipse(double dy, int mn, int yr, int ds, return -99.0; zd = dd.SquareRoot(); - var z8 = z1 - zd; + double z8 = z1 - zd; r = ru - rm; dd = z1 - x0; @@ -4993,7 +4993,7 @@ public static double UTStartTotalLunarEclipse(double dy, int mn, int yr, int ds, return -99.0; zd = dd.SquareRoot(); - var zcc = z1 - zd; + double zcc = z1 - zd; if (zcc < 0.0) zcc = zc + 24.0; @@ -5009,73 +5009,73 @@ public static double UTStartTotalLunarEclipse(double dy, int mn, int yr, int ds, /// public static double UTEndTotalLunarEclipse(double dy, int mn, int yr, int ds, int zc) { - var tp = 2.0 * Math.PI; + double tp = 2.0 * Math.PI; if (LunarEclipseOccurrence(ds, zc, dy, mn, yr).Equals("No lunar eclipse")) return -99.0; - var dj = FullMoon(ds, zc, dy, mn, yr); - var gday = JulianDateDay(dj); - var gmonth = JulianDateMonth(dj); - var gyear = JulianDateYear(dj); - var igday = gday.Floor(); - var xi = gday - igday; - var utfm = xi * 24.0; - var ut = utfm - 1.0; - var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double dj = FullMoon(ds, zc, dy, mn, yr); + double gday = JulianDateDay(dj); + int gmonth = JulianDateMonth(dj); + int gyear = JulianDateYear(dj); + double igday = gday.Floor(); + double xi = gday - igday; + double utfm = xi * 24.0; + double ut = utfm - 1.0; + double ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; - var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + double mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; - var xh = utfm; - var x0 = xh + 1.0 - (2.0 * bz / (bz - by)); - var dm = mz - my; + double xh = utfm; + double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); + double dm = mz - my; if (dm < 0.0) dm = dm + tp; - var lj = (dm - sb) / 2.0; - var q = 0.0; - var mr = my + (dm * (x0 - xh + 1.0) / 2.0); + double lj = (dm - sb) / 2.0; + double q = 0.0; + double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; - var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); + double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; bz = bz - q; - var p3 = 0.00004263; - var zh = (sr - mr) / lj; - var tc = x0 + zh; - var sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; - var s2 = sh * sh; - var z2 = zh * zh; - var ps = p3 / (rr * lj); - var z1 = (zh * z2 / (z2 + s2)) + x0; - var h0 = (hy + hz) / (2.0 * lj); - var rm = 0.272446 * h0; - var rn = 0.00465242 / (lj * rr); - var hd = h0 * 0.99834; - var ru = (hd - rn + ps) * 1.02; - var rp = (hd + rn + ps) * 1.02; - var pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); - var r = rm + rp; - var dd = z1 - x0; + double p3 = 0.00004263; + double zh = (sr - mr) / lj; + double tc = x0 + zh; + double sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; + double s2 = sh * sh; + double z2 = zh * zh; + double ps = p3 / (rr * lj); + double z1 = (zh * z2 / (z2 + s2)) + x0; + double h0 = (hy + hz) / (2.0 * lj); + double rm = 0.272446 * h0; + double rn = 0.00465242 / (lj * rr); + double hd = h0 * 0.99834; + double ru = (hd - rn + ps) * 1.02; + double rp = (hd + rn + ps) * 1.02; + double pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); + double r = rm + rp; + double dd = z1 - x0; dd = dd * dd - ((z2 - (r * r)) * dd / zh); if (dd < 0.0) return -99.0; - var zd = dd.SquareRoot(); - var z6 = z1 - zd; + double zd = dd.SquareRoot(); + double z6 = z1 - zd; r = rm + ru; dd = z1 - x0; @@ -5085,7 +5085,7 @@ public static double UTEndTotalLunarEclipse(double dy, int mn, int yr, int ds, i return -99.0; zd = dd.SquareRoot(); - var z8 = z1 - zd; + double z8 = z1 - zd; r = ru - rm; dd = z1 - x0; @@ -5095,7 +5095,7 @@ public static double UTEndTotalLunarEclipse(double dy, int mn, int yr, int ds, i return -99.0; zd = dd.SquareRoot(); - var zb = z1 + zd - Lint((z1 + zd) / 24.0) * 24.0; + double zb = z1 + zd - Lint((z1 + zd) / 24.0) * 24.0; return zb; } @@ -5108,84 +5108,84 @@ public static double UTEndTotalLunarEclipse(double dy, int mn, int yr, int ds, i /// public static double MagLunarEclipse(double dy, int mn, int yr, int ds, int zc) { - var tp = 2.0 * Math.PI; + double tp = 2.0 * Math.PI; if (LunarEclipseOccurrence(ds, zc, dy, mn, yr).Equals("No lunar eclipse")) return -99.0; - var dj = FullMoon(ds, zc, dy, mn, yr); - var gday = JulianDateDay(dj); - var gmonth = JulianDateMonth(dj); - var gyear = JulianDateYear(dj); - var igday = gday.Floor(); - var xi = gday - igday; - var utfm = xi * 24.0; - var ut = utfm - 1.0; - var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double dj = FullMoon(ds, zc, dy, mn, yr); + double gday = JulianDateDay(dj); + int gmonth = JulianDateMonth(dj); + int gyear = JulianDateYear(dj); + double igday = gday.Floor(); + double xi = gday - igday; + double utfm = xi * 24.0; + double ut = utfm - 1.0; + double ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utfm + 1.0; - var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; - var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + double mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; - var xh = utfm; - var x0 = xh + 1.0 - (2.0 * bz / (bz - by)); - var dm = mz - my; + double xh = utfm; + double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); + double dm = mz - my; if (dm < 0.0) dm = dm + tp; - var lj = (dm - sb) / 2.0; - var q = 0.0; - var mr = my + (dm * (x0 - xh + 1.0) / 2.0); + double lj = (dm - sb) / 2.0; + double q = 0.0; + double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; - var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); + double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; by = by - q; bz = bz - q; - var p3 = 0.00004263; - var zh = (sr - mr) / lj; - var tc = x0 + zh; - var sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; - var s2 = sh * sh; - var z2 = zh * zh; - var ps = p3 / (rr * lj); - var z1 = (zh * z2 / (z2 + s2)) + x0; - var h0 = (hy + hz) / (2.0 * lj); - var rm = 0.272446 * h0; - var rn = 0.00465242 / (lj * rr); - var hd = h0 * 0.99834; - var ru = (hd - rn + ps) * 1.02; - var rp = (hd + rn + ps) * 1.02; - var pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); - var r = rm + rp; - var dd = z1 - x0; + double p3 = 0.00004263; + double zh = (sr - mr) / lj; + double tc = x0 + zh; + double sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; + double s2 = sh * sh; + double z2 = zh * zh; + double ps = p3 / (rr * lj); + double z1 = (zh * z2 / (z2 + s2)) + x0; + double h0 = (hy + hz) / (2.0 * lj); + double rm = 0.272446 * h0; + double rn = 0.00465242 / (lj * rr); + double hd = h0 * 0.99834; + double ru = (hd - rn + ps) * 1.02; + double rp = (hd + rn + ps) * 1.02; + double pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); + double r = rm + rp; + double dd = z1 - x0; dd = dd * dd - ((z2 - (r * r)) * dd / zh); if (dd < 0.0) return -99.0; - var zd = dd.SquareRoot(); - var z6 = z1 - zd; + double zd = dd.SquareRoot(); + double z6 = z1 - zd; r = rm + ru; dd = z1 - x0; dd = dd * dd - ((z2 - (r * r)) * dd / zh); - var mg = (rm + rp - pj) / (2.0 * rm); + double mg = (rm + rp - pj) / (2.0 * rm); if (dd < 0.0) return mg; zd = dd.SquareRoot(); - var z8 = z1 - zd; + double z8 = z1 - zd; r = ru - rm; @@ -5203,29 +5203,29 @@ public static double MagLunarEclipse(double dy, int mn, int yr, int ds, int zc) /// public static string SolarEclipseOccurrence(int ds, int zc, double dy, int mn, int yr) { - var d0 = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var m0 = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var y0 = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + double d0 = LocalCivilTimeGreenwichDay(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int m0 = LocalCivilTimeGreenwichMonth(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); + int y0 = LocalCivilTimeGreenwichYear(12.0, 0.0, 0.0, ds, zc, dy, mn, yr); - var j0 = CivilDateToJulianDate(0.0, 1, y0); - var dj = CivilDateToJulianDate(d0, m0, y0); - var k = (y0 - 1900.0 + ((dj - j0) * 1.0 / 365.0)) * 12.3685; + double j0 = CivilDateToJulianDate(0.0, 1, y0); + double dj = CivilDateToJulianDate(d0, m0, y0); + double k = (y0 - 1900.0 + ((dj - j0) * 1.0 / 365.0)) * 12.3685; k = Lint(k + 0.5); - var tn = k / 1236.85; - var tf = (k + 0.5) / 1236.85; - var t = tn; - var l6855result1 = SolarEclipseOccurrence_L6855(t, k); - var nb = l6855result1.f; + double tn = k / 1236.85; + double tf = (k + 0.5) / 1236.85; + double t = tn; + (double f, double dd, double e1, double b1, double a, double b) l6855result1 = SolarEclipseOccurrence_L6855(t, k); + double nb = l6855result1.f; t = tf; k = k + 0.5; - var l6855result2 = SolarEclipseOccurrence_L6855(t, k); + (double f, double dd, double e1, double b1, double a, double b) l6855result2 = SolarEclipseOccurrence_L6855(t, k); - var df = Math.Abs(nb - 3.141592654 * Lint(nb / 3.141592654)); + double df = Math.Abs(nb - 3.141592654 * Lint(nb / 3.141592654)); if (df > 0.37) df = 3.141592654 - df; - var s = "Solar eclipse certain"; + string s = "Solar eclipse certain"; if (df >= 0.242600766) { s = "Solar eclipse possible"; @@ -5241,18 +5241,18 @@ public static string SolarEclipseOccurrence(int ds, int zc, double dy, int mn, i /// public static (double f, double dd, double e1, double b1, double a, double b) SolarEclipseOccurrence_L6855(double t, double k) { - var t2 = t * t; - var e = 29.53 * k; - var c = 166.56 + (132.87 - 0.009173 * t) * t; + double t2 = t * t; + double e = 29.53 * k; + double c = 166.56 + (132.87 - 0.009173 * t) * t; c = c.ToRadians(); - var b = 0.00058868 * k + (0.0001178 - 0.000000155 * t) * t2; + double b = 0.00058868 * k + (0.0001178 - 0.000000155 * t) * t2; b = b + 0.00033 * c.Sine() + 0.75933; - var a = k / 12.36886; - var a1 = 359.2242 + 360.0 * FPart(a) - (0.0000333 + 0.00000347 * t) * t2; - var a2 = 306.0253 + 360.0 * FPart(k / 0.9330851); + double a = k / 12.36886; + double a1 = 359.2242 + 360.0 * FPart(a) - (0.0000333 + 0.00000347 * t) * t2; + double a2 = 306.0253 + 360.0 * FPart(k / 0.9330851); a2 = a2 + (0.0107306 + 0.00001236 * t) * t2; a = k / 0.9214926; - var f = 21.2964 + 360.0 * FPart(a) - (0.0016528 + 0.00000239 * t) * t2; + double f = 21.2964 + 360.0 * FPart(a) - (0.0016528 + 0.00000239 * t) * t2; a1 = UnwindDeg(a1); a2 = UnwindDeg(a2); f = UnwindDeg(f); @@ -5260,15 +5260,15 @@ public static (double f, double dd, double e1, double b1, double a, double b) So a2 = a2.ToRadians(); f = f.ToRadians(); - var dd = (0.1734 - 0.000393 * t) * a1.Sine() + 0.0021 * (2.0 * a1).Sine(); + double dd = (0.1734 - 0.000393 * t) * a1.Sine() + 0.0021 * (2.0 * a1).Sine(); dd = dd - 0.4068 * a2.Sine() + 0.0161 * (2.0 * a2).Sine() - 0.0004 * (3.0 * a2).Sine(); dd = dd + 0.0104 * (2.0 * f).Sine() - 0.0051 * (a1 + a2).Sine(); dd = dd - 0.0074 * (a1 - a2).Sine() + 0.0004 * (2.0 * f + a1).Sine(); dd = dd - 0.0004 * (2.0 * f - a1).Sine() - 0.0006 * (2.0 * f + a2).Sine() + 0.001 * (2.0 * f - a2).Sine(); dd = dd + 0.0005 * (a1 + 2.0 * a2).Sine(); - var e1 = e.Floor(); + double e1 = e.Floor(); b = b + dd + (e - e1); - var b1 = b.Floor(); + double b1 = b.Floor(); a = e1 + b1; b = b - b1; @@ -5283,92 +5283,92 @@ public static (double f, double dd, double e1, double b1, double a, double b) So /// public static double UTMaxSolarEclipse(double dy, int mn, int yr, int ds, int zc, double glong, double glat) { - var tp = 2.0 * Math.PI; + double tp = 2.0 * Math.PI; if (SolarEclipseOccurrence(ds, zc, dy, mn, yr).Equals("No solar eclipse")) return -99.0; - var dj = NewMoon(ds, zc, dy, mn, yr); - var gday = JulianDateDay(dj); - var gmonth = JulianDateMonth(dj); - var gyear = JulianDateYear(dj); - var igday = gday.Floor(); - var xi = gday - igday; - var utnm = xi * 24.0; - var ut = utnm - 1.0; - var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double dj = NewMoon(ds, zc, dy, mn, yr); + double gday = JulianDateDay(dj); + int gmonth = JulianDateMonth(dj); + int gyear = JulianDateYear(dj); + double igday = gday.Floor(); + double xi = gday - igday; + double utnm = xi * 24.0; + double ut = utnm - 1.0; + double ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utnm + 1.0; - var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; - var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + double mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; - var xh = utnm; - var x = my; - var y = by; - var tm = xh - 1.0; - var hp = hy; - var l7390result1 = UTMaxSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); + double xh = utnm; + double x = my; + double y = by; + double tm = xh - 1.0; + double hp = hy; + (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result1 = UTMaxSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); my = l7390result1.p; by = l7390result1.q; x = mz; y = bz; tm = xh + 1.0; hp = hz; - var l7390result2 = UTMaxSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); + (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result2 = UTMaxSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); mz = l7390result2.p; bz = l7390result2.q; - var x0 = xh + 1.0 - (2.0 * bz / (bz - by)); - var dm = mz - my; + double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); + double dm = mz - my; if (dm < 0.0) dm = dm + tp; - var lj = (dm - sb) / 2.0; - var mr = my + (dm * (x0 - xh + 1.0) / 2.0); + double lj = (dm - sb) / 2.0; + double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; - var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); + double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); x = sr; y = 0.0; tm = ut; hp = 0.00004263452 / rr; - var l7390result3 = UTMaxSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); + (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result3 = UTMaxSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); // let(_paa, _qaa, _xaa, _pbb, _qbb, _xbb, p, q) = sr = l7390result3.p; by = by - l7390result3.q; bz = bz - l7390result3.q; - var p3 = 0.00004263; - var zh = (sr - mr) / lj; - var tc = x0 + zh; - var sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; - var s2 = sh * sh; - var z2 = zh * zh; - var ps = p3 / (rr * lj); - var z1 = (zh * z2 / (z2 + s2)) + x0; - var h0 = (hy + hz) / (2.0 * lj); - var rm = 0.272446 * h0; - var rn = 0.00465242 / (lj * rr); - var hd = h0 * 0.99834; - var _ru = (hd - rn + ps) * 1.02; - var _rp = (hd + rn + ps) * 1.02; - var pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); - var r = rm + rn; - var dd = z1 - x0; + double p3 = 0.00004263; + double zh = (sr - mr) / lj; + double tc = x0 + zh; + double sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; + double s2 = sh * sh; + double z2 = zh * zh; + double ps = p3 / (rr * lj); + double z1 = (zh * z2 / (z2 + s2)) + x0; + double h0 = (hy + hz) / (2.0 * lj); + double rm = 0.272446 * h0; + double rn = 0.00465242 / (lj * rr); + double hd = h0 * 0.99834; + double _ru = (hd - rn + ps) * 1.02; + double _rp = (hd + rn + ps) * 1.02; + double pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); + double r = rm + rn; + double dd = z1 - x0; dd = dd * dd - ((z2 - (r * r)) * dd / zh); if (dd < 0.0) return -99.0; - var zd = dd.SquareRoot(); + double zd = dd.SquareRoot(); return z1; } @@ -5378,14 +5378,14 @@ public static double UTMaxSolarEclipse(double dy, int mn, int yr, int ds, int zc /// public static (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) UTMaxSolarEclipse_L7390(double x, double y, double igday, int gmonth, int gyear, double tm, double glong, double glat, double hp) { - var paa = EcRA(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); - var qaa = EcDec(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); - var xaa = RightAscensionToHourAngle(DecimalDegreesToDegreeHours(paa), 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); - var pbb = ParallaxHA(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); - var qbb = ParallaxDec(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); - var xbb = HourAngleToRightAscension(pbb, 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); - var p = EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); - var q = EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); + double paa = EcRA(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); + double qaa = EcDec(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); + double xaa = RightAscensionToHourAngle(DecimalDegreesToDegreeHours(paa), 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); + double pbb = ParallaxHA(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); + double qbb = ParallaxDec(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); + double xbb = HourAngleToRightAscension(pbb, 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); + double p = EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); + double q = EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); return (paa, qaa, xaa, pbb, qbb, xbb, p, q); } @@ -5398,92 +5398,92 @@ public static (double paa, double qaa, double xaa, double pbb, double qbb, doubl /// public static double UTFirstContactSolarEclipse(double dy, int mn, int yr, int ds, int zc, double glong, double glat) { - var tp = 2.0 * Math.PI; + double tp = 2.0 * Math.PI; if (SolarEclipseOccurrence(ds, zc, dy, mn, yr).Equals("No solar eclipse")) return -99.0; - var dj = NewMoon(ds, zc, dy, mn, yr); - var gday = JulianDateDay(dj); - var gmonth = JulianDateMonth(dj); - var gyear = JulianDateYear(dj); - var igday = gday.Floor(); - var xi = gday - igday; - var utnm = xi * 24.0; - var ut = utnm - 1.0; - var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double dj = NewMoon(ds, zc, dy, mn, yr); + double gday = JulianDateDay(dj); + int gmonth = JulianDateMonth(dj); + int gyear = JulianDateYear(dj); + double igday = gday.Floor(); + double xi = gday - igday; + double utnm = xi * 24.0; + double ut = utnm - 1.0; + double ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utnm + 1.0; - var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; - var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + double mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; - var xh = utnm; - var x = my; - var y = by; - var tm = xh - 1.0; - var hp = hy; - var l7390result1 = UTFirstContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); + double xh = utnm; + double x = my; + double y = by; + double tm = xh - 1.0; + double hp = hy; + (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result1 = UTFirstContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); my = l7390result1.p; by = l7390result1.q; x = mz; y = bz; tm = xh + 1.0; hp = hz; - var l7390result2 = UTFirstContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); + (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result2 = UTFirstContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); mz = l7390result2.p; bz = l7390result2.q; - var x0 = xh + 1.0 - (2.0 * bz / (bz - by)); - var dm = mz - my; + double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); + double dm = mz - my; if (dm < 0.0) dm = dm + tp; - var lj = (dm - sb) / 2.0; - var mr = my + (dm * (x0 - xh + 1.0) / 2.0); + double lj = (dm - sb) / 2.0; + double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; - var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); + double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); x = sr; y = 0.0; tm = ut; hp = 0.00004263452 / rr; - var l7390result3 = UTFirstContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); + (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result3 = UTFirstContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); sr = l7390result3.p; by = by - l7390result3.q; bz = bz - l7390result3.q; - var p3 = 0.00004263; - var zh = (sr - mr) / lj; - var tc = x0 + zh; - var sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; - var s2 = sh * sh; - var z2 = zh * zh; - var ps = p3 / (rr * lj); - var z1 = (zh * z2 / (z2 + s2)) + x0; - var h0 = (hy + hz) / (2.0 * lj); - var rm = 0.272446 * h0; - var rn = 0.00465242 / (lj * rr); - var hd = h0 * 0.99834; - var _ru = (hd - rn + ps) * 1.02; - var _rp = (hd + rn + ps) * 1.02; - var pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); - var r = rm + rn; - var dd = z1 - x0; + double p3 = 0.00004263; + double zh = (sr - mr) / lj; + double tc = x0 + zh; + double sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; + double s2 = sh * sh; + double z2 = zh * zh; + double ps = p3 / (rr * lj); + double z1 = (zh * z2 / (z2 + s2)) + x0; + double h0 = (hy + hz) / (2.0 * lj); + double rm = 0.272446 * h0; + double rn = 0.00465242 / (lj * rr); + double hd = h0 * 0.99834; + double _ru = (hd - rn + ps) * 1.02; + double _rp = (hd + rn + ps) * 1.02; + double pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); + double r = rm + rn; + double dd = z1 - x0; dd = dd * dd - ((z2 - (r * r)) * dd / zh); if (dd < 0.0) return -99.0; - var zd = dd.SquareRoot(); - var z6 = z1 - zd; + double zd = dd.SquareRoot(); + double z6 = z1 - zd; if (z6 < 0.0) z6 = z6 + 24.0; @@ -5496,14 +5496,14 @@ public static double UTFirstContactSolarEclipse(double dy, int mn, int yr, int d /// public static (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) UTFirstContactSolarEclipse_L7390(double x, double y, double igday, int gmonth, int gyear, double tm, double glong, double glat, double hp) { - var paa = EcRA(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); - var qaa = EcDec(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); - var xaa = RightAscensionToHourAngle(DecimalDegreesToDegreeHours(paa), 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); - var pbb = ParallaxHA(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); - var qbb = ParallaxDec(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); - var xbb = HourAngleToRightAscension(pbb, 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); - var p = EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); - var q = EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); + double paa = EcRA(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); + double qaa = EcDec(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); + double xaa = RightAscensionToHourAngle(DecimalDegreesToDegreeHours(paa), 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); + double pbb = ParallaxHA(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); + double qbb = ParallaxDec(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); + double xbb = HourAngleToRightAscension(pbb, 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); + double p = EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); + double q = EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); return (paa, qaa, xaa, pbb, qbb, xbb, p, q); } @@ -5516,92 +5516,92 @@ public static (double paa, double qaa, double xaa, double pbb, double qbb, doubl /// public static double UTLastContactSolarEclipse(double dy, int mn, int yr, int ds, int zc, double glong, double glat) { - var tp = 2.0 * Math.PI; + double tp = 2.0 * Math.PI; if (SolarEclipseOccurrence(ds, zc, dy, mn, yr).Equals("No solar eclipse")) return -99.0; - var dj = NewMoon(ds, zc, dy, mn, yr); - var gday = JulianDateDay(dj); - var gmonth = JulianDateMonth(dj); - var gyear = JulianDateYear(dj); - var igday = gday.Floor(); - var xi = gday - igday; - var utnm = xi * 24.0; - var ut = utnm - 1.0; - var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double dj = NewMoon(ds, zc, dy, mn, yr); + double gday = JulianDateDay(dj); + int gmonth = JulianDateMonth(dj); + int gyear = JulianDateYear(dj); + double igday = gday.Floor(); + double xi = gday - igday; + double utnm = xi * 24.0; + double ut = utnm - 1.0; + double ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utnm + 1.0; - var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; - var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + double mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; - var xh = utnm; - var x = my; - var y = by; - var tm = xh - 1.0; - var hp = hy; - var l7390result1 = UTLastContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); + double xh = utnm; + double x = my; + double y = by; + double tm = xh - 1.0; + double hp = hy; + (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result1 = UTLastContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); my = l7390result1.p; by = l7390result1.q; x = mz; y = bz; tm = xh + 1.0; hp = hz; - var l7390result2 = UTLastContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); + (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result2 = UTLastContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); mz = l7390result2.p; bz = l7390result2.q; - var x0 = xh + 1.0 - (2.0 * bz / (bz - by)); - var dm = mz - my; + double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); + double dm = mz - my; if (dm < 0.0) dm = dm + tp; - var lj = (dm - sb) / 2.0; - var mr = my + (dm * (x0 - xh + 1.0) / 2.0); + double lj = (dm - sb) / 2.0; + double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; - var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); + double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); x = sr; y = 0.0; tm = ut; hp = 0.00004263452 / rr; - var l7390result3 = UTLastContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); + (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result3 = UTLastContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); sr = l7390result3.p; by = by - l7390result3.q; bz = bz - l7390result3.q; - var p3 = 0.00004263; - var zh = (sr - mr) / lj; - var tc = x0 + zh; - var sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; - var s2 = sh * sh; - var z2 = zh * zh; - var ps = p3 / (rr * lj); - var z1 = (zh * z2 / (z2 + s2)) + x0; - var h0 = (hy + hz) / (2.0 * lj); - var rm = 0.272446 * h0; - var rn = 0.00465242 / (lj * rr); - var hd = h0 * 0.99834; - var _ru = (hd - rn + ps) * 1.02; - var _rp = (hd + rn + ps) * 1.02; - var pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); - var r = rm + rn; - var dd = z1 - x0; + double p3 = 0.00004263; + double zh = (sr - mr) / lj; + double tc = x0 + zh; + double sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; + double s2 = sh * sh; + double z2 = zh * zh; + double ps = p3 / (rr * lj); + double z1 = (zh * z2 / (z2 + s2)) + x0; + double h0 = (hy + hz) / (2.0 * lj); + double rm = 0.272446 * h0; + double rn = 0.00465242 / (lj * rr); + double hd = h0 * 0.99834; + double _ru = (hd - rn + ps) * 1.02; + double _rp = (hd + rn + ps) * 1.02; + double pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); + double r = rm + rn; + double dd = z1 - x0; dd = dd * dd - ((z2 - (r * r)) * dd / zh); if (dd < 0.0) return -99.0; - var zd = dd.SquareRoot(); - var z7 = z1 + zd - Lint((z1 + zd) / 24.0) * 24.0; + double zd = dd.SquareRoot(); + double z7 = z1 + zd - Lint((z1 + zd) / 24.0) * 24.0; return z7; } @@ -5611,14 +5611,14 @@ public static double UTLastContactSolarEclipse(double dy, int mn, int yr, int ds /// public static (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) UTLastContactSolarEclipse_L7390(double x, double y, double igday, int gmonth, int gyear, double tm, double glong, double glat, double hp) { - var paa = EcRA(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); - var qaa = EcDec(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); - var xaa = RightAscensionToHourAngle(DecimalDegreesToDegreeHours(paa), 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); - var pbb = ParallaxHA(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); - var qbb = ParallaxDec(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); - var xbb = HourAngleToRightAscension(pbb, 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); - var p = EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); - var q = EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); + double paa = EcRA(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); + double qaa = EcDec(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); + double xaa = RightAscensionToHourAngle(DecimalDegreesToDegreeHours(paa), 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); + double pbb = ParallaxHA(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); + double qbb = ParallaxDec(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); + double xbb = HourAngleToRightAscension(pbb, 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); + double p = EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); + double q = EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); return (paa, qaa, xaa, pbb, qbb, xbb, p, q); } @@ -5631,93 +5631,93 @@ public static (double paa, double qaa, double xaa, double pbb, double qbb, doubl /// public static double MagSolarEclipse(double dy, int mn, int yr, int ds, int zc, double glong, double glat) { - var tp = 2.0 * Math.PI; + double tp = 2.0 * Math.PI; if (SolarEclipseOccurrence(ds, zc, dy, mn, yr).Equals("No solar eclipse")) return -99.0; - var dj = NewMoon(ds, zc, dy, mn, yr); - var gday = JulianDateDay(dj); - var gmonth = JulianDateMonth(dj); - var gyear = JulianDateYear(dj); - var igday = gday.Floor(); - var xi = gday - igday; - var utnm = xi * 24.0; - var ut = utnm - 1.0; - var ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double dj = NewMoon(ds, zc, dy, mn, yr); + double gday = JulianDateDay(dj); + int gmonth = JulianDateMonth(dj); + int gyear = JulianDateYear(dj); + double igday = gday.Floor(); + double xi = gday - igday; + double utnm = xi * 24.0; + double ut = utnm - 1.0; + double ly = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double my = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double by = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hy = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); ut = utnm + 1.0; - var sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; - var mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - var hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double sb = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians() - ly; + double mz = MoonLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double bz = MoonLat(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) sb = sb + tp; - var xh = utnm; - var x = my; - var y = by; - var tm = xh - 1.0; - var hp = hy; - var l7390result1 = MagSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); + double xh = utnm; + double x = my; + double y = by; + double tm = xh - 1.0; + double hp = hy; + (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result1 = MagSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); my = l7390result1.p; by = l7390result1.q; x = mz; y = bz; tm = xh + 1.0; hp = hz; - var l7390result2 = MagSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); + (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result2 = MagSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); mz = l7390result2.p; bz = l7390result2.q; - var x0 = xh + 1.0 - (2.0 * bz / (bz - by)); - var dm = mz - my; + double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); + double dm = mz - my; if (dm < 0.0) dm = dm + tp; - var lj = (dm - sb) / 2.0; - var mr = my + (dm * (x0 - xh + 1.0) / 2.0); + double lj = (dm - sb) / 2.0; + double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; - var rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); - var sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); + double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); + double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); x = sr; y = 0.0; tm = ut; hp = 0.00004263452 / rr; - var l7390result3 = MagSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); + (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result3 = MagSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); sr = l7390result3.p; by = by - l7390result3.q; bz = bz - l7390result3.q; - var p3 = 0.00004263; - var zh = (sr - mr) / lj; - var tc = x0 + zh; - var sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; - var s2 = sh * sh; - var z2 = zh * zh; - var ps = p3 / (rr * lj); - var z1 = (zh * z2 / (z2 + s2)) + x0; - var h0 = (hy + hz) / (2.0 * lj); - var rm = 0.272446 * h0; - var rn = 0.00465242 / (lj * rr); - var hd = h0 * 0.99834; - var _ru = (hd - rn + ps) * 1.02; - var _rp = (hd + rn + ps) * 1.02; - var pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); - var r = rm + rn; - var dd = z1 - x0; + double p3 = 0.00004263; + double zh = (sr - mr) / lj; + double tc = x0 + zh; + double sh = (((bz - by) * (tc - xh - 1.0) / 2.0) + bz) / lj; + double s2 = sh * sh; + double z2 = zh * zh; + double ps = p3 / (rr * lj); + double z1 = (zh * z2 / (z2 + s2)) + x0; + double h0 = (hy + hz) / (2.0 * lj); + double rm = 0.272446 * h0; + double rn = 0.00465242 / (lj * rr); + double hd = h0 * 0.99834; + double _ru = (hd - rn + ps) * 1.02; + double _rp = (hd + rn + ps) * 1.02; + double pj = Math.Abs(sh * zh / (s2 + z2).SquareRoot()); + double r = rm + rn; + double dd = z1 - x0; dd = dd * dd - ((z2 - (r * r)) * dd / zh); if (dd < 0.0) return -99.0; - var zd = dd.SquareRoot(); + double zd = dd.SquareRoot(); - var mg = (rm + rn - pj) / (2.0 * rn); + double mg = (rm + rn - pj) / (2.0 * rn); return mg; } @@ -5727,14 +5727,14 @@ public static double MagSolarEclipse(double dy, int mn, int yr, int ds, int zc, /// public static (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) MagSolarEclipse_L7390(double x, double y, double igday, int gmonth, int gyear, double tm, double glong, double glat, double hp) { - var paa = EcRA(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); - var qaa = EcDec(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); - var xaa = RightAscensionToHourAngle(DecimalDegreesToDegreeHours(paa), 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); - var pbb = ParallaxHA(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); - var qbb = ParallaxDec(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); - var xbb = HourAngleToRightAscension(pbb, 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); - var p = EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); - var q = EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); + double paa = EcRA(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); + double qaa = EcDec(Degrees(x), 0.0, 0.0, Degrees(y), 0.0, 0.0, igday, gmonth, gyear); + double xaa = RightAscensionToHourAngle(DecimalDegreesToDegreeHours(paa), 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); + double pbb = ParallaxHA(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); + double qbb = ParallaxDec(xaa, 0.0, 0.0, qaa, 0.0, 0.0, PACoordinateType.True, glat, 0.0, Degrees(hp)); + double xbb = HourAngleToRightAscension(pbb, 0.0, 0.0, tm, 0.0, 0.0, 0, 0, igday, gmonth, gyear, glong); + double p = EQELong(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); + double q = EQELat(xbb, 0.0, 0.0, qbb, 0.0, 0.0, igday, gmonth, gyear).ToRadians(); return (paa, qaa, xaa, pbb, qbb, xbb, p, q); } diff --git a/PALib/PAMoon.cs b/PALib/PAMoon.cs index 09bc73b..fa5ceea 100644 --- a/PALib/PAMoon.cs +++ b/PALib/PAMoon.cs @@ -21,48 +21,48 @@ public class PAMoon /// public (double moonRAHour, double moonRAMin, double moonRASec, double moonDecDeg, double moonDecMin, double moonDecSec) ApproximatePositionOfMoon(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear) { - var daylightSaving = isDaylightSaving ? 1 : 0; - - var l0 = 91.9293359879052; - var p0 = 130.143076320618; - var n0 = 291.682546643194; - var i = 5.145396; - - var gdateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var gdateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var gdateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - - var utHours = PAMacros.LocalCivilTimeToUniversalTime(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var dDays = PAMacros.CivilDateToJulianDate(gdateDay, gdateMonth, gdateYear) - PAMacros.CivilDateToJulianDate(0.0, 1, 2010) + utHours / 24; - var sunLongDeg = PAMacros.SunLong(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var sunMeanAnomalyRad = PAMacros.SunMeanAnomaly(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var lmDeg = PAMacros.UnwindDeg(13.1763966 * dDays + l0); - var mmDeg = PAMacros.UnwindDeg(lmDeg - 0.1114041 * dDays - p0); - var nDeg = PAMacros.UnwindDeg(n0 - (0.0529539 * dDays)); - var evDeg = 1.2739 * (2.0 * (lmDeg - sunLongDeg) - mmDeg).ToRadians().Sine(); - var aeDeg = 0.1858 * sunMeanAnomalyRad.Sine(); - var a3Deg = 0.37 * sunMeanAnomalyRad.Sine(); - var mmdDeg = mmDeg + evDeg - aeDeg - a3Deg; - var ecDeg = 6.2886 * mmdDeg.ToRadians().Sine(); - var a4Deg = 0.214 * (2.0 * mmdDeg.ToRadians()).Sine(); - var ldDeg = lmDeg + evDeg + ecDeg - aeDeg + a4Deg; - var vDeg = 0.6583 * (2.0 * (ldDeg - sunLongDeg).ToRadians()).Sine(); - var lddDeg = ldDeg + vDeg; - var ndDeg = nDeg - 0.16 * sunMeanAnomalyRad.Sine(); - var y = (lddDeg - ndDeg).ToRadians().Sine() * i.ToRadians().Cosine(); - var x = (lddDeg - ndDeg).ToRadians().Cosine(); - - var moonLongDeg = PAMacros.UnwindDeg(PAMacros.Degrees(y.AngleTangent2(x)) + ndDeg); - var moonLatDeg = PAMacros.Degrees(((lddDeg - ndDeg).ToRadians().Sine() * i.ToRadians().Sine()).ASine()); - var moonRAHours1 = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(moonLongDeg, 0, 0, moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear)); - var moonDecDeg1 = PAMacros.EcDec(moonLongDeg, 0, 0, moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear); - - var moonRAHour = PAMacros.DecimalHoursHour(moonRAHours1); - var moonRAMin = PAMacros.DecimalHoursMinute(moonRAHours1); - var moonRASec = PAMacros.DecimalHoursSecond(moonRAHours1); - var moonDecDeg = PAMacros.DecimalDegreesDegrees(moonDecDeg1); - var moonDecMin = PAMacros.DecimalDegreesMinutes(moonDecDeg1); - var moonDecSec = PAMacros.DecimalDegreesSeconds(moonDecDeg1); + int daylightSaving = isDaylightSaving ? 1 : 0; + + double l0 = 91.9293359879052; + double p0 = 130.143076320618; + double n0 = 291.682546643194; + double i = 5.145396; + + double gdateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int gdateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int gdateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + + double utHours = PAMacros.LocalCivilTimeToUniversalTime(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double dDays = PAMacros.CivilDateToJulianDate(gdateDay, gdateMonth, gdateYear) - PAMacros.CivilDateToJulianDate(0.0, 1, 2010) + utHours / 24; + double sunLongDeg = PAMacros.SunLong(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double sunMeanAnomalyRad = PAMacros.SunMeanAnomaly(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double lmDeg = PAMacros.UnwindDeg(13.1763966 * dDays + l0); + double mmDeg = PAMacros.UnwindDeg(lmDeg - 0.1114041 * dDays - p0); + double nDeg = PAMacros.UnwindDeg(n0 - (0.0529539 * dDays)); + double evDeg = 1.2739 * (2.0 * (lmDeg - sunLongDeg) - mmDeg).ToRadians().Sine(); + double aeDeg = 0.1858 * sunMeanAnomalyRad.Sine(); + double a3Deg = 0.37 * sunMeanAnomalyRad.Sine(); + double mmdDeg = mmDeg + evDeg - aeDeg - a3Deg; + double ecDeg = 6.2886 * mmdDeg.ToRadians().Sine(); + double a4Deg = 0.214 * (2.0 * mmdDeg.ToRadians()).Sine(); + double ldDeg = lmDeg + evDeg + ecDeg - aeDeg + a4Deg; + double vDeg = 0.6583 * (2.0 * (ldDeg - sunLongDeg).ToRadians()).Sine(); + double lddDeg = ldDeg + vDeg; + double ndDeg = nDeg - 0.16 * sunMeanAnomalyRad.Sine(); + double y = (lddDeg - ndDeg).ToRadians().Sine() * i.ToRadians().Cosine(); + double x = (lddDeg - ndDeg).ToRadians().Cosine(); + + double moonLongDeg = PAMacros.UnwindDeg(PAMacros.Degrees(y.AngleTangent2(x)) + ndDeg); + double moonLatDeg = PAMacros.Degrees(((lddDeg - ndDeg).ToRadians().Sine() * i.ToRadians().Sine()).ASine()); + double moonRAHours1 = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(moonLongDeg, 0, 0, moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear)); + double moonDecDeg1 = PAMacros.EcDec(moonLongDeg, 0, 0, moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear); + + int moonRAHour = PAMacros.DecimalHoursHour(moonRAHours1); + int moonRAMin = PAMacros.DecimalHoursMinute(moonRAHours1); + double moonRASec = PAMacros.DecimalHoursSecond(moonRAHours1); + double moonDecDeg = PAMacros.DecimalDegreesDegrees(moonDecDeg1); + double moonDecMin = PAMacros.DecimalDegreesMinutes(moonDecDeg1); + double moonDecSec = PAMacros.DecimalDegreesSeconds(moonDecDeg1); return (moonRAHour, moonRAMin, moonRASec, moonDecDeg, moonDecMin, moonDecSec); } @@ -82,28 +82,28 @@ public class PAMoon /// public (double moonRAHour, double moonRAMin, double moonRASec, double moonDecDeg, double moonDecMin, double moonDecSec, double earthMoonDistKM, double moonHorParallaxDeg) PrecisePositionOfMoon(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear) { - var daylightSaving = isDaylightSaving ? 1 : 0; + int daylightSaving = isDaylightSaving ? 1 : 0; - var gdateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var gdateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var gdateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double gdateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int gdateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int gdateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var moonResult = PAMacros.MoonLongLatHP(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + (double moonLongDeg, double moonLatDeg, double moonHorPara) moonResult = PAMacros.MoonLongLatHP(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var nutationInLongitudeDeg = PAMacros.NutatLong(gdateDay, gdateMonth, gdateYear); - var correctedLongDeg = moonResult.moonLongDeg + nutationInLongitudeDeg; - var earthMoonDistanceKM = 6378.14 / moonResult.moonHorPara.ToRadians().Sine(); - var moonRAHours1 = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(correctedLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear)); - var moonDecDeg1 = PAMacros.EcDec(correctedLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear); + double nutationInLongitudeDeg = PAMacros.NutatLong(gdateDay, gdateMonth, gdateYear); + double correctedLongDeg = moonResult.moonLongDeg + nutationInLongitudeDeg; + double earthMoonDistanceKM = 6378.14 / moonResult.moonHorPara.ToRadians().Sine(); + double moonRAHours1 = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(correctedLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear)); + double moonDecDeg1 = PAMacros.EcDec(correctedLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear); - var moonRAHour = PAMacros.DecimalHoursHour(moonRAHours1); - var moonRAMin = PAMacros.DecimalHoursMinute(moonRAHours1); - var moonRASec = PAMacros.DecimalHoursSecond(moonRAHours1); - var moonDecDeg = PAMacros.DecimalDegreesDegrees(moonDecDeg1); - var moonDecMin = PAMacros.DecimalDegreesMinutes(moonDecDeg1); - var moonDecSec = PAMacros.DecimalDegreesSeconds(moonDecDeg1); - var earthMoonDistKM = Math.Round(earthMoonDistanceKM, 0); - var moonHorParallaxDeg = Math.Round(moonResult.moonHorPara, 6); + int moonRAHour = PAMacros.DecimalHoursHour(moonRAHours1); + int moonRAMin = PAMacros.DecimalHoursMinute(moonRAHours1); + double moonRASec = PAMacros.DecimalHoursSecond(moonRAHours1); + double moonDecDeg = PAMacros.DecimalDegreesDegrees(moonDecDeg1); + double moonDecMin = PAMacros.DecimalDegreesMinutes(moonDecDeg1); + double moonDecSec = PAMacros.DecimalDegreesSeconds(moonDecDeg1); + double earthMoonDistKM = Math.Round(earthMoonDistanceKM, 0); + double moonHorParallaxDeg = Math.Round(moonResult.moonHorPara, 6); return (moonRAHour, moonRAMin, moonRASec, moonDecDeg, moonDecMin, moonDecSec, earthMoonDistKM, moonHorParallaxDeg); } @@ -117,30 +117,30 @@ public class PAMoon /// public (double moonPhase, double paBrightLimbDeg) MoonPhase(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear, PAAccuracyLevel accuracyLevel) { - var daylightSaving = isDaylightSaving ? 1 : 0; + int daylightSaving = isDaylightSaving ? 1 : 0; - var gdateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var gdateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var gdateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double gdateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int gdateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int gdateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var sunLongDeg = PAMacros.SunLong(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var moonResult = PAMacros.MoonLongLatHP(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var dRad = (moonResult.moonLongDeg - sunLongDeg).ToRadians(); + double sunLongDeg = PAMacros.SunLong(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + (double moonLongDeg, double moonLatDeg, double moonHorPara) moonResult = PAMacros.MoonLongLatHP(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double dRad = (moonResult.moonLongDeg - sunLongDeg).ToRadians(); - var moonPhase1 = (accuracyLevel == PAAccuracyLevel.Precise) ? PAMacros.MoonPhase(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear) : (1.0 - dRad.Cosine()) / 2.0; + double moonPhase1 = (accuracyLevel == PAAccuracyLevel.Precise) ? PAMacros.MoonPhase(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear) : (1.0 - dRad.Cosine()) / 2.0; - var sunRARad = PAMacros.EcRA(sunLongDeg, 0, 0, 0, 0, 0, gdateDay, gdateMonth, gdateYear).ToRadians(); - var moonRARad = PAMacros.EcRA(moonResult.moonLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear).ToRadians(); - var sunDecRad = PAMacros.EcDec(sunLongDeg, 0, 0, 0, 0, 0, gdateDay, gdateMonth, gdateYear).ToRadians(); - var moonDecRad = PAMacros.EcDec(moonResult.moonLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear).ToRadians(); + double sunRARad = PAMacros.EcRA(sunLongDeg, 0, 0, 0, 0, 0, gdateDay, gdateMonth, gdateYear).ToRadians(); + double moonRARad = PAMacros.EcRA(moonResult.moonLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear).ToRadians(); + double sunDecRad = PAMacros.EcDec(sunLongDeg, 0, 0, 0, 0, 0, gdateDay, gdateMonth, gdateYear).ToRadians(); + double moonDecRad = PAMacros.EcDec(moonResult.moonLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear).ToRadians(); - var y = sunDecRad.Cosine() * (sunRARad - moonRARad).Sine(); - var x = moonDecRad.Cosine() * sunDecRad.Sine() - moonDecRad.Sine() * sunDecRad.Cosine() * (sunRARad - moonRARad).Cosine(); + double y = sunDecRad.Cosine() * (sunRARad - moonRARad).Sine(); + double x = moonDecRad.Cosine() * sunDecRad.Sine() - moonDecRad.Sine() * sunDecRad.Cosine() * (sunRARad - moonRARad).Cosine(); - var chiDeg = PAMacros.Degrees(y.AngleTangent2(x)); + double chiDeg = PAMacros.Degrees(y.AngleTangent2(x)); - var moonPhase = Math.Round(moonPhase1, 2); - var paBrightLimbDeg = Math.Round(chiDeg, 2); + double moonPhase = Math.Round(moonPhase1, 2); + double paBrightLimbDeg = Math.Round(chiDeg, 2); return (moonPhase, paBrightLimbDeg); } @@ -162,36 +162,36 @@ public class PAMoon /// public (double nmLocalTimeHour, double nmLocalTimeMin, double nmLocalDateDay, int nmLocalDateMonth, int nmLocalDateYear, double fmLocalTimeHour, double fmLocalTimeMin, double fmLocalDateDay, int fmLocalDateMonth, int fmLocalDateYear) TimesOfNewMoonAndFullMoon(bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear) { - var daylightSaving = isDaylightSaving ? 1 : 0; - - var jdOfNewMoonDays = PAMacros.NewMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var jdOfFullMoonDays = PAMacros.FullMoon(3, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - - var gDateOfNewMoonDay = PAMacros.JulianDateDay(jdOfNewMoonDays); - var integerDay1 = gDateOfNewMoonDay.Floor(); - var gDateOfNewMoonMonth = PAMacros.JulianDateMonth(jdOfNewMoonDays); - var gDateOfNewMoonYear = PAMacros.JulianDateYear(jdOfNewMoonDays); - - var gDateOfFullMoonDay = PAMacros.JulianDateDay(jdOfFullMoonDays); - var integerDay2 = gDateOfFullMoonDay.Floor(); - var gDateOfFullMoonMonth = PAMacros.JulianDateMonth(jdOfFullMoonDays); - var gDateOfFullMoonYear = PAMacros.JulianDateYear(jdOfFullMoonDays); - - var utOfNewMoonHours = 24.0 * (gDateOfNewMoonDay - integerDay1); - var utOfFullMoonHours = 24.0 * (gDateOfFullMoonDay - integerDay2); - var lctOfNewMoonHours = PAMacros.UniversalTimeToLocalCivilTime(utOfNewMoonHours + 0.008333, 0, 0, daylightSaving, zoneCorrectionHours, integerDay1, gDateOfNewMoonMonth, gDateOfNewMoonYear); - var lctOfFullMoonHours = PAMacros.UniversalTimeToLocalCivilTime(utOfFullMoonHours + 0.008333, 0, 0, daylightSaving, zoneCorrectionHours, integerDay2, gDateOfFullMoonMonth, gDateOfFullMoonYear); - - var nmLocalTimeHour = PAMacros.DecimalHoursHour(lctOfNewMoonHours); - var nmLocalTimeMin = PAMacros.DecimalHoursMinute(lctOfNewMoonHours); - var nmLocalDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfNewMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay1, gDateOfNewMoonMonth, gDateOfNewMoonYear); - var nmLocalDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfNewMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay1, gDateOfNewMoonMonth, gDateOfNewMoonYear); - var nmLocalDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfNewMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay1, gDateOfNewMoonMonth, gDateOfNewMoonYear); - var fmLocalTimeHour = PAMacros.DecimalHoursHour(lctOfFullMoonHours); - var fmLocalTimeMin = PAMacros.DecimalHoursMinute(lctOfFullMoonHours); - var fmLocalDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfFullMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay2, gDateOfFullMoonMonth, gDateOfFullMoonYear); - var fmLocalDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfFullMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay2, gDateOfFullMoonMonth, gDateOfFullMoonYear); - var fmLocalDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfFullMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay2, gDateOfFullMoonMonth, gDateOfFullMoonYear); + int daylightSaving = isDaylightSaving ? 1 : 0; + + double jdOfNewMoonDays = PAMacros.NewMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double jdOfFullMoonDays = PAMacros.FullMoon(3, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + + double gDateOfNewMoonDay = PAMacros.JulianDateDay(jdOfNewMoonDays); + double integerDay1 = gDateOfNewMoonDay.Floor(); + int gDateOfNewMoonMonth = PAMacros.JulianDateMonth(jdOfNewMoonDays); + int gDateOfNewMoonYear = PAMacros.JulianDateYear(jdOfNewMoonDays); + + double gDateOfFullMoonDay = PAMacros.JulianDateDay(jdOfFullMoonDays); + double integerDay2 = gDateOfFullMoonDay.Floor(); + int gDateOfFullMoonMonth = PAMacros.JulianDateMonth(jdOfFullMoonDays); + int gDateOfFullMoonYear = PAMacros.JulianDateYear(jdOfFullMoonDays); + + double utOfNewMoonHours = 24.0 * (gDateOfNewMoonDay - integerDay1); + double utOfFullMoonHours = 24.0 * (gDateOfFullMoonDay - integerDay2); + double lctOfNewMoonHours = PAMacros.UniversalTimeToLocalCivilTime(utOfNewMoonHours + 0.008333, 0, 0, daylightSaving, zoneCorrectionHours, integerDay1, gDateOfNewMoonMonth, gDateOfNewMoonYear); + double lctOfFullMoonHours = PAMacros.UniversalTimeToLocalCivilTime(utOfFullMoonHours + 0.008333, 0, 0, daylightSaving, zoneCorrectionHours, integerDay2, gDateOfFullMoonMonth, gDateOfFullMoonYear); + + int nmLocalTimeHour = PAMacros.DecimalHoursHour(lctOfNewMoonHours); + int nmLocalTimeMin = PAMacros.DecimalHoursMinute(lctOfNewMoonHours); + double nmLocalDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfNewMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay1, gDateOfNewMoonMonth, gDateOfNewMoonYear); + int nmLocalDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfNewMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay1, gDateOfNewMoonMonth, gDateOfNewMoonYear); + int nmLocalDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfNewMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay1, gDateOfNewMoonMonth, gDateOfNewMoonYear); + int fmLocalTimeHour = PAMacros.DecimalHoursHour(lctOfFullMoonHours); + int fmLocalTimeMin = PAMacros.DecimalHoursMinute(lctOfFullMoonHours); + double fmLocalDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfFullMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay2, gDateOfFullMoonMonth, gDateOfFullMoonYear); + int fmLocalDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfFullMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay2, gDateOfFullMoonMonth, gDateOfFullMoonYear); + int fmLocalDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfFullMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay2, gDateOfFullMoonMonth, gDateOfFullMoonYear); return (nmLocalTimeHour, nmLocalTimeMin, nmLocalDateDay, nmLocalDateMonth, nmLocalDateYear, fmLocalTimeHour, fmLocalTimeMin, fmLocalDateDay, fmLocalDateMonth, fmLocalDateYear); } @@ -209,18 +209,18 @@ public class PAMoon /// public (double earthMoonDist, double angDiameterDeg, double angDiameterMin, double horParallaxDeg, double horParallaxMin, double horParallaxSec) MoonDistAngDiamHorParallax(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear) { - var daylightSaving = isDaylightSaving ? 1 : 0; + int daylightSaving = isDaylightSaving ? 1 : 0; - var moonDistance = PAMacros.MoonDist(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var moonAngularDiameter = PAMacros.MoonSize(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var moonHorizontalParallax = PAMacros.MoonHP(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double moonDistance = PAMacros.MoonDist(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double moonAngularDiameter = PAMacros.MoonSize(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double moonHorizontalParallax = PAMacros.MoonHP(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var earthMoonDist = Math.Round(moonDistance, 0); - var angDiameterDeg = PAMacros.DecimalDegreesDegrees(moonAngularDiameter + 0.008333); - var angDiameterMin = PAMacros.DecimalDegreesMinutes(moonAngularDiameter + 0.008333); - var horParallaxDeg = PAMacros.DecimalDegreesDegrees(moonHorizontalParallax); - var horParallaxMin = PAMacros.DecimalDegreesMinutes(moonHorizontalParallax); - var horParallaxSec = PAMacros.DecimalDegreesSeconds(moonHorizontalParallax); + double earthMoonDist = Math.Round(moonDistance, 0); + double angDiameterDeg = PAMacros.DecimalDegreesDegrees(moonAngularDiameter + 0.008333); + double angDiameterMin = PAMacros.DecimalDegreesMinutes(moonAngularDiameter + 0.008333); + double horParallaxDeg = PAMacros.DecimalDegreesDegrees(moonHorizontalParallax); + double horParallaxMin = PAMacros.DecimalDegreesMinutes(moonHorizontalParallax); + double horParallaxSec = PAMacros.DecimalDegreesSeconds(moonHorizontalParallax); return (earthMoonDist, angDiameterDeg, angDiameterMin, horParallaxDeg, horParallaxMin, horParallaxSec); } @@ -244,28 +244,28 @@ public class PAMoon /// public (double mrLTHour, double mrLTMin, double mrLocalDateDay, int mrLocalDateMonth, int mrLocalDateYear, double mrAzimuthDeg, double msLTHour, double msLTMin, double msLocalDateDay, int msLocalDateMonth, int msLocalDateYear, double msAzimuthDeg) MoonriseAndMoonset(double localDateDay, int localDateMonth, int localDateYear, bool isDaylightSaving, int zoneCorrectionHours, double geogLongDeg, double geogLatDeg) { - var daylightSaving = isDaylightSaving ? 1 : 0; - - var localTimeOfMoonriseHours = PAMacros.MoonRiseLCT(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); - var moonRiseLCResult = PAMacros.MoonRiseLcDMY(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); - var localAzimuthDeg1 = PAMacros.MoonRiseAz(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); - - var localTimeOfMoonsetHours = PAMacros.MoonSetLCT(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); - var moonSetLCResult = PAMacros.MoonSetLcDMY(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); - var localAzimuthDeg2 = PAMacros.MoonSetAz(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); - - var mrLTHour = PAMacros.DecimalHoursHour(localTimeOfMoonriseHours + 0.008333); - var mrLTMin = PAMacros.DecimalHoursMinute(localTimeOfMoonriseHours + 0.008333); - var mrLocalDateDay = moonRiseLCResult.dy1; - var mrLocalDateMonth = moonRiseLCResult.mn1; - var mrLocalDateYear = moonRiseLCResult.yr1; - var mrAzimuthDeg = Math.Round(localAzimuthDeg1, 2); - var msLTHour = PAMacros.DecimalHoursHour(localTimeOfMoonsetHours + 0.008333); - var msLTMin = PAMacros.DecimalHoursMinute(localTimeOfMoonsetHours + 0.008333); - var msLocalDateDay = moonSetLCResult.dy1; - var msLocalDateMonth = moonSetLCResult.mn1; - var msLocalDateYear = moonSetLCResult.yr1; - var msAzimuthDeg = Math.Round(localAzimuthDeg2, 2); + int daylightSaving = isDaylightSaving ? 1 : 0; + + double localTimeOfMoonriseHours = PAMacros.MoonRiseLCT(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); + (double dy1, int mn1, int yr1) moonRiseLCResult = PAMacros.MoonRiseLcDMY(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); + double localAzimuthDeg1 = PAMacros.MoonRiseAz(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); + + double localTimeOfMoonsetHours = PAMacros.MoonSetLCT(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); + (double dy1, int mn1, int yr1) moonSetLCResult = PAMacros.MoonSetLcDMY(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); + double localAzimuthDeg2 = PAMacros.MoonSetAz(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongDeg, geogLatDeg); + + int mrLTHour = PAMacros.DecimalHoursHour(localTimeOfMoonriseHours + 0.008333); + int mrLTMin = PAMacros.DecimalHoursMinute(localTimeOfMoonriseHours + 0.008333); + double mrLocalDateDay = moonRiseLCResult.dy1; + int mrLocalDateMonth = moonRiseLCResult.mn1; + int mrLocalDateYear = moonRiseLCResult.yr1; + double mrAzimuthDeg = Math.Round(localAzimuthDeg1, 2); + int msLTHour = PAMacros.DecimalHoursHour(localTimeOfMoonsetHours + 0.008333); + int msLTMin = PAMacros.DecimalHoursMinute(localTimeOfMoonsetHours + 0.008333); + double msLocalDateDay = moonSetLCResult.dy1; + int msLocalDateMonth = moonSetLCResult.mn1; + int msLocalDateYear = moonSetLCResult.yr1; + double msAzimuthDeg = Math.Round(localAzimuthDeg2, 2); return (mrLTHour, mrLTMin, mrLocalDateDay, mrLocalDateMonth, mrLocalDateYear, mrAzimuthDeg, msLTHour, msLTMin, msLocalDateDay, msLocalDateMonth, msLocalDateYear, msAzimuthDeg); } diff --git a/PALib/PAPlanet.cs b/PALib/PAPlanet.cs index b13e02e..1c078c9 100644 --- a/PALib/PAPlanet.cs +++ b/PALib/PAPlanet.cs @@ -14,55 +14,55 @@ public class PAPlanet /// public (double planetRAHour, double planetRAMin, double planetRASec, double planetDecDeg, double planetDecMin, double planetDecSec) ApproximatePositionOfPlanet(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear, string planetName) { - var daylightSaving = isDaylightSaving ? 1 : 0; - - var planetInfo = PlanetInfo.GetPlanetInfo(planetName); - - var gdateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var gdateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var gdateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - - var utHours = PAMacros.LocalCivilTimeToUniversalTime(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var dDays = PAMacros.CivilDateToJulianDate(gdateDay + (utHours / 24), gdateMonth, gdateYear) - PAMacros.CivilDateToJulianDate(0, 1, 2010); - var npDeg1 = 360 * dDays / (365.242191 * planetInfo.tp_PeriodOrbit); - var npDeg2 = npDeg1 - 360 * (npDeg1 / 360).Floor(); - var mpDeg = npDeg2 + planetInfo.long_LongitudeEpoch - planetInfo.peri_LongitudePerihelion; - var lpDeg1 = npDeg2 + (360 * planetInfo.ecc_EccentricityOrbit * mpDeg.ToRadians().Sine() / Math.PI) + planetInfo.long_LongitudeEpoch; - var lpDeg2 = lpDeg1 - 360 * (lpDeg1 / 360).Floor(); - var planetTrueAnomalyDeg = lpDeg2 - planetInfo.peri_LongitudePerihelion; - var rAU = planetInfo.axis_AxisOrbit * (1 - Math.Pow(planetInfo.ecc_EccentricityOrbit, 2)) / (1 + planetInfo.ecc_EccentricityOrbit * planetTrueAnomalyDeg.ToRadians().Cosine()); - - var earthInfo = PlanetInfo.GetPlanetInfo("Earth"); - - var neDeg1 = 360 * dDays / (365.242191 * earthInfo.tp_PeriodOrbit); - var neDeg2 = neDeg1 - 360 * (neDeg1 / 360).Floor(); - var meDeg = neDeg2 + earthInfo.long_LongitudeEpoch - earthInfo.peri_LongitudePerihelion; - var leDeg1 = neDeg2 + earthInfo.long_LongitudeEpoch + 360 * earthInfo.ecc_EccentricityOrbit * meDeg.ToRadians().Sine() / Math.PI; - var leDeg2 = leDeg1 - 360 * (leDeg1 / 360).Floor(); - var earthTrueAnomalyDeg = leDeg2 - earthInfo.peri_LongitudePerihelion; - var rAU2 = earthInfo.axis_AxisOrbit * (1 - Math.Pow(earthInfo.ecc_EccentricityOrbit, 2)) / (1 + earthInfo.ecc_EccentricityOrbit * earthTrueAnomalyDeg.ToRadians().Cosine()); - var lpNodeRad = (lpDeg2 - planetInfo.node_LongitudeAscendingNode).ToRadians(); - var psiRad = (lpNodeRad.Sine() * planetInfo.incl_OrbitalInclination.ToRadians().Sine()).ASine(); - var y = lpNodeRad.Sine() * planetInfo.incl_OrbitalInclination.ToRadians().Cosine(); - var x = lpNodeRad.Cosine(); - var ldDeg = PAMacros.Degrees(y.AngleTangent2(x)) + planetInfo.node_LongitudeAscendingNode; - var rdAU = rAU * psiRad.Cosine(); - var leLdRad = (leDeg2 - ldDeg).ToRadians(); - var atan2Type1 = (rdAU * leLdRad.Sine()).AngleTangent2(rAU2 - rdAU * leLdRad.Cosine()); - var atan2Type2 = (rAU2 * (-leLdRad).Sine()).AngleTangent2(rdAU - rAU2 * leLdRad.Cosine()); - var aRad = (rdAU < 1) ? atan2Type1 : atan2Type2; - var lamdaDeg1 = (rdAU < 1) ? 180 + leDeg2 + PAMacros.Degrees(aRad) : PAMacros.Degrees(aRad) + ldDeg; - var lamdaDeg2 = lamdaDeg1 - 360 * (lamdaDeg1 / 360).Floor(); - var betaDeg = PAMacros.Degrees((rdAU * psiRad.Tangent() * (lamdaDeg2 - ldDeg).ToRadians().Sine() / (rAU2 * (-leLdRad).Sine())).AngleTangent()); - var raHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(lamdaDeg2, 0, 0, betaDeg, 0, 0, gdateDay, gdateMonth, gdateYear)); - var decDeg = PAMacros.EcDec(lamdaDeg2, 0, 0, betaDeg, 0, 0, gdateDay, gdateMonth, gdateYear); - - var planetRAHour = PAMacros.DecimalHoursHour(raHours); - var planetRAMin = PAMacros.DecimalHoursMinute(raHours); - var planetRASec = PAMacros.DecimalHoursSecond(raHours); - var planetDecDeg = PAMacros.DecimalDegreesDegrees(decDeg); - var planetDecMin = PAMacros.DecimalDegreesMinutes(decDeg); - var planetDecSec = PAMacros.DecimalDegreesSeconds(decDeg); + int daylightSaving = isDaylightSaving ? 1 : 0; + + PlanetData planetInfo = PlanetInfo.GetPlanetInfo(planetName); + + double gdateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int gdateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int gdateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + + double utHours = PAMacros.LocalCivilTimeToUniversalTime(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double dDays = PAMacros.CivilDateToJulianDate(gdateDay + (utHours / 24), gdateMonth, gdateYear) - PAMacros.CivilDateToJulianDate(0, 1, 2010); + double npDeg1 = 360 * dDays / (365.242191 * planetInfo.tp_PeriodOrbit); + double npDeg2 = npDeg1 - 360 * (npDeg1 / 360).Floor(); + double mpDeg = npDeg2 + planetInfo.long_LongitudeEpoch - planetInfo.peri_LongitudePerihelion; + double lpDeg1 = npDeg2 + (360 * planetInfo.ecc_EccentricityOrbit * mpDeg.ToRadians().Sine() / Math.PI) + planetInfo.long_LongitudeEpoch; + double lpDeg2 = lpDeg1 - 360 * (lpDeg1 / 360).Floor(); + double planetTrueAnomalyDeg = lpDeg2 - planetInfo.peri_LongitudePerihelion; + double rAU = planetInfo.axis_AxisOrbit * (1 - Math.Pow(planetInfo.ecc_EccentricityOrbit, 2)) / (1 + planetInfo.ecc_EccentricityOrbit * planetTrueAnomalyDeg.ToRadians().Cosine()); + + PlanetData earthInfo = PlanetInfo.GetPlanetInfo("Earth"); + + double neDeg1 = 360 * dDays / (365.242191 * earthInfo.tp_PeriodOrbit); + double neDeg2 = neDeg1 - 360 * (neDeg1 / 360).Floor(); + double meDeg = neDeg2 + earthInfo.long_LongitudeEpoch - earthInfo.peri_LongitudePerihelion; + double leDeg1 = neDeg2 + earthInfo.long_LongitudeEpoch + 360 * earthInfo.ecc_EccentricityOrbit * meDeg.ToRadians().Sine() / Math.PI; + double leDeg2 = leDeg1 - 360 * (leDeg1 / 360).Floor(); + double earthTrueAnomalyDeg = leDeg2 - earthInfo.peri_LongitudePerihelion; + double rAU2 = earthInfo.axis_AxisOrbit * (1 - Math.Pow(earthInfo.ecc_EccentricityOrbit, 2)) / (1 + earthInfo.ecc_EccentricityOrbit * earthTrueAnomalyDeg.ToRadians().Cosine()); + double lpNodeRad = (lpDeg2 - planetInfo.node_LongitudeAscendingNode).ToRadians(); + double psiRad = (lpNodeRad.Sine() * planetInfo.incl_OrbitalInclination.ToRadians().Sine()).ASine(); + double y = lpNodeRad.Sine() * planetInfo.incl_OrbitalInclination.ToRadians().Cosine(); + double x = lpNodeRad.Cosine(); + double ldDeg = PAMacros.Degrees(y.AngleTangent2(x)) + planetInfo.node_LongitudeAscendingNode; + double rdAU = rAU * psiRad.Cosine(); + double leLdRad = (leDeg2 - ldDeg).ToRadians(); + double atan2Type1 = (rdAU * leLdRad.Sine()).AngleTangent2(rAU2 - rdAU * leLdRad.Cosine()); + double atan2Type2 = (rAU2 * (-leLdRad).Sine()).AngleTangent2(rdAU - rAU2 * leLdRad.Cosine()); + double aRad = (rdAU < 1) ? atan2Type1 : atan2Type2; + double lamdaDeg1 = (rdAU < 1) ? 180 + leDeg2 + PAMacros.Degrees(aRad) : PAMacros.Degrees(aRad) + ldDeg; + double lamdaDeg2 = lamdaDeg1 - 360 * (lamdaDeg1 / 360).Floor(); + double betaDeg = PAMacros.Degrees((rdAU * psiRad.Tangent() * (lamdaDeg2 - ldDeg).ToRadians().Sine() / (rAU2 * (-leLdRad).Sine())).AngleTangent()); + double raHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(lamdaDeg2, 0, 0, betaDeg, 0, 0, gdateDay, gdateMonth, gdateYear)); + double decDeg = PAMacros.EcDec(lamdaDeg2, 0, 0, betaDeg, 0, 0, gdateDay, gdateMonth, gdateYear); + + int planetRAHour = PAMacros.DecimalHoursHour(raHours); + int planetRAMin = PAMacros.DecimalHoursMinute(raHours); + double planetRASec = PAMacros.DecimalHoursSecond(raHours); + double planetDecDeg = PAMacros.DecimalDegreesDegrees(decDeg); + double planetDecMin = PAMacros.DecimalDegreesMinutes(decDeg); + double planetDecSec = PAMacros.DecimalDegreesSeconds(decDeg); return (planetRAHour, planetRAMin, planetRASec, planetDecDeg, planetDecMin, planetDecSec); } @@ -72,19 +72,19 @@ public class PAPlanet /// public (double planetRAHour, double planetRAMin, double planetRASec, double planetDecDeg, double planetDecMin, double planetDecSec) PrecisePositionOfPlanet(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear, string planetName) { - var daylightSaving = isDaylightSaving ? 1 : 0; + int daylightSaving = isDaylightSaving ? 1 : 0; - var coordinateResults = PAMacros.PlanetCoordinates(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear, planetName); + (double planetLongitude, double planetLatitude, double planetDistanceAU, double planetHLong1, double planetHLong2, double planetHLat, double planetRVect) coordinateResults = PAMacros.PlanetCoordinates(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear, planetName); - var planetRAHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(coordinateResults.planetLongitude, 0, 0, coordinateResults.planetLatitude, 0, 0, localDateDay, localDateMonth, localDateYear)); - var planetDecDeg1 = PAMacros.EcDec(coordinateResults.planetLongitude, 0, 0, coordinateResults.planetLatitude, 0, 0, localDateDay, localDateMonth, localDateYear); + double planetRAHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(coordinateResults.planetLongitude, 0, 0, coordinateResults.planetLatitude, 0, 0, localDateDay, localDateMonth, localDateYear)); + double planetDecDeg1 = PAMacros.EcDec(coordinateResults.planetLongitude, 0, 0, coordinateResults.planetLatitude, 0, 0, localDateDay, localDateMonth, localDateYear); - var planetRAHour = PAMacros.DecimalHoursHour(planetRAHours); - var planetRAMin = PAMacros.DecimalHoursMinute(planetRAHours); - var planetRASec = PAMacros.DecimalHoursSecond(planetRAHours); - var planetDecDeg = PAMacros.DecimalDegreesDegrees(planetDecDeg1); - var planetDecMin = PAMacros.DecimalDegreesMinutes(planetDecDeg1); - var planetDecSec = PAMacros.DecimalDegreesSeconds(planetDecDeg1); + int planetRAHour = PAMacros.DecimalHoursHour(planetRAHours); + int planetRAMin = PAMacros.DecimalHoursMinute(planetRAHours); + double planetRASec = PAMacros.DecimalHoursSecond(planetRAHours); + double planetDecDeg = PAMacros.DecimalDegreesDegrees(planetDecDeg1); + double planetDecMin = PAMacros.DecimalDegreesMinutes(planetDecDeg1); + double planetDecSec = PAMacros.DecimalDegreesSeconds(planetDecDeg1); return (planetRAHour, planetRAMin, planetRASec, planetDecDeg, planetDecMin, planetDecSec); } @@ -104,41 +104,41 @@ public class PAPlanet /// public (double distanceAU, double angDiaArcsec, double phase, double lightTimeHour, double lightTimeMinutes, double lightTimeSeconds, double posAngleBrightLimbDeg, double approximateMagnitude) VisualAspectsOfAPlanet(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear, string planetName) { - var daylightSaving = isDaylightSaving ? 1 : 0; + int daylightSaving = isDaylightSaving ? 1 : 0; - var greenwichDateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var greenwichDateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var greenwichDateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double greenwichDateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int greenwichDateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + int greenwichDateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var planetCoordInfo = PAMacros.PlanetCoordinates(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear, planetName); + (double planetLongitude, double planetLatitude, double planetDistanceAU, double planetHLong1, double planetHLong2, double planetHLat, double planetRVect) planetCoordInfo = PAMacros.PlanetCoordinates(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear, planetName); - var planetRARad = PAMacros.EcRA(planetCoordInfo.planetLongitude, 0, 0, planetCoordInfo.planetLatitude, 0, 0, localDateDay, localDateMonth, localDateYear).ToRadians(); - var planetDecRad = PAMacros.EcDec(planetCoordInfo.planetLongitude, 0, 0, planetCoordInfo.planetLatitude, 0, 0, localDateDay, localDateMonth, localDateYear).ToRadians(); + double planetRARad = PAMacros.EcRA(planetCoordInfo.planetLongitude, 0, 0, planetCoordInfo.planetLatitude, 0, 0, localDateDay, localDateMonth, localDateYear).ToRadians(); + double planetDecRad = PAMacros.EcDec(planetCoordInfo.planetLongitude, 0, 0, planetCoordInfo.planetLatitude, 0, 0, localDateDay, localDateMonth, localDateYear).ToRadians(); - var lightTravelTimeHours = planetCoordInfo.planetDistanceAU * 0.1386; - var planetInfo = PlanetInfo.GetPlanetInfo(planetName); - var angularDiameterArcsec = planetInfo.theta0_AngularDiameter / planetCoordInfo.planetDistanceAU; - var phase1 = 0.5 * (1.0 + (planetCoordInfo.planetLongitude - planetCoordInfo.planetHLong1).ToRadians().Cosine()); + double lightTravelTimeHours = planetCoordInfo.planetDistanceAU * 0.1386; + PlanetData planetInfo = PlanetInfo.GetPlanetInfo(planetName); + double angularDiameterArcsec = planetInfo.theta0_AngularDiameter / planetCoordInfo.planetDistanceAU; + double phase1 = 0.5 * (1.0 + (planetCoordInfo.planetLongitude - planetCoordInfo.planetHLong1).ToRadians().Cosine()); - var sunEclLongDeg = PAMacros.SunLong(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); - var sunRARad = PAMacros.EcRA(sunEclLongDeg, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear).ToRadians(); - var sunDecRad = PAMacros.EcDec(sunEclLongDeg, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear).ToRadians(); + double sunEclLongDeg = PAMacros.SunLong(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); + double sunRARad = PAMacros.EcRA(sunEclLongDeg, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear).ToRadians(); + double sunDecRad = PAMacros.EcDec(sunEclLongDeg, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear).ToRadians(); - var y = sunDecRad.Cosine() * (sunRARad - planetRARad).Sine(); - var x = planetDecRad.Cosine() * sunDecRad.Sine() - planetDecRad.Sine() * sunDecRad.Cosine() * (sunRARad - planetRARad).Cosine(); + double y = sunDecRad.Cosine() * (sunRARad - planetRARad).Sine(); + double x = planetDecRad.Cosine() * sunDecRad.Sine() - planetDecRad.Sine() * sunDecRad.Cosine() * (sunRARad - planetRARad).Cosine(); - var chiDeg = PAMacros.Degrees(y.AngleTangent2(x)); - var radiusVectorAU = planetCoordInfo.planetRVect; - var approximateMagnitude1 = 5.0 * (radiusVectorAU * planetCoordInfo.planetDistanceAU / phase1.SquareRoot()).Log10() + planetInfo.v0_VisualMagnitude; + double chiDeg = PAMacros.Degrees(y.AngleTangent2(x)); + double radiusVectorAU = planetCoordInfo.planetRVect; + double approximateMagnitude1 = 5.0 * (radiusVectorAU * planetCoordInfo.planetDistanceAU / phase1.SquareRoot()).Log10() + planetInfo.v0_VisualMagnitude; - var distanceAU = Math.Round(planetCoordInfo.planetDistanceAU, 5); - var angDiaArcsec = Math.Round(angularDiameterArcsec, 1); - var phase = Math.Round(phase1, 2); - var lightTimeHour = PAMacros.DecimalHoursHour(lightTravelTimeHours); - var lightTimeMinutes = PAMacros.DecimalHoursMinute(lightTravelTimeHours); - var lightTimeSeconds = PAMacros.DecimalHoursSecond(lightTravelTimeHours); - var posAngleBrightLimbDeg = Math.Round(chiDeg, 1); - var approximateMagnitude = Math.Round(approximateMagnitude1, 1); + double distanceAU = Math.Round(planetCoordInfo.planetDistanceAU, 5); + double angDiaArcsec = Math.Round(angularDiameterArcsec, 1); + double phase = Math.Round(phase1, 2); + int lightTimeHour = PAMacros.DecimalHoursHour(lightTravelTimeHours); + int lightTimeMinutes = PAMacros.DecimalHoursMinute(lightTravelTimeHours); + double lightTimeSeconds = PAMacros.DecimalHoursSecond(lightTravelTimeHours); + double posAngleBrightLimbDeg = Math.Round(chiDeg, 1); + double approximateMagnitude = Math.Round(approximateMagnitude1, 1); return (distanceAU, angDiaArcsec, phase, lightTimeHour, lightTimeMinutes, lightTimeSeconds, posAngleBrightLimbDeg, approximateMagnitude); } diff --git a/PALib/PASun.cs b/PALib/PASun.cs index c05dd12..069250a 100644 --- a/PALib/PASun.cs +++ b/PALib/PASun.cs @@ -29,31 +29,31 @@ public class PASun /// public (double sunRAHour, double sunRAMin, double sunRASec, double sunDecDeg, double sunDecMin, double sunDecSec) ApproximatePositionOfSun(double lctHours, double lctMinutes, double lctSeconds, double localDay, int localMonth, int localYear, bool isDaylightSaving, int zoneCorrection) { - var daylightSaving = (isDaylightSaving == true) ? 1 : 0; - - var greenwichDateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var greenwichDateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var greenwichDateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var utHours = PAMacros.LocalCivilTimeToUniversalTime(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var utDays = utHours / 24; - var jdDays = PAMacros.CivilDateToJulianDate(greenwichDateDay, greenwichDateMonth, greenwichDateYear) + utDays; - var dDays = jdDays - PAMacros.CivilDateToJulianDate(0, 1, 2010); - var nDeg = 360 * dDays / 365.242191; - var mDeg1 = nDeg + PAMacros.SunELong(0, 1, 2010) - PAMacros.SunPeri(0, 1, 2010); - var mDeg2 = mDeg1 - 360 * (mDeg1 / 360).Floor(); - var eCDeg = 360 * PAMacros.SunEcc(0, 1, 2010) * mDeg2.ToRadians().Sine() / Math.PI; - var lSDeg1 = nDeg + eCDeg + PAMacros.SunELong(0, 1, 2010); - var lSDeg2 = lSDeg1 - 360 * (lSDeg1 / 360).Floor(); - var raDeg = PAMacros.EcRA(lSDeg2, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear); - var raHours = PAMacros.DecimalDegreesToDegreeHours(raDeg); - var decDeg = PAMacros.EcDec(lSDeg2, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear); - - var sunRAHour = PAMacros.DecimalHoursHour(raHours); - var sunRAMin = PAMacros.DecimalHoursMinute(raHours); - var sunRASec = PAMacros.DecimalHoursSecond(raHours); - var sunDecDeg = PAMacros.DecimalDegreesDegrees(decDeg); - var sunDecMin = PAMacros.DecimalDegreesMinutes(decDeg); - var sunDecSec = PAMacros.DecimalDegreesSeconds(decDeg); + int daylightSaving = (isDaylightSaving == true) ? 1 : 0; + + double greenwichDateDay = PAMacros.LocalCivilTimeGreenwichDay(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + int greenwichDateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + int greenwichDateYear = PAMacros.LocalCivilTimeGreenwichYear(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + double utHours = PAMacros.LocalCivilTimeToUniversalTime(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + double utDays = utHours / 24; + double jdDays = PAMacros.CivilDateToJulianDate(greenwichDateDay, greenwichDateMonth, greenwichDateYear) + utDays; + double dDays = jdDays - PAMacros.CivilDateToJulianDate(0, 1, 2010); + double nDeg = 360 * dDays / 365.242191; + double mDeg1 = nDeg + PAMacros.SunELong(0, 1, 2010) - PAMacros.SunPeri(0, 1, 2010); + double mDeg2 = mDeg1 - 360 * (mDeg1 / 360).Floor(); + double eCDeg = 360 * PAMacros.SunEcc(0, 1, 2010) * mDeg2.ToRadians().Sine() / Math.PI; + double lSDeg1 = nDeg + eCDeg + PAMacros.SunELong(0, 1, 2010); + double lSDeg2 = lSDeg1 - 360 * (lSDeg1 / 360).Floor(); + double raDeg = PAMacros.EcRA(lSDeg2, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear); + double raHours = PAMacros.DecimalDegreesToDegreeHours(raDeg); + double decDeg = PAMacros.EcDec(lSDeg2, 0, 0, 0, 0, 0, greenwichDateDay, greenwichDateMonth, greenwichDateYear); + + int sunRAHour = PAMacros.DecimalHoursHour(raHours); + int sunRAMin = PAMacros.DecimalHoursMinute(raHours); + double sunRASec = PAMacros.DecimalHoursSecond(raHours); + double sunDecDeg = PAMacros.DecimalDegreesDegrees(decDeg); + double sunDecMin = PAMacros.DecimalDegreesMinutes(decDeg); + double sunDecSec = PAMacros.DecimalDegreesSeconds(decDeg); return (sunRAHour, sunRAMin, sunRASec, sunDecDeg, sunDecMin, sunDecSec); } @@ -63,22 +63,22 @@ public class PASun /// public (double sunRAHour, double sunRAMin, double sunRASec, double sunDecDeg, double sunDecMin, double sunDecSec) PrecisePositionOfSun(double lctHours, double lctMinutes, double lctSeconds, double localDay, int localMonth, int localYear, bool isDaylightSaving, int zoneCorrection) { - var daylightSaving = (isDaylightSaving == true) ? 1 : 0; - - var gDay = PAMacros.LocalCivilTimeGreenwichDay(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var gMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var gYear = PAMacros.LocalCivilTimeGreenwichYear(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var sunEclipticLongitudeDeg = PAMacros.SunLong(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var raDeg = PAMacros.EcRA(sunEclipticLongitudeDeg, 0, 0, 0, 0, 0, gDay, gMonth, gYear); - var raHours = PAMacros.DecimalDegreesToDegreeHours(raDeg); - var decDeg = PAMacros.EcDec(sunEclipticLongitudeDeg, 0, 0, 0, 0, 0, gDay, gMonth, gYear); - - var sunRAHour = PAMacros.DecimalHoursHour(raHours); - var sunRAMin = PAMacros.DecimalHoursMinute(raHours); - var sunRASec = PAMacros.DecimalHoursSecond(raHours); - var sunDecDeg = PAMacros.DecimalDegreesDegrees(decDeg); - var sunDecMin = PAMacros.DecimalDegreesMinutes(decDeg); - var sunDecSec = PAMacros.DecimalDegreesSeconds(decDeg); + int daylightSaving = (isDaylightSaving == true) ? 1 : 0; + + double gDay = PAMacros.LocalCivilTimeGreenwichDay(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + int gMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + int gYear = PAMacros.LocalCivilTimeGreenwichYear(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + double sunEclipticLongitudeDeg = PAMacros.SunLong(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + double raDeg = PAMacros.EcRA(sunEclipticLongitudeDeg, 0, 0, 0, 0, 0, gDay, gMonth, gYear); + double raHours = PAMacros.DecimalDegreesToDegreeHours(raDeg); + double decDeg = PAMacros.EcDec(sunEclipticLongitudeDeg, 0, 0, 0, 0, 0, gDay, gMonth, gYear); + + int sunRAHour = PAMacros.DecimalHoursHour(raHours); + int sunRAMin = PAMacros.DecimalHoursMinute(raHours); + double sunRASec = PAMacros.DecimalHoursSecond(raHours); + double sunDecDeg = PAMacros.DecimalDegreesDegrees(decDeg); + double sunDecMin = PAMacros.DecimalDegreesMinutes(decDeg); + double sunDecSec = PAMacros.DecimalDegreesSeconds(decDeg); return (sunRAHour, sunRAMin, sunRASec, sunDecDeg, sunDecMin, sunDecSec); } @@ -94,22 +94,22 @@ public class PASun /// public (double sunDistKm, double sunAngSizeDeg, double sunAngSizeMin, double sunAngSizeSec) SunDistanceAndAngularSize(double lctHours, double lctMinutes, double lctSeconds, double localDay, int localMonth, int localYear, bool isDaylightSaving, int zoneCorrection) { - var daylightSaving = isDaylightSaving ? 1 : 0; - - var gDay = PAMacros.LocalCivilTimeGreenwichDay(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var gMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var gYear = PAMacros.LocalCivilTimeGreenwichYear(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var trueAnomalyDeg = PAMacros.SunTrueAnomaly(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); - var trueAnomalyRad = trueAnomalyDeg.ToRadians(); - var eccentricity = PAMacros.SunEcc(gDay, gMonth, gYear); - var f = (1 + eccentricity * trueAnomalyRad.Cosine()) / (1 - eccentricity * eccentricity); - var rKm = 149598500 / f; - var thetaDeg = f * 0.533128; - - var sunDistKm = Math.Round(rKm, 0); - var sunAngSizeDeg = PAMacros.DecimalDegreesDegrees(thetaDeg); - var sunAngSizeMin = PAMacros.DecimalDegreesMinutes(thetaDeg); - var sunAngSizeSec = PAMacros.DecimalDegreesSeconds(thetaDeg); + int daylightSaving = isDaylightSaving ? 1 : 0; + + double gDay = PAMacros.LocalCivilTimeGreenwichDay(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + int gMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + int gYear = PAMacros.LocalCivilTimeGreenwichYear(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + double trueAnomalyDeg = PAMacros.SunTrueAnomaly(lctHours, lctMinutes, lctSeconds, daylightSaving, zoneCorrection, localDay, localMonth, localYear); + double trueAnomalyRad = trueAnomalyDeg.ToRadians(); + double eccentricity = PAMacros.SunEcc(gDay, gMonth, gYear); + double f = (1 + eccentricity * trueAnomalyRad.Cosine()) / (1 - eccentricity * eccentricity); + double rKm = 149598500 / f; + double thetaDeg = f * 0.533128; + + double sunDistKm = Math.Round(rKm, 0); + double sunAngSizeDeg = PAMacros.DecimalDegreesDegrees(thetaDeg); + double sunAngSizeMin = PAMacros.DecimalDegreesMinutes(thetaDeg); + double sunAngSizeSec = PAMacros.DecimalDegreesSeconds(thetaDeg); return (sunDistKm, sunAngSizeDeg, sunAngSizeMin, sunAngSizeSec); } @@ -128,29 +128,29 @@ public class PASun /// public (double localSunriseHour, double localSunriseMinute, double localSunsetHour, double localSunsetMinute, double azimuthOfSunriseDeg, double azimuthOfSunsetDeg, string status) SunriseAndSunset(double localDay, int localMonth, int localYear, bool isDaylightSaving, int zoneCorrection, double geographicalLongDeg, double geographicalLatDeg) { - var daylightSaving = isDaylightSaving ? 1 : 0; + int daylightSaving = isDaylightSaving ? 1 : 0; - var localSunriseHours = PAMacros.SunriseLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); - var localSunsetHours = PAMacros.SunsetLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); + double localSunriseHours = PAMacros.SunriseLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); + double localSunsetHours = PAMacros.SunsetLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); - var sunRiseSetStatus = PAMacros.ESunRS(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); + string sunRiseSetStatus = PAMacros.ESunRS(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); - var adjustedSunriseHours = localSunriseHours + 0.008333; - var adjustedSunsetHours = localSunsetHours + 0.008333; + double adjustedSunriseHours = localSunriseHours + 0.008333; + double adjustedSunsetHours = localSunsetHours + 0.008333; - var azimuthOfSunriseDeg1 = PAMacros.SunriseAZ(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); - var azimuthOfSunsetDeg1 = PAMacros.SunsetAZ(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); + double azimuthOfSunriseDeg1 = PAMacros.SunriseAZ(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); + double azimuthOfSunsetDeg1 = PAMacros.SunsetAZ(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg); - var localSunriseHour = sunRiseSetStatus.Equals("OK") ? PAMacros.DecimalHoursHour(adjustedSunriseHours) : 0; - var localSunriseMinute = sunRiseSetStatus.Equals("OK") ? PAMacros.DecimalHoursMinute(adjustedSunriseHours) : 0; + int localSunriseHour = sunRiseSetStatus.Equals("OK") ? PAMacros.DecimalHoursHour(adjustedSunriseHours) : 0; + int localSunriseMinute = sunRiseSetStatus.Equals("OK") ? PAMacros.DecimalHoursMinute(adjustedSunriseHours) : 0; - var localSunsetHour = sunRiseSetStatus.Equals("OK") ? PAMacros.DecimalHoursHour(adjustedSunsetHours) : 0; - var localSunsetMinute = sunRiseSetStatus.Equals("OK") ? PAMacros.DecimalHoursMinute(adjustedSunsetHours) : 0; + int localSunsetHour = sunRiseSetStatus.Equals("OK") ? PAMacros.DecimalHoursHour(adjustedSunsetHours) : 0; + int localSunsetMinute = sunRiseSetStatus.Equals("OK") ? PAMacros.DecimalHoursMinute(adjustedSunsetHours) : 0; - var azimuthOfSunriseDeg = sunRiseSetStatus.Equals("OK") ? Math.Round(azimuthOfSunriseDeg1, 2) : 0; - var azimuthOfSunsetDeg = sunRiseSetStatus.Equals("OK") ? Math.Round(azimuthOfSunsetDeg1, 2) : 0; + double azimuthOfSunriseDeg = sunRiseSetStatus.Equals("OK") ? Math.Round(azimuthOfSunriseDeg1, 2) : 0; + double azimuthOfSunsetDeg = sunRiseSetStatus.Equals("OK") ? Math.Round(azimuthOfSunsetDeg1, 2) : 0; - var status = sunRiseSetStatus; + string status = sunRiseSetStatus; return (localSunriseHour, localSunriseMinute, localSunsetHour, localSunsetMinute, azimuthOfSunriseDeg, azimuthOfSunsetDeg, status); } @@ -175,16 +175,16 @@ public class PASun /// public (double amTwilightBeginsHour, double amTwilightBeginsMin, double pmTwilightEndsHour, double pmTwilightEndsMin, string status) MorningAndEveningTwilight(double localDay, int localMonth, int localYear, bool isDaylightSaving, int zoneCorrection, double geographicalLongDeg, double geographicalLatDeg, PATwilightType twilightType) { - var daylightSaving = isDaylightSaving ? 1 : 0; + int daylightSaving = isDaylightSaving ? 1 : 0; - var startOfAMTwilightHours = PAMacros.TwilightAMLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg, twilightType); + double startOfAMTwilightHours = PAMacros.TwilightAMLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg, twilightType); - var endOfPMTwilightHours = PAMacros.TwilightPMLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg, twilightType); + double endOfPMTwilightHours = PAMacros.TwilightPMLCT(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg, twilightType); - var twilightStatus = PAMacros.ETwilight(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg, twilightType); + string twilightStatus = PAMacros.ETwilight(localDay, localMonth, localYear, daylightSaving, zoneCorrection, geographicalLongDeg, geographicalLatDeg, twilightType); - var adjustedAMStartTime = startOfAMTwilightHours + 0.008333; - var adjustedPMStartTime = endOfPMTwilightHours + 0.008333; + double adjustedAMStartTime = startOfAMTwilightHours + 0.008333; + double adjustedPMStartTime = endOfPMTwilightHours + 0.008333; double amTwilightBeginsHour = twilightStatus.Equals("OK") ? PAMacros.DecimalHoursHour(adjustedAMStartTime) : -99; double amTwilightBeginsMin = twilightStatus.Equals("OK") ? PAMacros.DecimalHoursMinute(adjustedAMStartTime) : -99; @@ -192,7 +192,7 @@ public class PASun double pmTwilightEndsHour = twilightStatus.Equals("OK") ? PAMacros.DecimalHoursHour(adjustedPMStartTime) : -99; double pmTwilightEndsMin = twilightStatus.Equals("OK") ? PAMacros.DecimalHoursMinute(adjustedPMStartTime) : -99; - var status = twilightStatus; + string status = twilightStatus; return (amTwilightBeginsHour, amTwilightBeginsMin, pmTwilightEndsHour, pmTwilightEndsMin, status); } @@ -209,13 +209,13 @@ public class PASun /// public (double equationOfTimeMin, double equationOfTimeSec) EquationOfTime(double gwdateDay, int gwdateMonth, int gwdateYear) { - var sunLongitudeDeg = PAMacros.SunLong(12, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); - var sunRAHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(sunLongitudeDeg, 0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear)); - var equivalentUTHours = PAMacros.GreenwichSiderealTimeToUniversalTime(sunRAHours, 0, 0, gwdateDay, gwdateMonth, gwdateYear); - var equationOfTimeHours = equivalentUTHours - 12; + double sunLongitudeDeg = PAMacros.SunLong(12, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); + double sunRAHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(sunLongitudeDeg, 0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear)); + double equivalentUTHours = PAMacros.GreenwichSiderealTimeToUniversalTime(sunRAHours, 0, 0, gwdateDay, gwdateMonth, gwdateYear); + double equationOfTimeHours = equivalentUTHours - 12; - var equationOfTimeMin = PAMacros.DecimalHoursMinute(equationOfTimeHours); - var equationOfTimeSec = PAMacros.DecimalHoursSecond(equationOfTimeHours); + int equationOfTimeMin = PAMacros.DecimalHoursMinute(equationOfTimeHours); + double equationOfTimeSec = PAMacros.DecimalHoursSecond(equationOfTimeHours); return (equationOfTimeMin, equationOfTimeSec); } @@ -229,10 +229,10 @@ public class PASun /// solarElongationDeg -- Solar elongation, in degrees public double SolarElongation(double raHour, double raMin, double raSec, double decDeg, double decMin, double decSec, double gwdateDay, int gwdateMonth, int gwdateYear) { - var sunLongitudeDeg = PAMacros.SunLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); - var sunRAHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(sunLongitudeDeg, 0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear)); - var sunDecDeg = PAMacros.EcDec(sunLongitudeDeg, 0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); - var solarElongationDeg = PAMacros.Angle(sunRAHours, 0, 0, sunDecDeg, 0, 0, raHour, raMin, raSec, decDeg, decMin, decSec, PAAngleMeasure.Hours); + double sunLongitudeDeg = PAMacros.SunLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); + double sunRAHours = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(sunLongitudeDeg, 0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear)); + double sunDecDeg = PAMacros.EcDec(sunLongitudeDeg, 0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear); + double solarElongationDeg = PAMacros.Angle(sunRAHours, 0, 0, sunDecDeg, 0, 0, raHour, raMin, raSec, decDeg, decMin, decSec, PAAngleMeasure.Hours); return Math.Round(solarElongationDeg, 2); } From 1e0cb996d4758e03677928edf899583cc26c1a4f Mon Sep 17 00:00:00 2001 From: Jim Carr Date: Sun, 28 Apr 2024 13:24:04 -0400 Subject: [PATCH 3/4] Compound assignments --- PALib/PADateTime.cs | 2 +- PALib/PAMacros.cs | 396 ++++++++++++++++++++++---------------------- 2 files changed, 199 insertions(+), 199 deletions(-) diff --git a/PALib/PADateTime.cs b/PALib/PADateTime.cs index 272bd0c..3e304c9 100644 --- a/PALib/PADateTime.cs +++ b/PALib/PADateTime.cs @@ -44,7 +44,7 @@ public int CivilDateToDayNumber(int month, int day, int year) { if (month <= 2) { - month = month - 1; + month--; month = year.IsLeapYear() ? month * 62 : month * 63; month = (int)((double)month / 2).Floor(); } diff --git a/PALib/PAMacros.cs b/PALib/PAMacros.cs index c786375..5b126c8 100644 --- a/PALib/PAMacros.cs +++ b/PALib/PAMacros.cs @@ -808,7 +808,7 @@ public static double SunLong(double lch, double lcm, double lcs, int ds, int zc, double sr = at + (l - m1 + d2).ToRadians(); double tp = 6.283185308; - sr = sr - tp * (sr / tp).Floor(); + sr -= tp * (sr / tp).Floor(); return Degrees(sr); } @@ -832,8 +832,8 @@ public static double TrueAnomaly(double am, double ec) { break; } - d = d / (1.0 - (ec * ae.Cosine())); - ae = ae - d; + d /= (1.0 - (ec * ae.Cosine())); + ae -= d; } double a = ((1 + ec) / (1 - ec)).SquareRoot() * (ae / 2).Tangent(); double at = 2.0 * a.AngleTangent(); @@ -862,8 +862,8 @@ public static double EccentricAnomaly(double am, double ec) break; } - d = d / (1 - (ec * ae.Cosine())); - ae = ae - d; + d /= (1 - (ec * ae.Cosine())); + ae -= d; } return ae; @@ -1020,7 +1020,7 @@ public static (double p, double q) ParallaxHAL2870(double x, double y, double rc double p = x + dx; double cp = p.Cosine(); - p = p - tp * (p / tp).Floor(); + p -= tp * (p / tp).Floor(); double q = (cp * (rp * sy - rs) / (rp * cy * cx - rc)).AngleTangent(); return (p, q); @@ -1112,7 +1112,7 @@ public static (double p, double q) ParallaxDecL2870(double x, double y, double r double p = x + dx; double cp = p.Cosine(); - p = p - tp * (p / tp).Floor(); + p -= tp * (p / tp).Floor(); double q = (cp * (rp * sy - rs) / (rp * cy * cx - rc)).AngleTangent(); return (p, q); @@ -1229,7 +1229,7 @@ public static double MoonLong(double lh, double lm, double ls, int ds, int zc, d double c = (na + 275.05 - 2.3 * t).ToRadians(); double s4 = c.Sine(); ml = ml + 0.000233 * s1 + s3 + 0.001964 * s2; - ms = ms - 0.001778 * s1; + ms -= 0.001778 * s1; md = md + 0.000817 * s1 + s3 + 0.002541 * s2; mf = mf + s3 - 0.024691 * s2 - 0.004328 * s4; me1 = me1 + 0.002011 * s1 + s3 + 0.001964 * s2; @@ -1244,7 +1244,7 @@ public static double MoonLong(double lh, double lm, double ls, int ds, int zc, d double l = 6.28875 * md.Sine() + 1.274018 * (2.0 * me1 - md).Sine(); l = l + 0.658309 * (2.0 * me1).Sine() + 0.213616 * (2.0 * md).Sine(); l = l - e * 0.185596 * ms.Sine() - 0.114336 * (2.0 * mf).Sine(); - l = l + 0.058793 * (2.0 * (me1 - md)).Sine(); + l += 0.058793 * (2.0 * (me1 - md)).Sine(); l = l + 0.057212 * e * (2.0 * me1 - ms - md).Sine() + 0.05332 * (2.0 * me1 + md).Sine(); l = l + 0.045874 * e * (2.0 * me1 - ms).Sine() + 0.041024 * e * (md - ms).Sine(); l = l - 0.034718 * me1.Sine() - e * 0.030465 * (ms + md).Sine(); @@ -1262,13 +1262,13 @@ public static double MoonLong(double lh, double lm, double ls, int ds, int zc, d l = l - 0.001773 * (md + 2.0 * (me1 - mf)).Sine() - 0.001595 * (2.0 * (mf + me1)).Sine(); l = l + e * 0.00122 * (4.0 * me1 - ms - md).Sine() - 0.00111 * (2.0 * (md + mf)).Sine(); l = l + 0.000892 * (md - 3.0 * me1).Sine() - e * 0.000811 * (ms + md + 2.0 * me1).Sine(); - l = l + e * 0.000761 * (4.0 * me1 - ms - 2.0 * md).Sine(); - l = l + e2 * 0.000704 * (md - 2.0 * (ms + me1)).Sine(); - l = l + e * 0.000693 * (ms - 2.0 * (md - me1)).Sine(); - l = l + e * 0.000598 * (2.0 * (me1 - mf) - ms).Sine(); + l += e * 0.000761 * (4.0 * me1 - ms - 2.0 * md).Sine(); + l += e2 * 0.000704 * (md - 2.0 * (ms + me1)).Sine(); + l += e * 0.000693 * (ms - 2.0 * (md - me1)).Sine(); + l += e * 0.000598 * (2.0 * (me1 - mf) - ms).Sine(); l = l + 0.00055 * (md + 4.0 * me1).Sine() + 0.000538 * (4.0 * md).Sine(); l = l + e * 0.000521 * (4.0 * me1 - ms).Sine() + 0.000486 * (2.0 * md - me1).Sine(); - l = l + e2 * 0.000717 * (md - 2.0 * ms).Sine(); + l += e2 * 0.000717 * (md - 2.0 * ms).Sine(); double mm = Unwind(ml + l.ToRadians()); return Degrees(mm); @@ -1323,7 +1323,7 @@ public static double MoonLat(double lh, double lm, double ls, int ds, int zc, do double c = (na + 275.05 - 2.3 * t).ToRadians(); double s4 = c.Sine(); ml = ml + 0.000233 * s1 + s3 + 0.001964 * s2; - ms = ms - 0.001778 * s1; + ms -= 0.001778 * s1; md = md + 0.000817 * s1 + s3 + 0.002541 * s2; mf = mf + s3 - 0.024691 * s2 - 0.004328 * s4; me1 = me1 + 0.002011 * s1 + s3 + 0.001964 * s2; @@ -1342,9 +1342,9 @@ public static double MoonLat(double lh, double lm, double ls, int ds, int zc, do g = g + 0.009267 * (2.0 * me1 + md - mf).Sine() + 0.008823 * (2.0 * md - mf).Sine(); g = g + e * 0.008247 * (2.0 * me1 - ms - mf).Sine() + 0.004323 * (2.0 * (me1 - md) - mf).Sine(); g = g + 0.0042 * (2.0 * me1 + mf + md).Sine() + e * 0.003372 * (mf - ms - 2.0 * me1).Sine(); - g = g + e * 0.002472 * (2.0 * me1 + mf - ms - md).Sine(); - g = g + e * 0.002222 * (2.0 * me1 + mf - ms).Sine(); - g = g + e * 0.002072 * (2.0 * me1 - mf - ms - md).Sine(); + g += e * 0.002472 * (2.0 * me1 + mf - ms - md).Sine(); + g += e * 0.002222 * (2.0 * me1 + mf - ms).Sine(); + g += e * 0.002072 * (2.0 * me1 - mf - ms - md).Sine(); g = g + e * 0.001877 * (mf - ms + md).Sine() + 0.001828 * (4.0 * me1 - mf - md).Sine(); g = g - e * 0.001803 * (mf + ms).Sine() - 0.00175 * (3.0 * mf).Sine(); g = g + e * 0.00157 * (md - ms - mf).Sine() - 0.001487 * (mf + me1).Sine(); @@ -1353,12 +1353,12 @@ public static double MoonLat(double lh, double lm, double ls, int ds, int zc, do g = g + 0.001106 * (mf + 3.0 * md).Sine() + 0.00102 * (4.0 * me1 - mf).Sine(); g = g + 0.000833 * (mf + 4.0 * me1 - md).Sine() + 0.000781 * (md - 3.0 * mf).Sine(); g = g + 0.00067 * (mf + 4.0 * me1 - 2.0 * md).Sine() + 0.000606 * (2.0 * me1 - 3.0 * mf).Sine(); - g = g + 0.000597 * (2.0 * (me1 + md) - mf).Sine(); + g += 0.000597 * (2.0 * (me1 + md) - mf).Sine(); g = g + e * 0.000492 * (2.0 * me1 + md - ms - mf).Sine() + 0.00045 * (2.0 * (md - me1) - mf).Sine(); g = g + 0.000439 * (3.0 * md - mf).Sine() + 0.000423 * (mf + 2.0 * (me1 + md)).Sine(); g = g + 0.000422 * (2.0 * me1 - mf - 3.0 * md).Sine() - e * 0.000367 * (ms + mf + 2.0 * me1 - md).Sine(); g = g - e * 0.000353 * (ms + mf + 2.0 * me1).Sine() + 0.000331 * (mf + 4.0 * me1).Sine(); - g = g + e * 0.000317 * (2.0 * me1 + mf - ms + md).Sine(); + g += e * 0.000317 * (2.0 * me1 + mf - ms + md).Sine(); g = g + e2 * 0.000306 * (2.0 * (me1 - ms) - mf).Sine() - 0.000283 * (md + 3.0 * mf).Sine(); double w1 = 0.0004664 * na.Cosine(); double w2 = 0.0000754 * c.Cosine(); @@ -1416,7 +1416,7 @@ public static double MoonHP(double lh, double lm, double ls, int ds, int zc, dou double c = (na + 275.05 - 2.3 * t).ToRadians(); double s4 = c.Sine(); ml = ml + 0.000233 * s1 + s3 + 0.001964 * s2; - ms = ms - 0.001778 * s1; + ms -= 0.001778 * s1; md = md + 0.000817 * s1 + s3 + 0.002541 * s2; mf = mf + s3 - 0.024691 * s2 - 0.004328 * s4; me1 = me1 + 0.002011 * s1 + s3 + 0.001964 * s2; @@ -1430,7 +1430,7 @@ public static double MoonHP(double lh, double lm, double ls, int ds, int zc, dou double pm = 0.950724 + 0.051818 * md.Cosine() + 0.009531 * (2.0 * me1 - md).Cosine(); pm = pm + 0.007843 * (2.0 * me1).Cosine() + 0.002824 * (2.0 * md).Cosine(); pm = pm + 0.000857 * (2.0 * me1 + md).Cosine() + e * 0.000533 * (2.0 * me1 - ms).Cosine(); - pm = pm + e * 0.000401 * (2.0 * me1 - md - ms).Cosine(); + pm += e * 0.000401 * (2.0 * me1 - md - ms).Cosine(); pm = pm + e * 0.00032 * (md - ms).Cosine() - 0.000271 * me1.Cosine(); pm = pm - e * 0.000264 * (ms + md).Cosine() - 0.000198 * (2.0 * mf - md).Cosine(); pm = pm + 0.000173 * (3.0 * md).Cosine() + 0.000167 * (4.0 * me1 - md).Cosine(); @@ -1442,7 +1442,7 @@ public static double MoonHP(double lh, double lm, double ls, int ds, int zc, dou pm = pm - 0.000033 * (3.0 * md - 2.0 * me1).Cosine() - 0.00003 * (md + me1).Cosine(); pm = pm - 0.000029 * (2.0 * (mf - me1)).Cosine() - e * 0.000029 * (2.0 * md + ms).Cosine(); pm = pm + e2 * 0.000026 * (2.0 * (me1 - ms)).Cosine() - 0.000023 * (2.0 * (mf - me1) + md).Cosine(); - pm = pm + e * 0.000019 * (4.0 * me1 - ms - md).Cosine(); + pm += e * 0.000019 * (4.0 * me1 - ms - md).Cosine(); return pm; } @@ -2790,7 +2790,7 @@ public static (double planetLongitude, double planetLatitude, double planetDista double so = lo.Sine(); double co = lo.Cosine(); double inn = matchPlanet.Value5.ToRadians(); - pvv = pvv + qb; + pvv += qb; sp = so * inn.Sine(); double y = so * inn.Cosine(); double ps = sp.ASine() + qg; @@ -2839,14 +2839,14 @@ public static (double planetLongitude, double planetLatitude, double planetDista public static (double qa, double qb) PlanetLong_L4685(List pl) { double qa = 0.00204 * (5.0 * pl[2].APValue - 2.0 * pl[1].APValue + 0.21328).Cosine(); - qa = qa + 0.00103 * (2.0 * pl[2].APValue - pl[1].APValue - 2.8046).Cosine(); - qa = qa + 0.00091 * (2.0 * pl[4].APValue - pl[1].APValue - 0.64582).Cosine(); - qa = qa + 0.00078 * (5.0 * pl[2].APValue - 3.0 * pl[1].APValue + 0.17692).Cosine(); + qa += 0.00103 * (2.0 * pl[2].APValue - pl[1].APValue - 2.8046).Cosine(); + qa += 0.00091 * (2.0 * pl[4].APValue - pl[1].APValue - 0.64582).Cosine(); + qa += 0.00078 * (5.0 * pl[2].APValue - 3.0 * pl[1].APValue + 0.17692).Cosine(); double qb = 0.000007525 * (2.0 * pl[4].APValue - pl[1].APValue + 0.925251).Cosine(); - qb = qb + 0.000006802 * (5.0 * pl[2].APValue - 3.0 * pl[1].APValue - 4.53642).Cosine(); - qb = qb + 0.000005457 * (2.0 * pl[2].APValue - 2.0 * pl[1].APValue - 1.24246).Cosine(); - qb = qb + 0.000003569 * (5.0 * pl[2].APValue - pl[1].APValue - 1.35699).Cosine(); + qb += 0.000006802 * (5.0 * pl[2].APValue - 3.0 * pl[1].APValue - 4.53642).Cosine(); + qb += 0.000005457 * (2.0 * pl[2].APValue - 2.0 * pl[1].APValue - 1.24246).Cosine(); + qb += 0.000003569 * (5.0 * pl[2].APValue - pl[1].APValue - 1.35699).Cosine(); return (qa, qb); } @@ -2861,18 +2861,18 @@ public static (double qa, double qb, double qc, double qe) PlanetLong_L4735(List double qe = qc; double qa = 0.00313 * (2.0 * ms - 2.0 * pl[2].APValue - 2.587).Cosine(); - qa = qa + 0.00198 * (3.0 * ms - 3.0 * pl[2].APValue + 0.044768).Cosine(); - qa = qa + 0.00136 * (ms - pl[2].APValue - 2.0788).Cosine(); - qa = qa + 0.00096 * (3.0 * ms - 2.0 * pl[2].APValue - 2.3721).Cosine(); - qa = qa + 0.00082 * (pl[4].APValue - pl[2].APValue - 3.6318).Cosine(); + qa += 0.00198 * (3.0 * ms - 3.0 * pl[2].APValue + 0.044768).Cosine(); + qa += 0.00136 * (ms - pl[2].APValue - 2.0788).Cosine(); + qa += 0.00096 * (3.0 * ms - 2.0 * pl[2].APValue - 2.3721).Cosine(); + qa += 0.00082 * (pl[4].APValue - pl[2].APValue - 3.6318).Cosine(); double qb = 0.000022501 * (2.0 * ms - 2.0 * pl[2].APValue - 1.01592).Cosine(); - qb = qb + 0.000019045 * (3.0 * ms - 3.0 * pl[2].APValue + 1.61577).Cosine(); - qb = qb + 0.000006887 * (pl[4].APValue - pl[2].APValue - 2.06106).Cosine(); - qb = qb + 0.000005172 * (ms - pl[2].APValue - 0.508065).Cosine(); - qb = qb + 0.00000362 * (5.0 * ms - 4.0 * pl[2].APValue - 1.81877).Cosine(); - qb = qb + 0.000003283 * (4.0 * ms - 4.0 * pl[2].APValue + 1.10851).Cosine(); - qb = qb + 0.000003074 * (2.0 * pl[4].APValue - 2.0 * pl[2].APValue - 0.962846).Cosine(); + qb += 0.000019045 * (3.0 * ms - 3.0 * pl[2].APValue + 1.61577).Cosine(); + qb += 0.000006887 * (pl[4].APValue - pl[2].APValue - 2.06106).Cosine(); + qb += 0.000005172 * (ms - pl[2].APValue - 0.508065).Cosine(); + qb += 0.00000362 * (5.0 * ms - 4.0 * pl[2].APValue - 1.81877).Cosine(); + qb += 0.000003283 * (4.0 * ms - 4.0 * pl[2].APValue + 1.10851).Cosine(); + qb += 0.000003074 * (2.0 * pl[4].APValue - 2.0 * pl[2].APValue - 0.962846).Cosine(); return (qa, qb, qc, qe); } @@ -2890,28 +2890,28 @@ public static (double a, double sa, double ca, double qc, double qe, double qa, double qe = qc; double qa = 0.00705 * (pl[4].APValue - pl[3].APValue - 0.85448).Cosine(); - qa = qa + 0.00607 * (2.0 * pl[4].APValue - pl[3].APValue - 3.2873).Cosine(); - qa = qa + 0.00445 * (2.0 * pl[4].APValue - 2.0 * pl[3].APValue - 3.3492).Cosine(); - qa = qa + 0.00388 * (ms - 2.0 * pl[3].APValue + 0.35771).Cosine(); - qa = qa + 0.00238 * (ms - pl[3].APValue + 0.61256).Cosine(); - qa = qa + 0.00204 * (2.0 * ms - 3.0 * pl[3].APValue + 2.7688).Cosine(); - qa = qa + 0.00177 * (3.0 * pl[3].APValue - pl[2].APValue - 1.0053).Cosine(); - qa = qa + 0.00136 * (2.0 * ms - 4.0 * pl[3].APValue + 2.6894).Cosine(); - qa = qa + 0.00104 * (pl[4].APValue + 0.30749).Cosine(); + qa += 0.00607 * (2.0 * pl[4].APValue - pl[3].APValue - 3.2873).Cosine(); + qa += 0.00445 * (2.0 * pl[4].APValue - 2.0 * pl[3].APValue - 3.3492).Cosine(); + qa += 0.00388 * (ms - 2.0 * pl[3].APValue + 0.35771).Cosine(); + qa += 0.00238 * (ms - pl[3].APValue + 0.61256).Cosine(); + qa += 0.00204 * (2.0 * ms - 3.0 * pl[3].APValue + 2.7688).Cosine(); + qa += 0.00177 * (3.0 * pl[3].APValue - pl[2].APValue - 1.0053).Cosine(); + qa += 0.00136 * (2.0 * ms - 4.0 * pl[3].APValue + 2.6894).Cosine(); + qa += 0.00104 * (pl[4].APValue + 0.30749).Cosine(); double qb = 0.000053227 * (pl[4].APValue - pl[3].APValue + 0.717864).Cosine(); - qb = qb + 0.000050989 * (2.0 * pl[4].APValue - 2.0 * pl[3].APValue - 1.77997).Cosine(); - qb = qb + 0.000038278 * (2.0 * pl[4].APValue - pl[3].APValue - 1.71617).Cosine(); - qb = qb + 0.000015996 * (ms - pl[3].APValue - 0.969618).Cosine(); - qb = qb + 0.000014764 * (2.0 * ms - 3.0 * pl[3].APValue + 1.19768).Cosine(); - qb = qb + 0.000008966 * (pl[4].APValue - 2.0 * pl[3].APValue + 0.761225).Cosine(); - qb = qb + 0.000007914 * (3.0 * pl[4].APValue - 2.0 * pl[3].APValue - 2.43887).Cosine(); - qb = qb + 0.000007004 * (2.0 * pl[4].APValue - 3.0 * pl[3].APValue - 1.79573).Cosine(); - qb = qb + 0.00000662 * (ms - 2.0 * pl[3].APValue + 1.97575).Cosine(); - qb = qb + 0.00000493 * (3.0 * pl[4].APValue - 3.0 * pl[3].APValue - 1.33069).Cosine(); - qb = qb + 0.000004693 * (3.0 * ms - 5.0 * pl[3].APValue + 3.32665).Cosine(); - qb = qb + 0.000004571 * (2.0 * ms - 4.0 * pl[3].APValue + 4.27086).Cosine(); - qb = qb + 0.000004409 * (3.0 * pl[4].APValue - pl[3].APValue - 2.02158).Cosine(); + qb += 0.000050989 * (2.0 * pl[4].APValue - 2.0 * pl[3].APValue - 1.77997).Cosine(); + qb += 0.000038278 * (2.0 * pl[4].APValue - pl[3].APValue - 1.71617).Cosine(); + qb += 0.000015996 * (ms - pl[3].APValue - 0.969618).Cosine(); + qb += 0.000014764 * (2.0 * ms - 3.0 * pl[3].APValue + 1.19768).Cosine(); + qb += 0.000008966 * (pl[4].APValue - 2.0 * pl[3].APValue + 0.761225).Cosine(); + qb += 0.000007914 * (3.0 * pl[4].APValue - 2.0 * pl[3].APValue - 2.43887).Cosine(); + qb += 0.000007004 * (2.0 * pl[4].APValue - 3.0 * pl[3].APValue - 1.79573).Cosine(); + qb += 0.00000662 * (ms - 2.0 * pl[3].APValue + 1.97575).Cosine(); + qb += 0.00000493 * (3.0 * pl[4].APValue - 3.0 * pl[3].APValue - 1.33069).Cosine(); + qb += 0.000004693 * (3.0 * ms - 5.0 * pl[3].APValue + 3.32665).Cosine(); + qb += 0.000004571 * (2.0 * ms - 4.0 * pl[3].APValue + 4.27086).Cosine(); + qb += 0.000004409 * (3.0 * pl[4].APValue - pl[3].APValue - 2.02158).Cosine(); return (a, sa, ca, qc, qe, qa, qb); } @@ -2979,8 +2979,8 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, double ur = (3.0 * j8).Cosine(); qc = 0.007581 * u7 - 0.007986 * u8a - 0.148811 * u9; - qc = qc - (0.814181 - (0.01815 - 0.016714 * j1) * j1) * u5; - qc = qc - (0.010497 - (0.160906 - 0.0041 * j1) * j1) * u6; + qc -= (0.814181 - (0.01815 - 0.016714 * j1) * j1) * u5; + qc -= (0.010497 - (0.160906 - 0.0041 * j1) * j1) * u6; qc = qc - 0.015208 * ud - 0.006339 * uf - 0.006244 * u1; qc = qc - 0.0165 * ub * u1 - 0.040786 * ub; qc = qc + (0.008931 + 0.002728 * j1) * u9 * u1 - 0.005775 * ud * u1; @@ -3009,20 +3009,20 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, qd = qd + 561.0 * ue * u4 + 343.0 * ug * u4 + 469.0 * uq * u4 - 242.0 * ur * u4; qd = qd - 205.0 * u9 * ui + 262.0 * ud * ui + 208.0 * ua * uj - 271.0 * ue * uj; qd = qd - 382.0 * ue * uk - 376.0 * ud * ul; - qd = qd * 0.0000001; + qd *= 0.0000001; vk = (0.077108 + (0.007186 - 0.001533 * j1) * j1) * u5; - vk = vk - 0.007075 * u9; - vk = vk + (0.045803 - (0.014766 + 0.000536 * j1) * j1) * u6; + vk -= 0.007075 * u9; + vk += (0.045803 - (0.014766 + 0.000536 * j1) * j1) * u6; vk = vk - 0.072586 * u2 - 0.075825 * u9 * u1 - 0.024839 * ub * u1; vk = vk - 0.008631 * ud * u1 - 0.150383 * ua * u2; vk = vk + 0.026897 * uc * u2 + 0.010053 * ue * u2; vk = vk - (0.013597 + 0.001719 * j1) * u9 * u3 + 0.011981 * ub * u4; - vk = vk - (0.007742 - 0.001517 * j1) * ua * u3; - vk = vk + (0.013586 - 0.001375 * j1) * uc * u3; - vk = vk - (0.013667 - 0.001239 * j1) * u9 * u4; - vk = vk + (0.014861 + 0.001136 * j1) * ua * u4; - vk = vk - (0.013064 + 0.001628 * j1) * uc * u4; + vk -= (0.007742 - 0.001517 * j1) * ua * u3; + vk += (0.013586 - 0.001375 * j1) * uc * u3; + vk -= (0.013667 - 0.001239 * j1) * u9 * u4; + vk += (0.014861 + 0.001136 * j1) * ua * u4; + vk -= (0.013064 + 0.001628 * j1) * uc * u4; qe = qc - (vk.ToRadians() / planet.Value4); qf = 572.0 * u5 - 1590.0 * ub * u2 + 2933.0 * u6 - 647.0 * ud * u2; @@ -3034,8 +3034,8 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, qf = qf + 441.0 * ub * u4 + 2138.0 * ua * u1 + 296.0 * uc * u4 - 999.0 * uc * u1; qf = qf + 211.0 * ue * u4 - 642.0 * ue * u1 - 427.0 * u9 * ui - 325.0 * ug * u1; qf = qf + 398.0 * ud * ui - 890.0 * u2 + 344.0 * ua * uj + 2206.0 * u9 * u2; - qf = qf - 427.0 * ue * uj; - qf = qf * 0.000001; + qf -= 427.0 * ue * uj; + qf *= 0.000001; qg = 0.000747 * ua * u1 + 0.001069 * ua * u2 + 0.002108 * ub * u3; qg = qg + 0.001261 * uc * u3 + 0.001236 * ub * u4 - 0.002075 * uc * u4; @@ -3045,8 +3045,8 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, } qc = (0.331364 - (0.010281 + 0.004692 * j1) * j1) * u5; - qc = qc + (0.003228 - (0.064436 - 0.002075 * j1) * j1) * u6; - qc = qc - (0.003083 + (0.000275 - 0.000489 * j1) * j1) * u7; + qc += (0.003228 - (0.064436 - 0.002075 * j1) * j1) * u6; + qc -= (0.003083 + (0.000275 - 0.000489 * j1) * j1) * u7; qc = qc + 0.002472 * u8a + 0.013619 * u9 + 0.018472 * ub; qc = qc + 0.006717 * ud + 0.002775 * uf + 0.006417 * ub * u1; qc = qc + (0.007275 - 0.001253 * j1) * u9 * u1 + 0.002439 * ud * u1; @@ -3067,10 +3067,10 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, qd = qd + 148.0 * ue * u3 + (99.0 * j1 - 956.0) * u9 * u4 + 490.0 * ub * u4; qd = qd + 158.0 * ud * u4 + 179.0 * u4 + (1024.0 + 75.0 * j1) * ua * u4; qd = qd - 437.0 * uc * u4 - 132.0 * ue * u4; - qd = qd * 0.0000001; + qd *= 0.0000001; vk = (0.007192 - 0.003147 * j1) * u5 - 0.004344 * u1; - vk = vk + (j1 * (0.000197 * j1 - 0.000675) - 0.020428) * u6; + vk += (j1 * (0.000197 * j1 - 0.000675) - 0.020428) * u6; vk = vk + 0.034036 * ua * u1 + (0.007269 + 0.000672 * j1) * u9 * u1; vk = vk + 0.005614 * uc * u1 + 0.002964 * ue * u1 + 0.037761 * u9 * u2; vk = vk + 0.006158 * ub * u2 - 0.006603 * ua * u2 - 0.005356 * u9 * u3; @@ -3081,8 +3081,8 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, qf = 205.0 * ua - 263.0 * u6 + 693.0 * uc + 312.0 * ue + 147.0 * ug + 299.0 * u9 * u1; qf = qf + 181.0 * uc * u1 + 204.0 * ub * u2 + 111.0 * ud * u2 - 337.0 * ua * u2; - qf = qf - 111.0 * uc * u2; - qf = qf * 0.000001; + qf -= 111.0 * uc * u2; + qf *= 0.000001; return (qa, qb, qc, qd, qe, qf, qg); } @@ -3106,14 +3106,14 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, qc = qc.ToRadians(); vk = 0.024039 * vj - 0.025303 * uu + 0.006206 * uv; - vk = vk - 0.005992 * uw; + vk -= 0.005992 * uw; qe = qc - (vk.ToRadians() / planet.Value4); qd = 4389.0 * vj + 1129.0 * uv + 4262.0 * uu + 1089.0 * uw; - qd = qd * 0.0000001; + qd *= 0.0000001; qf = 8189.0 * uu - 817.0 * vj + 781.0 * uw; - qf = qf * 0.000001; + qf *= 0.000001; double vd = (2.0 * jc).Sine(); double ve = (2.0 * jc).Cosine(); @@ -3127,7 +3127,7 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, qb = -40596.0 + 4992.0 * ja.Cosine() + 2744.0 * jb.Cosine(); qb = qb + 2044.0 * jc.Cosine() + 1051.0 * ve; - qb = qb * 0.000001; + qb *= 0.000001; return (qa, qb, qc, qd, qe, qf, qg); } @@ -3141,21 +3141,21 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, qc = qc.ToRadians(); vk = 0.120303 * vj + 0.006197 * uv; - vk = vk + (0.019472 - 0.000947 * j1) * uu; + vk += (0.019472 - 0.000947 * j1) * uu; qe = qc - (vk.ToRadians() / planet.Value4); qd = (163.0 * j1 - 3349.0) * vj + 20981.0 * uu + 1311.0 * uw; - qd = qd * 0.0000001; + qd *= 0.0000001; qf = -0.003825 * uu; qa = (-0.038581 + (0.002031 - 0.00191 * j1) * j1) * (j4 + jb).Cosine(); - qa = qa + (0.010122 - 0.000988 * j1) * (j4 + jb).Sine(); + qa += (0.010122 - 0.000988 * j1) * (j4 + jb).Sine(); double a = (0.034964 - (0.001038 - 0.000868 * j1) * j1) * (2.0 * j4 + jb).Cosine(); qa = a + qa + 0.005594 * (j4 + 3.0 * jc).Sine() - 0.014808 * ja.Sine(); qa = qa - 0.005794 * jb.Sine() + 0.002347 * jb.Cosine(); qa = qa + 0.009872 * jc.Sine() + 0.008803 * (2.0 * jc).Sine(); - qa = qa - 0.004308 * (3.0 * jc).Sine(); + qa -= 0.004308 * (3.0 * jc).Sine(); double ux = jb.Sine(); double uy = jb.Cosine(); @@ -3164,15 +3164,15 @@ public static (double qa, double qb, double qc, double qd, double qe, double qf, double vb = (2.0 * j4).Sine(); double vc = (2.0 * j4).Cosine(); qg = (0.000458 * ux - 0.000642 * uy - 0.000517 * (4.0 * jc).Cosine()) * uz; - qg = qg - (0.000347 * ux + 0.000853 * uy + 0.000517 * (4.0 * jb).Sine()) * va; - qg = qg + 0.000403 * ((2.0 * jc).Cosine() * vb + (2.0 * jc).Sine() * vc); + qg -= (0.000347 * ux + 0.000853 * uy + 0.000517 * (4.0 * jb).Sine()) * va; + qg += 0.000403 * ((2.0 * jc).Cosine() * vb + (2.0 * jc).Sine() * vc); qg = qg.ToRadians(); qb = -25948.0 + 4985.0 * ja.Cosine() - 1230.0 * va + 3354.0 * uy; qb = qb + 904.0 * (2.0 * jc).Cosine() + 894.0 * (jc.Cosine() - (3.0 * jc).Cosine()); - qb = qb + (5795.0 * va - 1165.0 * uz + 1388.0 * vc) * ux; - qb = qb + (1351.0 * va + 5702.0 * uz + 1388.0 * vb) * uy; - qb = qb * 0.000001; + qb += (5795.0 * va - 1165.0 * uz + 1388.0 * vc) * ux; + qb += (1351.0 * va + 5702.0 * uz + 1388.0 * vb) * uy; + qb *= 0.000001; return (qa, qb, qc, qd, qe, qf, qg); } @@ -3350,7 +3350,7 @@ public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLo double c = (na + 275.05 - 2.3 * t).ToRadians(); double s4 = c.Sine(); ml = ml + 0.000233 * s1 + s3 + 0.001964 * s2; - ms = ms - 0.001778 * s1; + ms -= 0.001778 * s1; md = md + 0.000817 * s1 + s3 + 0.002541 * s2; mf = mf + s3 - 0.024691 * s2 - 0.004328 * s4; me1 = me1 + 0.002011 * s1 + s3 + 0.001964 * s2; @@ -3367,7 +3367,7 @@ public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLo double l = 6.28875 * md.Sine() + 1.274018 * (2.0 * me1 - md).Sine(); l = l + 0.658309 * (2.0 * me1).Sine() + 0.213616 * (2.0 * md).Sine(); l = l - e * 0.185596 * ms.Sine() - 0.114336 * (2.0 * mf).Sine(); - l = l + 0.058793 * (2.0 * (me1 - md)).Sine(); + l += 0.058793 * (2.0 * (me1 - md)).Sine(); l = l + 0.057212 * e * (2.0 * me1 - ms - md).Sine() + 0.05332 * (2.0 * me1 + md).Sine(); l = l + 0.045874 * e * (2.0 * me1 - ms).Sine() + 0.041024 * e * (md - ms).Sine(); l = l - 0.034718 * me1.Sine() - e * 0.030465 * (ms + md).Sine(); @@ -3385,13 +3385,13 @@ public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLo l = l - 0.001773 * (md + 2.0 * (me1 - mf)).Sine() - 0.001595 * (2.0 * (mf + me1)).Sine(); l = l + e * 0.00122 * (4.0 * me1 - ms - md).Sine() - 0.00111 * (2.0 * (md + mf)).Sine(); l = l + 0.000892 * (md - 3.0 * me1).Sine() - e * 0.000811 * (ms + md + 2.0 * me1).Sine(); - l = l + e * 0.000761 * (4.0 * me1 - ms - 2.0 * md).Sine(); - l = l + e2 * 0.000704 * (md - 2.0 * (ms + me1)).Sine(); - l = l + e * 0.000693 * (ms - 2.0 * (md - me1)).Sine(); - l = l + e * 0.000598 * (2.0 * (me1 - mf) - ms).Sine(); + l += e * 0.000761 * (4.0 * me1 - ms - 2.0 * md).Sine(); + l += e2 * 0.000704 * (md - 2.0 * (ms + me1)).Sine(); + l += e * 0.000693 * (ms - 2.0 * (md - me1)).Sine(); + l += e * 0.000598 * (2.0 * (me1 - mf) - ms).Sine(); l = l + 0.00055 * (md + 4.0 * me1).Sine() + 0.000538 * (4.0 * md).Sine(); l = l + e * 0.000521 * (4.0 * me1 - ms).Sine() + 0.000486 * (2.0 * md - me1).Sine(); - l = l + e2 * 0.000717 * (md - 2.0 * ms).Sine(); + l += e2 * 0.000717 * (md - 2.0 * ms).Sine(); double mm = Unwind(ml + l.ToRadians()); // Latitude-specific @@ -3402,9 +3402,9 @@ public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLo g = g + 0.009267 * (2.0 * me1 + md - mf).Sine() + 0.008823 * (2.0 * md - mf).Sine(); g = g + e * 0.008247 * (2.0 * me1 - ms - mf).Sine() + 0.004323 * (2.0 * (me1 - md) - mf).Sine(); g = g + 0.0042 * (2.0 * me1 + mf + md).Sine() + e * 0.003372 * (mf - ms - 2.0 * me1).Sine(); - g = g + e * 0.002472 * (2.0 * me1 + mf - ms - md).Sine(); - g = g + e * 0.002222 * (2.0 * me1 + mf - ms).Sine(); - g = g + e * 0.002072 * (2.0 * me1 - mf - ms - md).Sine(); + g += e * 0.002472 * (2.0 * me1 + mf - ms - md).Sine(); + g += e * 0.002222 * (2.0 * me1 + mf - ms).Sine(); + g += e * 0.002072 * (2.0 * me1 - mf - ms - md).Sine(); g = g + e * 0.001877 * (mf - ms + md).Sine() + 0.001828 * (4.0 * me1 - mf - md).Sine(); g = g - e * 0.001803 * (mf + ms).Sine() - 0.00175 * (3.0 * mf).Sine(); g = g + e * 0.00157 * (md - ms - mf).Sine() - 0.001487 * (mf + me1).Sine(); @@ -3413,12 +3413,12 @@ public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLo g = g + 0.001106 * (mf + 3.0 * md).Sine() + 0.00102 * (4.0 * me1 - mf).Sine(); g = g + 0.000833 * (mf + 4.0 * me1 - md).Sine() + 0.000781 * (md - 3.0 * mf).Sine(); g = g + 0.00067 * (mf + 4.0 * me1 - 2.0 * md).Sine() + 0.000606 * (2.0 * me1 - 3.0 * mf).Sine(); - g = g + 0.000597 * (2.0 * (me1 + md) - mf).Sine(); + g += 0.000597 * (2.0 * (me1 + md) - mf).Sine(); g = g + e * 0.000492 * (2.0 * me1 + md - ms - mf).Sine() + 0.00045 * (2.0 * (md - me1) - mf).Sine(); g = g + 0.000439 * (3.0 * md - mf).Sine() + 0.000423 * (mf + 2.0 * (me1 + md)).Sine(); g = g + 0.000422 * (2.0 * me1 - mf - 3.0 * md).Sine() - e * 0.000367 * (ms + mf + 2.0 * me1 - md).Sine(); g = g - e * 0.000353 * (ms + mf + 2.0 * me1).Sine() + 0.000331 * (mf + 4.0 * me1).Sine(); - g = g + e * 0.000317 * (2.0 * me1 + mf - ms + md).Sine(); + g += e * 0.000317 * (2.0 * me1 + mf - ms + md).Sine(); g = g + e2 * 0.000306 * (2.0 * (me1 - ms) - mf).Sine() - 0.000283 * (md + 3.0 * mf).Sine(); double w1 = 0.0004664 * na.Cosine(); double w2 = 0.0000754 * c.Cosine(); @@ -3428,7 +3428,7 @@ public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLo double pm = 0.950724 + 0.051818 * md.Cosine() + 0.009531 * (2.0 * me1 - md).Cosine(); pm = pm + 0.007843 * (2.0 * me1).Cosine() + 0.002824 * (2.0 * md).Cosine(); pm = pm + 0.000857 * (2.0 * me1 + md).Cosine() + e * 0.000533 * (2.0 * me1 - ms).Cosine(); - pm = pm + e * 0.000401 * (2.0 * me1 - md - ms).Cosine(); + pm += e * 0.000401 * (2.0 * me1 - md - ms).Cosine(); pm = pm + e * 0.00032 * (md - ms).Cosine() - 0.000271 * me1.Cosine(); pm = pm - e * 0.000264 * (ms + md).Cosine() - 0.000198 * (2.0 * mf - md).Cosine(); pm = pm + 0.000173 * (3.0 * md).Cosine() + 0.000167 * (4.0 * me1 - md).Cosine(); @@ -3440,7 +3440,7 @@ public static (double moonLongDeg, double moonLatDeg, double moonHorPara) MoonLo pm = pm - 0.000033 * (3.0 * md - 2.0 * me1).Cosine() - 0.00003 * (md + me1).Cosine(); pm = pm - 0.000029 * (2.0 * (mf - me1)).Cosine() - e * 0.000029 * (2.0 * md + ms).Cosine(); pm = pm + e2 * 0.000026 * (2.0 * (me1 - ms)).Cosine() - 0.000023 * (2.0 * (mf - me1) + md).Cosine(); - pm = pm + e * 0.000019 * (4.0 * me1 - ms - md).Cosine(); + pm += e * 0.000019 * (4.0 * me1 - ms - md).Cosine(); double moonLongDeg = Degrees(mm); double moonLatDeg = Degrees(bm); @@ -3463,7 +3463,7 @@ public static double MoonPhase(double lh, double lm, double ls, int ds, int zc, double d = cd.ACosine(); double sd = d.Sine(); double i = 0.1468 * sd * (1.0 - 0.0549 * MoonMeanAnomaly(lh, lm, ls, ds, zc, dy, mn, yr).Sine()); - i = i / (1.0 - 0.0167 * SunMeanAnomaly(lh, lm, ls, ds, zc, dy, mn, yr).Sine()); + i /= (1.0 - 0.0167 * SunMeanAnomaly(lh, lm, ls, ds, zc, dy, mn, yr).Sine()); i = 3.141592654 - d - i.ToRadians(); double k = (1.0 + i.Cosine()) / 2.0; @@ -3547,7 +3547,7 @@ public static double NewMoon(int ds, int zc, double dy, int mn, int yr) double ni = nmfmResult1.a; double nf = nmfmResult1.b; t = tf; - k = k + 0.5; + k += 0.5; (double a, double b, double f) nmfmResult2 = NewMoonFullMoon_L6855(k, t); return ni + 2415020.0 + nf; @@ -3578,7 +3578,7 @@ public static double FullMoon(int ds, int zc, double dy, int mn, int yr) double t = tn; (double a, double b, double f) nmfnResult1 = NewMoonFullMoon_L6855(k, t); t = tf; - k = k + 0.5; + k += 0.5; (double a, double b, double f) nmfnResult2 = NewMoonFullMoon_L6855(k, t); double fi = nmfnResult2.a; double ff = nmfnResult2.b; @@ -3600,7 +3600,7 @@ public static (double a, double b, double f) NewMoonFullMoon_L6855(double k, dou double a = k / 12.36886; double a1 = 359.2242 + 360.0 * Fract(a) - (0.0000333 + 0.00000347 * t) * t2; double a2 = 306.0253 + 360.0 * Fract(k / 0.9330851); - a2 = a2 + (0.0107306 + 0.00001236 * t) * t2; + a2 += (0.0107306 + 0.00001236 * t) * t2; a = k / 0.9214926; double f = 21.2964 + 360.0 * Fract(a) - (0.0016528 + 0.00000239 * t) * t2; a1 = UnwindDeg(a1); @@ -3615,12 +3615,12 @@ public static (double a, double b, double f) NewMoonFullMoon_L6855(double k, dou dd = dd + 0.0104 * (2.0 * f).Sine() - 0.0051 * (a1 + a2).Sine(); dd = dd - 0.0074 * (a1 - a2).Sine() + 0.0004 * (2.0 * f + a1).Sine(); dd = dd - 0.0004 * (2.0 * f - a1).Sine() - 0.0006 * (2.0 * f + a2).Sine() + 0.001 * (2.0 * f - a2).Sine(); - dd = dd + 0.0005 * (a1 + 2.0 * a2).Sine(); + dd += 0.0005 * (a1 + 2.0 * a2).Sine(); double e1 = e.Floor(); b = b + dd + (e - e1); double b1 = b.Floor(); a = e1 + b1; - b = b - b1; + b -= b1; return (a, b, f); } @@ -3784,7 +3784,7 @@ public static double MoonRiseLCT(double dy, int mn, int yr, int ds, int zc, doub if (!EGstUt(x, 0.0, 0.0, gdy, gmn, gyr).Equals(PAWarningFlag.OK)) if (Math.Abs(g1 - ut) > 0.5) - ut = ut + 23.93447; + ut += 23.93447; ut = UTDayAdjust(ut, g1); lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); @@ -3799,7 +3799,7 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, { if (!EGstUt(x, 0.0, 0.0, gdy, gmn, gyr).Equals(PAWarningFlag.OK)) if (Math.Abs(g1 - ut) > 0.5) - ut = ut + 23.93447; + ut += 23.93447; ut = UTDayAdjust(ut, g1); double lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); @@ -3809,7 +3809,7 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, gdy = LocalCivilTimeGreenwichDay(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gmn = LocalCivilTimeGreenwichMonth(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gyr = LocalCivilTimeGreenwichYear(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - ut = ut - 24.0 * (ut / 24.0).Floor(); + ut -= 24.0 * (ut / 24.0).Floor(); return (ut, lct, dy1, mn1, yr1, gdy, gmn, gyr); } @@ -3904,7 +3904,7 @@ public static (double dy1, int mn1, int yr1) MoonRiseLcDMY(double dy, int mn, in if (!EGstUt(x, 0.0, 0.0, gdy, gmn, gyr).Equals(PAWarningFlag.OK)) if (Math.Abs(g1 - ut) > 0.5) - ut = ut + 23.93447; + ut += 23.93447; ut = UTDayAdjust(ut, g1); dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); @@ -3921,7 +3921,7 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, { if (!EGstUt(x, 0.0, 0.0, gdy, gmn, gyr).Equals(PAWarningFlag.OK)) if (Math.Abs(g1 - ut) > 0.5) - ut = ut + 23.93447; + ut += 23.93447; ut = UTDayAdjust(ut, g1); double lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); @@ -3931,7 +3931,7 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, gdy = LocalCivilTimeGreenwichDay(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gmn = LocalCivilTimeGreenwichMonth(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gyr = LocalCivilTimeGreenwichYear(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - ut = ut - 24.0 * (ut / 24.0).Floor(); + ut -= 24.0 * (ut / 24.0).Floor(); return (ut, lct, dy1, mn1, yr1, gdy, gmn, gyr); } @@ -4029,7 +4029,7 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, { if (!EGstUt(x, 0.0, 0.0, gdy, gmn, gyr).Equals(PAWarningFlag.OK)) if (Math.Abs(g1 - ut) > 0.5) - ut = ut + 23.93447; + ut += 23.93447; ut = UTDayAdjust(ut, g1); double lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); @@ -4039,7 +4039,7 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, gdy = LocalCivilTimeGreenwichDay(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gmn = LocalCivilTimeGreenwichMonth(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gyr = LocalCivilTimeGreenwichYear(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - ut = ut - 24.0 * (ut / 24.0).Floor(); + ut -= 24.0 * (ut / 24.0).Floor(); return (ut, lct, dy1, mn1, yr1, gdy, gmn, gyr); } @@ -4127,7 +4127,7 @@ public static double MoonSetLCT(double dy, int mn, int yr, int ds, int zc, doubl if (!EGstUt(x, 0.0, 0.0, gdy, gmn, gyr).Equals(PAWarningFlag.OK)) if (Math.Abs(g1 - ut) > 0.5) - ut = ut + 23.93447; + ut += 23.93447; ut = UTDayAdjust(ut, g1); lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); @@ -4142,7 +4142,7 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, { if (!EGstUt(x, 0.0, 0.0, gdy, gmn, gyr).Equals(PAWarningFlag.OK)) if (Math.Abs(g1 - ut) > 0.5) - ut = ut + 23.93447; + ut += 23.93447; ut = UTDayAdjust(ut, g1); double lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); @@ -4152,7 +4152,7 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, gdy = LocalCivilTimeGreenwichDay(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gmn = LocalCivilTimeGreenwichMonth(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gyr = LocalCivilTimeGreenwichYear(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - ut = ut - 24.0 * (ut / 24.0).Floor(); + ut -= 24.0 * (ut / 24.0).Floor(); return (ut, lct, dy1, mn1, yr1, gdy, gmn, gyr); } @@ -4246,7 +4246,7 @@ public static (double dy1, int mn1, int yr1) MoonSetLcDMY(double dy, int mn, int if (!EGstUt(x, 0.0, 0.0, gdy, gmn, gyr).Equals(PAWarningFlag.OK)) if (Math.Abs(g1 - ut) > 0.5) - ut = ut + 23.93447; + ut += 23.93447; ut = UTDayAdjust(ut, g1); dy1 = UniversalTime_LocalCivilDay(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); @@ -4263,7 +4263,7 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, { if (!EGstUt(x, 0.0, 0.0, gdy, gmn, gyr).Equals(PAWarningFlag.OK)) if (Math.Abs(g1 - ut) > 0.5) - ut = ut + 23.93447; + ut += 23.93447; ut = UTDayAdjust(ut, g1); double lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); @@ -4273,7 +4273,7 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, gdy = LocalCivilTimeGreenwichDay(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gmn = LocalCivilTimeGreenwichMonth(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gyr = LocalCivilTimeGreenwichYear(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - ut = ut - 24.0 * (ut / 24.0).Floor(); + ut -= 24.0 * (ut / 24.0).Floor(); return (ut, lct, dy1, mn1, yr1, gdy, gmn, gyr); } @@ -4372,7 +4372,7 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, { if (!EGstUt(x, 0.0, 0.0, gdy, gmn, gyr).Equals(PAWarningFlag.OK)) if (Math.Abs(g1 - ut) > 0.5) - ut = ut + 23.93447; + ut += 23.93447; ut = UTDayAdjust(ut, g1); double lct = UniversalTimeToLocalCivilTime(ut, 0.0, 0.0, ds, zc, gdy, gmn, gyr); @@ -4382,7 +4382,7 @@ public static (double ut, double lct, double dy1, int mn1, int yr1, double gdy, gdy = LocalCivilTimeGreenwichDay(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gmn = LocalCivilTimeGreenwichMonth(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); gyr = LocalCivilTimeGreenwichYear(lct, 0.0, 0.0, ds, zc, dy1, mn1, yr1); - ut = ut - 24.0 * (ut / 24.0).Floor(); + ut -= 24.0 * (ut / 24.0).Floor(); return (ut, lct, dy1, mn1, yr1, gdy, gmn, gyr); } @@ -4427,7 +4427,7 @@ public static string LunarEclipseOccurrence(int ds, int zc, double dy, int mn, i double t = tn; (double f, double dd, double e1, double b1, double a, double b) l6855result1 = LunarEclipseOccurrence_L6855(t, k); t = tf; - k = k + 0.5; + k += 0.5; (double f, double dd, double e1, double b1, double a, double b) l6855result2 = LunarEclipseOccurrence_L6855(t, k); double fb = l6855result2.f; @@ -4462,7 +4462,7 @@ public static (double f, double dd, double e1, double b1, double a, double b) Lu double a = k / 12.36886; double a1 = 359.2242 + 360.0 * FPart(a) - (0.0000333 + 0.00000347 * t) * t2; double a2 = 306.0253 + 360.0 * FPart(k / 0.9330851); - a2 = a2 + (0.0107306 + 0.00001236 * t) * t2; + a2 += (0.0107306 + 0.00001236 * t) * t2; a = k / 0.9214926; double f = 21.2964 + 360.0 * FPart(a) - (0.0016528 + 0.00000239 * t) * t2; a1 = UnwindDeg(a1); @@ -4477,12 +4477,12 @@ public static (double f, double dd, double e1, double b1, double a, double b) Lu dd = dd + 0.0104 * (2.0 * f).Sine() - 0.0051 * (a1 + a2).Sine(); dd = dd - 0.0074 * (a1 - a2).Sine() + 0.0004 * (2.0 * f + a1).Sine(); dd = dd - 0.0004 * (2.0 * f - a1).Sine() - 0.0006 * (2.0 * f + a2).Sine() + 0.001 * (2.0 * f - a2).Sine(); - dd = dd + 0.0005 * (a1 + 2.0 * a2).Sine(); + dd += 0.0005 * (a1 + 2.0 * a2).Sine(); double e1 = e.Floor(); b = b + dd + (e - e1); double b1 = b.Floor(); a = e1 + b1; - b = b - b1; + b -= b1; return (f, dd, e1, b1, a, b); } @@ -4519,14 +4519,14 @@ public static double UTMaxLunarEclipse(double dy, int mn, int yr, int ds, int zc double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) - sb = sb + tp; + sb += tp; double xh = utfm; double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); double dm = mz - my; if (dm < 0.0) - dm = dm + tp; + dm += tp; double lj = (dm - sb) / 2.0; double q = 0.0; @@ -4534,10 +4534,10 @@ public static double UTMaxLunarEclipse(double dy, int mn, int yr, int ds, int zc ut = x0 - 0.13851852; double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); + sr += (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; - by = by - q; - bz = bz - q; + by -= q; + bz -= q; double p3 = 0.00004263; double zh = (sr - mr) / lj; double tc = x0 + zh; @@ -4593,14 +4593,14 @@ public static double UTFirstContactLunarEclipse(double dy, int mn, int yr, int d double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) - sb = sb + tp; + sb += tp; double xh = utfm; double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); double dm = mz - my; if (dm < 0.0) - dm = dm + tp; + dm += tp; double lj = (dm - sb) / 2.0; double q = 0.0; @@ -4608,10 +4608,10 @@ public static double UTFirstContactLunarEclipse(double dy, int mn, int yr, int d ut = x0 - 0.13851852; double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); + sr += (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; - by = by - q; - bz = bz - q; + by -= q; + bz -= q; double p3 = 0.00004263; double zh = (sr - mr) / lj; double tc = x0 + zh; @@ -4636,7 +4636,7 @@ public static double UTFirstContactLunarEclipse(double dy, int mn, int yr, int d double z6 = z1 - zd; if (z6 < 0.0) - z6 = z6 + 24.0; + z6 += 24.0; return z6; } @@ -4673,14 +4673,14 @@ public static double UTLastContactLunarEclipse(double dy, int mn, int yr, int ds double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) - sb = sb + tp; + sb += tp; double xh = utfm; double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); double dm = mz - my; if (dm < 0.0) - dm = dm + tp; + dm += tp; double lj = (dm - sb) / 2.0; double q = 0.0; @@ -4688,10 +4688,10 @@ public static double UTLastContactLunarEclipse(double dy, int mn, int yr, int ds ut = x0 - 0.13851852; double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); + sr += (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; - by = by - q; - bz = bz - q; + by -= q; + bz -= q; double p3 = 0.00004263; double zh = (sr - mr) / lj; double tc = x0 + zh; @@ -4750,14 +4750,14 @@ public static double UTStartUmbraLunarEclipse(double dy, int mn, int yr, int ds, double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) - sb = sb + tp; + sb += tp; double xh = utfm; double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); double dm = mz - my; if (dm < 0.0) - dm = dm + tp; + dm += tp; double lj = (dm - sb) / 2.0; double q = 0.0; @@ -4765,10 +4765,10 @@ public static double UTStartUmbraLunarEclipse(double dy, int mn, int yr, int ds, ut = x0 - 0.13851852; double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); + sr += (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; - by = by - q; - bz = bz - q; + by -= q; + bz -= q; double p3 = 0.00004263; double zh = (sr - mr) / lj; double tc = x0 + zh; @@ -4805,7 +4805,7 @@ public static double UTStartUmbraLunarEclipse(double dy, int mn, int yr, int ds, double z8 = z1 - zd; if (z8 < 0.0) - z8 = z8 + 24.0; + z8 += 24.0; return z8; } @@ -4842,14 +4842,14 @@ public static double UTEndUmbraLunarEclipse(double dy, int mn, int yr, int ds, i double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) - sb = sb + tp; + sb += tp; double xh = utfm; double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); double dm = mz - my; if (dm < 0.0) - dm = dm + tp; + dm += tp; double lj = (dm - sb) / 2.0; double q = 0.0; @@ -4857,10 +4857,10 @@ public static double UTEndUmbraLunarEclipse(double dy, int mn, int yr, int ds, i ut = x0 - 0.13851852; double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); + sr += (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; - by = by - q; - bz = bz - q; + by -= q; + bz -= q; double p3 = 0.00004263; double zh = (sr - mr) / lj; double tc = x0 + zh; @@ -4931,14 +4931,14 @@ public static double UTStartTotalLunarEclipse(double dy, int mn, int yr, int ds, double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) - sb = sb + tp; + sb += tp; double xh = utfm; double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); double dm = mz - my; if (dm < 0.0) - dm = dm + tp; + dm += tp; double lj = (dm - sb) / 2.0; double q = 0.0; @@ -4946,10 +4946,10 @@ public static double UTStartTotalLunarEclipse(double dy, int mn, int yr, int ds, ut = x0 - 0.13851852; double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); + sr += (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; - by = by - q; - bz = bz - q; + by -= q; + bz -= q; double p3 = 0.00004263; double zh = (sr - mr) / lj; double tc = x0 + zh; @@ -5033,14 +5033,14 @@ public static double UTEndTotalLunarEclipse(double dy, int mn, int yr, int ds, i double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) - sb = sb + tp; + sb += tp; double xh = utfm; double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); double dm = mz - my; if (dm < 0.0) - dm = dm + tp; + dm += tp; double lj = (dm - sb) / 2.0; double q = 0.0; @@ -5048,10 +5048,10 @@ public static double UTEndTotalLunarEclipse(double dy, int mn, int yr, int ds, i ut = x0 - 0.13851852; double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); + sr += (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; - by = by - q; - bz = bz - q; + by -= q; + bz -= q; double p3 = 0.00004263; double zh = (sr - mr) / lj; double tc = x0 + zh; @@ -5132,14 +5132,14 @@ public static double MagLunarEclipse(double dy, int mn, int yr, int ds, int zc) double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) - sb = sb + tp; + sb += tp; double xh = utfm; double x0 = xh + 1.0 - (2.0 * bz / (bz - by)); double dm = mz - my; if (dm < 0.0) - dm = dm + tp; + dm += tp; double lj = (dm - sb) / 2.0; double q = 0.0; @@ -5147,10 +5147,10 @@ public static double MagLunarEclipse(double dy, int mn, int yr, int ds, int zc) ut = x0 - 0.13851852; double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); + sr += (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); sr = sr + Math.PI - Lint((sr + Math.PI) / tp) * tp; - by = by - q; - bz = bz - q; + by -= q; + bz -= q; double p3 = 0.00004263; double zh = (sr - mr) / lj; double tc = x0 + zh; @@ -5217,7 +5217,7 @@ public static string SolarEclipseOccurrence(int ds, int zc, double dy, int mn, i (double f, double dd, double e1, double b1, double a, double b) l6855result1 = SolarEclipseOccurrence_L6855(t, k); double nb = l6855result1.f; t = tf; - k = k + 0.5; + k += 0.5; (double f, double dd, double e1, double b1, double a, double b) l6855result2 = SolarEclipseOccurrence_L6855(t, k); double df = Math.Abs(nb - 3.141592654 * Lint(nb / 3.141592654)); @@ -5250,7 +5250,7 @@ public static (double f, double dd, double e1, double b1, double a, double b) So double a = k / 12.36886; double a1 = 359.2242 + 360.0 * FPart(a) - (0.0000333 + 0.00000347 * t) * t2; double a2 = 306.0253 + 360.0 * FPart(k / 0.9330851); - a2 = a2 + (0.0107306 + 0.00001236 * t) * t2; + a2 += (0.0107306 + 0.00001236 * t) * t2; a = k / 0.9214926; double f = 21.2964 + 360.0 * FPart(a) - (0.0016528 + 0.00000239 * t) * t2; a1 = UnwindDeg(a1); @@ -5265,12 +5265,12 @@ public static (double f, double dd, double e1, double b1, double a, double b) So dd = dd + 0.0104 * (2.0 * f).Sine() - 0.0051 * (a1 + a2).Sine(); dd = dd - 0.0074 * (a1 - a2).Sine() + 0.0004 * (2.0 * f + a1).Sine(); dd = dd - 0.0004 * (2.0 * f - a1).Sine() - 0.0006 * (2.0 * f + a2).Sine() + 0.001 * (2.0 * f - a2).Sine(); - dd = dd + 0.0005 * (a1 + 2.0 * a2).Sine(); + dd += 0.0005 * (a1 + 2.0 * a2).Sine(); double e1 = e.Floor(); b = b + dd + (e - e1); double b1 = b.Floor(); a = e1 + b1; - b = b - b1; + b -= b1; return (f, dd, e1, b1, a, b); } @@ -5307,7 +5307,7 @@ public static double UTMaxSolarEclipse(double dy, int mn, int yr, int ds, int zc double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) - sb = sb + tp; + sb += tp; double xh = utnm; double x = my; @@ -5329,14 +5329,14 @@ public static double UTMaxSolarEclipse(double dy, int mn, int yr, int ds, int zc double dm = mz - my; if (dm < 0.0) - dm = dm + tp; + dm += tp; double lj = (dm - sb) / 2.0; double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); + sr += (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); x = sr; y = 0.0; tm = ut; @@ -5344,8 +5344,8 @@ public static double UTMaxSolarEclipse(double dy, int mn, int yr, int ds, int zc (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result3 = UTMaxSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); // let(_paa, _qaa, _xaa, _pbb, _qbb, _xbb, p, q) = sr = l7390result3.p; - by = by - l7390result3.q; - bz = bz - l7390result3.q; + by -= l7390result3.q; + bz -= l7390result3.q; double p3 = 0.00004263; double zh = (sr - mr) / lj; double tc = x0 + zh; @@ -5422,7 +5422,7 @@ public static double UTFirstContactSolarEclipse(double dy, int mn, int yr, int d double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) - sb = sb + tp; + sb += tp; double xh = utnm; double x = my; @@ -5444,22 +5444,22 @@ public static double UTFirstContactSolarEclipse(double dy, int mn, int yr, int d double dm = mz - my; if (dm < 0.0) - dm = dm + tp; + dm += tp; double lj = (dm - sb) / 2.0; double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); + sr += (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); x = sr; y = 0.0; tm = ut; hp = 0.00004263452 / rr; (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result3 = UTFirstContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); sr = l7390result3.p; - by = by - l7390result3.q; - bz = bz - l7390result3.q; + by -= l7390result3.q; + bz -= l7390result3.q; double p3 = 0.00004263; double zh = (sr - mr) / lj; double tc = x0 + zh; @@ -5486,7 +5486,7 @@ public static double UTFirstContactSolarEclipse(double dy, int mn, int yr, int d double z6 = z1 - zd; if (z6 < 0.0) - z6 = z6 + 24.0; + z6 += 24.0; return z6; } @@ -5540,7 +5540,7 @@ public static double UTLastContactSolarEclipse(double dy, int mn, int yr, int ds double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) - sb = sb + tp; + sb += tp; double xh = utnm; double x = my; @@ -5562,22 +5562,22 @@ public static double UTLastContactSolarEclipse(double dy, int mn, int yr, int ds double dm = mz - my; if (dm < 0.0) - dm = dm + tp; + dm += tp; double lj = (dm - sb) / 2.0; double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); + sr += (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); x = sr; y = 0.0; tm = ut; hp = 0.00004263452 / rr; (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result3 = UTLastContactSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); sr = l7390result3.p; - by = by - l7390result3.q; - bz = bz - l7390result3.q; + by -= l7390result3.q; + bz -= l7390result3.q; double p3 = 0.00004263; double zh = (sr - mr) / lj; double tc = x0 + zh; @@ -5655,7 +5655,7 @@ public static double MagSolarEclipse(double dy, int mn, int yr, int ds, int zc, double hz = MoonHP(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); if (sb < 0.0) - sb = sb + tp; + sb += tp; double xh = utnm; double x = my; @@ -5677,22 +5677,22 @@ public static double MagSolarEclipse(double dy, int mn, int yr, int ds, int zc, double dm = mz - my; if (dm < 0.0) - dm = dm + tp; + dm += tp; double lj = (dm - sb) / 2.0; double mr = my + (dm * (x0 - xh + 1.0) / 2.0); ut = x0 - 0.13851852; double rr = SunDist(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear); double sr = SunLong(ut, 0.0, 0.0, 0, 0, igday, gmonth, gyear).ToRadians(); - sr = sr + (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); + sr += (NutatLong(igday, gmonth, gyear) - 0.00569).ToRadians(); x = sr; y = 0.0; tm = ut; hp = 0.00004263452 / rr; (double paa, double qaa, double xaa, double pbb, double qbb, double xbb, double p, double q) l7390result3 = MagSolarEclipse_L7390(x, y, igday, gmonth, gyear, tm, glong, glat, hp); sr = l7390result3.p; - by = by - l7390result3.q; - bz = bz - l7390result3.q; + by -= l7390result3.q; + bz -= l7390result3.q; double p3 = 0.00004263; double zh = (sr - mr) / lj; double tc = x0 + zh; From 376c5189a7d4c2ab9abb845e8fad85b6a7d42459 Mon Sep 17 00:00:00 2001 From: Jim Carr Date: Sun, 28 Apr 2024 21:30:28 -0400 Subject: [PATCH 4/4] Updated version number, added changelog --- CHANGELOG.md | 5 +++++ PALib/PALib.csproj | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..611954f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# [1.0.4] - 2024.04.28 + +**Changed** + +* Code refactoring: compound assignments, explicit types, and removed unnecessary parentheses. diff --git a/PALib/PALib.csproj b/PALib/PALib.csproj index 9cab820..00029bb 100644 --- a/PALib/PALib.csproj +++ b/PALib/PALib.csproj @@ -4,12 +4,14 @@ enable true PracticalAstronomyDotNet - 1.0.3 + 1.0.4 Jim Carr Algorithms from "Practical Astronomy with your Calculator or Spreadsheet" - This library contains an implementation of the algorithms from the "Practical Astronomy with your Calculator or Spreadsheet" book, authored by Peter Duffet-Smith and Jonathan Zwart. + This library contains an implementation of the algorithms from the "Practical Astronomy + with your Calculator or Spreadsheet" book, authored by Peter Duffet-Smith and Jonathan + Zwart. https://github.com/jfcarr-practical-astronomy/practical-astronomy-dotnet - + \ No newline at end of file