/// <summary> /// Calculate selenographic (lunar) coordinates (sub-Earth) /// </summary> /// <returns>sub-earth longitude, sub-earth latitude, and position angle of pole</returns> 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); return(subEarthLongitude, subEarthLatitude, positionAngleOfPole); }
/// <summary> /// Calculate selenographic (lunar) coordinates (sub-Solar) /// </summary> /// <returns>sub-solar longitude, sub-solar colongitude, and sub-solar latitude</returns> 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); return(subSolarLongitude, subSolarColongitude, subSolarLatitude); }
/// <summary> /// Convert Galactic Coordinates to Equatorial Coordinates /// </summary> /// <returns>Tuple (raHours, raMinutes, raSeconds, decDegrees, decMinutes, decSeconds)</returns> 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); return(raHours, raMinutes, raSeconds, decDegrees, decMinutes, decSeconds); }
/// <summary> /// Calculate heliographic coordinates for a given Greenwich date, with a given heliographic position angle and heliographic displacement in arc minutes. /// </summary> /// <returns>heliographic longitude and heliographic latitude, in degrees</returns> 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); return(helioLongDeg, helioLatDeg); }
/// <summary> /// Calculate the angle between two celestial objects /// </summary> /// <returns>Tuple (angleDeg, angleMin, angleSec)</returns> 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; var raLong1Rad = raLong1Deg.ToRadians(); var decLat1Deg1 = PAMacros.DegreesMinutesSecondsToDecimalDegrees(decLat1Deg, decLat1Min, decLat1Sec); var 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(); var cosD = decLat1Rad.Sine() * decLat2Rad.Sine() + decLat1Rad.Cosine() * decLat2Rad.Cosine() * (raLong1Rad - raLong2Rad).Cosine(); var dRad = cosD.ACosine(); var dDeg = PAMacros.Degrees(dRad); var angleDeg = PAMacros.DecimalDegreesDegrees(dDeg); var angleMin = PAMacros.DecimalDegreesMinutes(dDeg); var angleSec = PAMacros.DecimalDegreesSeconds(dDeg); return(angleDeg, angleMin, angleSec); }
/// <summary> /// Convert Equatorial Coordinates to Ecliptic Coordinates /// </summary> /// <returns>Tuple (outEclLongDeg, outEclLongMin, outEclLongSec, outEclLatDeg, outEclLatMin, outEclLatSec)</returns> 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); return(outEclLongDeg, outEclLongMin, outEclLongSec, outEclLatDeg, outEclLatMin, outEclLatSec); }
/// <summary> /// Calculate Moon phase and position angle of bright limb. /// </summary> /// <returns> /// <para>moonPhase -- Phase of Moon, between 0 and 1, where 0 is New and 1 is Full.</para> /// <para>paBrightLimbDeg -- Position angle of the bright limb (degrees)</para> /// </returns> 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 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 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(); 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 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)); var moonPhase = Math.Round(moonPhase1, 2); var paBrightLimbDeg = Math.Round(chiDeg, 2); return(moonPhase, paBrightLimbDeg); }
/// <summary> /// Convert Ecliptic Coordinates to Equatorial Coordinates /// </summary> /// <returns>Tuple (outRAHours, outRAMinutes, outRASeconds, outDecDegrees, outDecMinutes, outDecSeconds)</returns> 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); return(outRAHours, outRAMinutes, outRASeconds, outDecDegrees, outDecMinutes, outDecSeconds); }
/// <summary> /// Calculate approximate position of a planet. /// </summary> 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); return(planetRAHour, planetRAMin, planetRASec, planetDecDeg, planetDecMin, planetDecSec); }
/// <summary> /// Calculate approximate position of the Moon. /// </summary> /// <returns> /// <para>moon_ra_hour -- Right ascension of Moon (hour part)</para> /// <para>moon_ra_min -- Right ascension of Moon (minutes part)</para> /// <para>moon_ra_sec -- Right ascension of Moon (seconds part)</para> /// <para>moon_dec_deg -- Declination of Moon (degrees part)</para> /// <para>moon_dec_min -- Declination of Moon (minutes part)</para> /// <para>moon_dec_sec -- Declination of Moon (seconds part)</para> /// </returns> 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); return(moonRAHour, moonRAMin, moonRASec, moonDecDeg, moonDecMin, moonDecSec); }
/// <summary> /// Calculate position of an elliptical comet. /// </summary> /// <returns> /// cometRAHour -- Right ascension of comet (hour part) /// cometRAMin -- Right ascension of comet (minutes part) /// cometDecDeg -- Declination of comet (degrees part) /// cometDecMin -- Declination of comet (minutes part) /// cometDistEarth -- Comet's distance from Earth (AU) /// </returns> 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 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 = 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(); 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 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 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(); 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); return(cometRAHour, cometRAMin, cometDecDeg, cometDecMin, cometDistEarth); }
/// <summary> /// Calculate several visual aspects of a planet. /// </summary> /// <returns> /// <para>distance_au -- Planet's distance from Earth, in AU.</para> /// <para>ang_dia_arcsec -- Angular diameter of the planet.</para> /// <para>phase -- Illuminated fraction of the planet.</para> /// <para>light_time_hour -- Light travel time from planet to Earth, hour part.</para> /// <para>light_time_minutes -- Light travel time from planet to Earth, minutes part.</para> /// <para>light_time_seconds -- Light travel time from planet to Earth, seconds part.</para> /// <para>pos_angle_bright_limb_deg -- Position-angle of the bright limb.</para> /// <para>approximate_magnitude -- Apparent brightness of the planet.</para> /// </returns> 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 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 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 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 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 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 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); return(distanceAU, angDiaArcsec, phase, lightTimeHour, lightTimeMinutes, lightTimeSeconds, posAngleBrightLimbDeg, approximateMagnitude); }
/// <summary> /// Calculate rising and setting times for an object. /// </summary> /// <returns>Tuple (riseSetStatus, utRiseHour, utRiseMin, utSetHour, utSetMin, azRise, azSet)</returns> 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"; 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; return(riseSetStatus, utRiseHour, utRiseMin, utSetHour, utSetMin, azRise, azSet); }
/// <summary> /// Convert Equatorial Coordinates to Galactic Coordinates /// </summary> /// <returns>Tuple (galLongDeg, galLongMin, galLongSec, galLatDeg, galLatMin, galLatSec)</returns> 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); return(galLongDeg, galLongMin, galLongSec, galLatDeg, galLatMin, galLatSec); }
/// <summary> /// Calculate orbital data for binary star. /// </summary> /// <returns> /// <para>positionAngleDeg -- Position angle (degrees)</para> /// <para>separationArcsec -- Separation of binary members (arcseconds)</para> /// </returns> public (double positionAngleDeg, double separationArcsec) BinaryStarOrbit(double greenwichDateDay, int greenwichDateMonth, int greenwichDateYear, string binaryName) { var 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(); 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 positionAngleDeg = Math.Round(thetaDeg2, 1); var separationArcsec = Math.Round(rhoArcsec, 2); return(positionAngleDeg, separationArcsec); }