public static AAS2DCoordinate SunPosition(DateTime dateTime) { var bHighPrecision = false; dateTime = dateTime.ToUniversalTime(); // NOTE: time must be converted to Universal Time //Calculate the topocentric horizontal position of the Sun AASDate dateSunCalc = new AASDate(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second, true); double JDSun = dateSunCalc.Julian + AASDynamicalTime.DeltaT(dateSunCalc.Julian) / 86400.0; double SunLong = AASSun.ApparentEclipticLongitude(JDSun, bHighPrecision); double SunLat = AASSun.ApparentEclipticLatitude(JDSun, bHighPrecision); AAS2DCoordinate Equatorial = AASCoordinateTransformation.Ecliptic2Equatorial(SunLong, SunLat, AASNutation.TrueObliquityOfEcliptic(JDSun)); double SunRad = AASEarth.RadiusVector(JDSun, bHighPrecision); AAS2DCoordinate SunTopo = AASParallax.Equatorial2Topocentric(Equatorial.X, Equatorial.Y, SunRad, RT_LONG, RT_LAT, RT_HEIGHT, JDSun); double AST = AASSidereal.ApparentGreenwichSiderealTime(dateSunCalc.Julian); double LongtitudeAsHourAngle = AASCoordinateTransformation.DegreesToHours(RT_LONG); double LocalHourAngle = AST - LongtitudeAsHourAngle - SunTopo.X; AAS2DCoordinate SunHorizontal = AASCoordinateTransformation.Equatorial2Horizontal(LocalHourAngle, SunTopo.Y, RT_LAT); SunHorizontal.Y += AASRefraction.RefractionFromTrue(SunHorizontal.Y, 1013, 10); //The result above should be that we have a setting Sun at Y degrees above the horizon at azimuth X degrees south of the westerly horizon //NOTE: for azimuth west is considered positive, to get east as positive subtract the result from 360 return(SunHorizontal); }
protected void CalculateGeometricPositions() { eclipticLongitude = GetEclipticLongitude(jd); eclipticLatitude = GetEclipticLatitude(jd); double planetSunDistance = GetRadiusVector(jd); eclipticLongitudeEarth = AASEarth.EclipticLongitude(jd); eclipticLatitudeEarth = AASEarth.EclipticLatitude(jd); double earthSunDistance = AASEarth.RadiusVector(jd); vectorToEarth = VectorToEarth(eclipticLongitude, eclipticLatitude, planetSunDistance, eclipticLongitudeEarth, eclipticLatitudeEarth, earthSunDistance); }
// Update is called once per frame void Update() { if (Input.GetKeyDown("p")) { Debug.Log("creating planets"); CreatePlanets(); lookAtSun(); Debug.Log("Earth: " + AASEarth.RadiusVector(JDNConv.getJulianDayNumberToday(), true)); Debug.Log("Mercury: " + AASMercury.RadiusVector(JDNConv.getJulianDayNumberToday(), true)); Debug.Log("Jupiter: " + AASJupiter.RadiusVector(JDNConv.getJulianDayNumberToday(), true)); Debug.Log("Distance between sun and pluto: " + Vector3.Distance(Sun.transform.position, Pluto.transform.position)); } }
public double Magnitude() { double phaseAngle = AASIlluminatedFraction.PhaseAngle( GetRadiusVector(jdeCorrected), AASEarth.RadiusVector(jd), vectorToEarthCorrected.Length()); return(AASIlluminatedFraction.MarsMagnitudeMuller( AASMars.RadiusVector(jdeCorrected), vectorToEarthCorrected.Length(), phaseAngle )); }
public Coordinate GetSunCoordinate(DateTime datetime) { AASDate date = new AASDate(datetime.Year, datetime.Month, datetime.Day, datetime.Hour, datetime.Minute, datetime.Second, true); double JD = date.Julian + AASDynamicalTime.DeltaT(date.Julian) / 86400.0; double SunLong = AASSun.ApparentEclipticLongitude(JD, false); double SunLat = AASSun.ApparentEclipticLatitude(JD, false); AAS2DCoordinate equatorial = AASCoordinateTransformation.Ecliptic2Equatorial(SunLong, SunLat, AASNutation.TrueObliquityOfEcliptic(JD)); double SunRad = AASEarth.RadiusVector(JD, false); // This line gives us RA & Declination. AAS2DCoordinate SunTopo = AASParallax.Equatorial2Topocentric(equatorial.X, equatorial.Y, SunRad, Location.Longitude, Location.Latitude, Location.Altitude, JD); return(new Coordinate(SunTopo.X, SunTopo.Y)); }
protected override double GetRadiusVector(double JD) { return(AASEarth.RadiusVector(JD)); }
public override double GetDistance() { return(AASEarth.RadiusVector(jd)); }
public float getDistEarth() { float ret = distanceFactor * (float)AASEarth.RadiusVector(JDNConv.getJulianDayNumberToday(), true); return(ret); }
protected void CorrectForLightTavelTime() { // double tau = AASElliptical.DistanceToLightTime(vectorToEarth.Length()); jde = jd - tau; eclipticLongitudeCorrected = GetEclipticLongitude(jde); eclipticLatitudeCorrected = GetEclipticLatitude(jde); distanceToSun = GetRadiusVector(jde); vectorToEarthCorrected = VectorToEarth(eclipticLongitudeCorrected, eclipticLatitudeCorrected, distanceToSun, eclipticLongitudeEarth, eclipticLatitudeEarth, AASEarth.RadiusVector(jd)); double tauCorrected = AASElliptical.DistanceToLightTime(vectorToEarthCorrected.Length()); jdeCorrected = jd - tauCorrected; eclipticLongitudeCorrected = GetEclipticLongitude(jdeCorrected); eclipticLatitudeCorrected = GetEclipticLatitude(jdeCorrected); distanceToSun = GetRadiusVector(jdeCorrected); }
public void RadiusVectorTest(double JD, bool bHighPrecision, double expectedRadiusVector) { double radiusVector = AASEarth.RadiusVector(JD, bHighPrecision); Assert.Equal(expectedRadiusVector, radiusVector); }