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);
        }
Ejemplo n.º 2
0
    public void CreateEarth()
    {
        float   x       = Mathf.Cos((float)AASEarth.EclipticLatitude(JDNConv.getJulianDayNumberToday(), true)) * Mathf.Cos((float)AASEarth.EclipticLongitude(JDNConv.getJulianDayNumberToday(), true));
        float   y       = Mathf.Sin((float)AASEarth.EclipticLatitude(JDNConv.getJulianDayNumberToday(), true)) * Mathf.Cos((float)AASEarth.EclipticLongitude(JDNConv.getJulianDayNumberToday(), true));
        float   z       = Mathf.Sin((float)AASEarth.EclipticLongitude(JDNConv.getJulianDayNumberToday(), true));
        Vector3 forward = new Vector3(x, y, z) * getDistEarth();

        Earth = Instantiate(sphere, forward, Sun.transform.rotation);
        Earth.transform.localScale = Vector3.one * .012742f;
        Earth.name = "Earth";
    }
Ejemplo n.º 3
0
    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);
    }
Ejemplo n.º 4
0
 // 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));
     }
 }
Ejemplo n.º 5
0
    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));
        }
Ejemplo n.º 7
0
 protected override double GetRadiusVector(double JD)
 {
     return(AASEarth.RadiusVector(JD));
 }
Ejemplo n.º 8
0
 public override double GetDistance()
 {
     return(AASEarth.RadiusVector(jd));
 }
Ejemplo n.º 9
0
    public float getDistEarth()
    {
        float ret = distanceFactor * (float)AASEarth.RadiusVector(JDNConv.getJulianDayNumberToday(), true);

        return(ret);
    }
Ejemplo n.º 10
0
    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 EclipticLongitudeTest(double JD, bool bHighPrecision, double expectedLongitude)
 {
     double longitude = AASEarth.EclipticLongitude(JD, bHighPrecision);
     Assert.Equal(expectedLongitude, longitude);
 }
 public void EccentricityTest(double jd, double expectedEccentricity)
 {
     double eccentricity = AASEarth.Eccentricity(jd);
     Assert.Equal(expectedEccentricity, eccentricity);
 }
 public void SunMeanAnomalyTest(double jd, double expectedSunMeanAnomaly)
 {
     double sunMeanAnomaly = AASEarth.SunMeanAnomaly(jd);
     Assert.Equal(expectedSunMeanAnomaly, sunMeanAnomaly);
 }
 public void EclipticLatitudeJ2000Test(double JD, bool bHighPrecision, double expectedEclipticLatitude)
 {
     double eclipticLatitude = AASEarth.EclipticLatitudeJ2000(JD, bHighPrecision);
     Assert.Equal(expectedEclipticLatitude, eclipticLatitude);
 }
 public void RadiusVectorTest(double JD, bool bHighPrecision, double expectedRadiusVector)
 {
     double radiusVector = AASEarth.RadiusVector(JD, bHighPrecision);
     Assert.Equal(expectedRadiusVector, radiusVector);
 }