Exemplo n.º 1
0
        public static HorizontalCoordinate From(Vector3 vector)
        {
            Angle altitude = Angle.Zero;

            altitude.Sine = vector.Z;

            // Make X and Y components negative for zero azimuth at south
            // with westward increasing values.
            // Then change x and y calculations likewise in ToVector method
            // and remove adjustment in From(EquatorialCoordinates) method.
            Angle azimuth = Angle.ArcTangent(vector.X, vector.Y);

            return(new HorizontalCoordinate(azimuth, altitude));
        }
Exemplo n.º 2
0
        // Time not used in current calculation, but might be need in future refinements
        public static EquatorialCoordinate From(EclipticCoordinate eclipticCoordinate, Time time)
        {
            // Calculate right ascension and declination
            Angle angleEpsilon = Angle.FromDegrees(23.4392911); // obliquity of the ecliptic -- see Meeus, pg. 92

            Angle angleRightAscension = Angle.ArcTangent(eclipticCoordinate.Longitude.Sine * angleEpsilon.Cosine - eclipticCoordinate.Latitude.Tangent * angleEpsilon.Sine, eclipticCoordinate.Longitude.Cosine);

            angleRightAscension.NormalizePositive();

            Angle angleDeclination = Angle.Zero;

            angleDeclination.Sine = eclipticCoordinate.Latitude.Sine * angleEpsilon.Cosine + eclipticCoordinate.Latitude.Cosine * angleEpsilon.Sine * eclipticCoordinate.Longitude.Sine;

            angleDeclination.NormalizeAroundZero();

            return(new EquatorialCoordinate(angleRightAscension, angleDeclination));
        }
        public void GetAngleOffsets(HorizontalCoordinate objectCoord, ref Angle horzAngle, ref Angle vertAngle)
        {
            Vector3 objectVector    = objectCoord.ToVector();
            Vector3 horzObjectCross = Vector3.Cross(objectVector, -horzAxis);
            Vector3 vertObjectCross = Vector3.Cross(objectVector, vertAxis);

            horzObjectCross.Normalize();
            vertObjectCross.Normalize();

            double x = Vector3.Dot(horzObjectCross, vertAxis);
            double y = Vector3.Dot(horzObjectCross, this.ViewCenterVector);

            horzAngle = -Angle.ArcTangent(y, x);

            x = Vector3.Dot(vertObjectCross, horzAxis);
            y = Vector3.Dot(vertObjectCross, this.ViewCenterVector);

            vertAngle = -Angle.ArcTangent(y, x);
        }
Exemplo n.º 4
0
        public static HorizontalCoordinate From(EquatorialCoordinate equatorialCoordinate, GeographicCoordinate geographicCoordinate, Time time)
        {
            // Calculate hour angle
            Angle localHourAngle = time.GreenwichSiderealTime - geographicCoordinate.Longitude - equatorialCoordinate.RightAscension;

            // Calculate azimuth
            Angle azimuth = Angle.ArcTangent(localHourAngle.Sine, localHourAngle.Cosine * geographicCoordinate.Latitude.Sine - equatorialCoordinate.Declination.Tangent * geographicCoordinate.Latitude.Cosine);

            // Adjustment for azimuth eastward from north
            azimuth += Angle.Straight;

            azimuth.NormalizeAroundZero();

            // Calculate altitude
            Angle altitude = Angle.Zero;

            altitude.Sine = geographicCoordinate.Latitude.Sine * equatorialCoordinate.Declination.Sine + geographicCoordinate.Latitude.Cosine * equatorialCoordinate.Declination.Cosine * localHourAngle.Cosine;
            altitude.NormalizeAroundZero();

            return(new HorizontalCoordinate(azimuth, altitude));
        }