Example #1
0
        public static Cartesian3D <TLinear> ApparentPlaceToInstantaneous <TLinear>(IAstronomical apparentPlace, AngularUnit greenwichApparentSideralTime)
            where TLinear : LinearUnit, new()
        {
            ICartesian3D tempCoordinate = apparentPlace.ToCartesian <TLinear>();

            Matrix rZ = CalculateRotationMatrixAroundZ(greenwichApparentSideralTime);

            return((Cartesian3D <TLinear>)tempCoordinate.Rotate(rZ));
        }
Example #2
0
        public static Geodetic <TLinear, TAngular> ChangeDatum <TLinear, TAngular>(
            IGeodetic oldGeodeticCoordinate,
            IEllipsoid newDatum)
            where TLinear : LinearUnit, new()
            where TAngular : AngularUnit, new()
        {
            ICartesian3D tempCoordinate = GeodeticToAverage <TLinear>(oldGeodeticCoordinate);

            return(AverageToGeodetic <TLinear, TAngular>(tempCoordinate, newDatum, oldGeodeticCoordinate.LongitudinalRange));
        }
Example #3
0
        public static Astronomical <T> HorizontalAngleToApparentPlace <T>(IAstronomical horizontalAngle, AngularUnit localApparentSideralTime)
            where T : AngularUnit, new()
        {
            ICartesian3D tempCoordinate = horizontalAngle.ToCartesian <Meter>();

            Matrix rZ = CalculateRotationMatrixAroundZ(localApparentSideralTime.Negate());

            Matrix reflection = CalculateReflectionMatrix();

            return(tempCoordinate.Rotate(rZ * reflection).ToAstronomicForm <T>(horizontalAngle.HorizontalAngleRange));
        }
Example #4
0
        public static Astronomical <T> HorizontalAngleToLocalAstronomic <T>(IAstronomical horizontalAngle, AngularUnit astronomicalLatitude)
            where T : AngularUnit, new()
        {
            ICartesian3D tempCoordinate = horizontalAngle.ToCartesian <Meter>();

            Matrix rZ = CalculateRotationMatrixAroundZ(new Radian(Math.PI));

            Matrix rY = CalculateRotationMatrixAroundY(astronomicalLatitude.Subtract(new Radian(Math.PI)).Negate());

            return(tempCoordinate.Rotate(rZ * rY).ToAstronomicForm <T>(horizontalAngle.HorizontalAngleRange));
        }
Example #5
0
        public static Astronomical <T> LocalAstronomicToHorizontalAngle <T>(IAstronomical localAstronomic, AngularUnit astronomicalLatitude)
            where T : AngularUnit, new()
        {
            ICartesian3D tempCoordinate = localAstronomic.ToCartesian <Meter>();

            Matrix rZ = CalculateRotationMatrixAroundZ(new Radian(Math.PI));

            Matrix rY = CalculateRotationMatrixAroundY(astronomicalLatitude.Subtract(new Radian(Math.PI)));

            return(tempCoordinate.Rotate(rY * rZ).ToAstronomicForm <T>(localAstronomic.HorizontalAngleRange));
        }
Example #6
0
        public static Cartesian3D <T> AverageToInstantaneous <T>(
            ICartesian3D averageTerrestrial,
            AngularUnit poleX,
            AngularUnit poleY)
            where T : LinearUnit, new()
        {
            //check if average was not Right Handed!

            Matrix Rx = CalculateRotationMatrixAroundX(poleY);

            Matrix Ry = CalculateRotationMatrixAroundY(poleX);

            return(averageTerrestrial.Rotate(Rx * Ry).ChangeTo <T>());
        }
Example #7
0
        public static Cartesian3D <T> InstantaneousToAverage <T>(
            ICartesian3D instantaneousTerrestrial,
            AngularUnit poleX,
            AngularUnit poleY)
            where T : LinearUnit, new()
        {
            //check if instantaneous was not Right Handed!

            Matrix Rx = CalculateRotationMatrixAroundX(poleY.Negate());

            Matrix Ry = CalculateRotationMatrixAroundY(poleX.Negate());

            return(instantaneousTerrestrial.Rotate(Ry * Rx).ChangeTo <T>());
        }
Example #8
0
        public static Cartesian3D <T> LocalGeodeticToLocalAstronomic <T>(ICartesian3D localGeodetic,
                                                                         AngularUnit deltaAzimuth,
                                                                         AngularUnit kessi,
                                                                         AngularUnit eta)
            where T : LinearUnit, new()
        {
            Matrix rZ = CalculateRotationMatrixAroundZ(deltaAzimuth.Negate());

            Matrix rY = CalculateRotationMatrixAroundY(kessi);

            Matrix rX = CalculateRotationMatrixAroundX(eta.Negate());

            return(localGeodetic.Rotate(rX * rY * rZ).ChangeTo <T>());
        }
Example #9
0
        public static Astronomical <TAngular> OrbitalToApparentPlace <TAngular>(ICartesian3D orbital,
                                                                                AngularUnit rightAscensionOfAscendingNode,
                                                                                AngularUnit inclination,
                                                                                AngularUnit argumentOfPerigee,
                                                                                AngleRange horizontalAngleRange)
            where TAngular : AngularUnit, new()
        {
            Matrix firstRZ = CalculateRotationMatrixAroundZ(rightAscensionOfAscendingNode.Negate());

            Matrix rX = CalculateRotationMatrixAroundX(inclination.Negate());

            Matrix secondRZ = CalculateRotationMatrixAroundZ(argumentOfPerigee.Negate());

            return(orbital.Rotate(firstRZ * rX * secondRZ).ToAstronomicForm <TAngular>(horizontalAngleRange));
        }
Example #10
0
        public static Geodetic <TLinear, TAngular> AverageToGeodetic <TLinear, TAngular>(
            ICartesian3D averageTerrestrial,
            IEllipsoid ellipsoid,
            AngleRange longitudinalRange)
            where TLinear : LinearUnit, new()
            where TAngular : AngularUnit, new()
        {
            //check if cartesian is not Right Handed, do the appropreate task!

            ICartesian3D shiftedCoordinate = averageTerrestrial.Shift(ellipsoid.DatumTranslation);

            Matrix rotationMatrix = Transformation.CalculateEulerElementMatrix(ellipsoid.DatumMisalignment).Transpose();

            return(shiftedCoordinate.Rotate(rotationMatrix).ToGeodeticForm <TLinear, TAngular>(ellipsoid, longitudinalRange));
        }
Example #11
0
        public static Cartesian3D <T> LocalAstronomicToLocalGeodetic <T>(ICartesian3D localAstronomic,
                                                                         AngularUnit initialAstronomicAzimuth,
                                                                         AngularUnit initialGeodeticAzimuth,
                                                                         AngularUnit kessi,
                                                                         AngularUnit eta)
            where T : LinearUnit, new()
        {
            Matrix rZ = CalculateRotationMatrixAroundZ(initialAstronomicAzimuth.Subtract(initialGeodeticAzimuth));

            Matrix rY = CalculateRotationMatrixAroundY(kessi.Negate());

            Matrix rX = CalculateRotationMatrixAroundX(eta);

            return(localAstronomic.Rotate(rZ * rY * rX).ChangeTo <T>());
        }
Example #12
0
        public static Cartesian3D <TLinear> ApparentPlaceToOrbital <TLinear>(IAstronomical apparentPlace,
                                                                             AngularUnit rightAscensionOfAscendingNode,
                                                                             AngularUnit inclination,
                                                                             AngularUnit argumentOfPerigee)
            where TLinear : LinearUnit, new()
        {
            ICartesian3D tempCoordinate = apparentPlace.ToCartesian <TLinear>();

            Matrix firstRZ = CalculateRotationMatrixAroundZ(rightAscensionOfAscendingNode);

            Matrix rX = CalculateRotationMatrixAroundX(inclination);

            Matrix secondRZ = CalculateRotationMatrixAroundZ(argumentOfPerigee);

            return((Cartesian3D <TLinear>)tempCoordinate.Rotate(secondRZ * rX * firstRZ));
        }
Example #13
0
        public static Cartesian3D <T> LocalGeodeticToGeodetic <T>(ICartesian3D localGeodetic,
                                                                  IGeodeticPoint initialPoint)
            where T : LinearUnit, new()
        {
            //local geodetic is lefthanded
            Cartesian3DPoint <T> shift = Transformation.GeodeticToAverage <T>(initialPoint);

            Matrix rZ = CalculateRotationMatrixAroundZ(new Radian(Math.PI).Subtract(initialPoint.Longitude));

            Matrix rY = CalculateRotationMatrixAroundY(new Radian(Math.PI / 2).Subtract(initialPoint.Latitude));

            Matrix p2 = CalculateReflectionMatrix();

            //G is Right Handed
            return(localGeodetic.Transform(rZ * rY * p2, shift.Negate(), AxisType.RightHanded).ChangeTo <T>());
        }
Example #14
0
        public static Cartesian3D <T> GeodeticToLocalGeodetic <T>(ICartesian3D geodetic,
                                                                  IGeodeticPoint initialPoint)
            where T : LinearUnit, new()
        {
            //averageTerrestrial is right handed

            //Error.NO2: do not use initialPoint.ToCartesian<T>() is this case. we need its coordinate in CT system
            ICartesian3D tempCoordinate = geodetic.Shift(Transformation.GeodeticToAverage <T>(initialPoint));

            Matrix rZ = CalculateRotationMatrixAroundZ(initialPoint.Longitude.Subtract(new Radian(Math.PI)));

            Matrix rY = CalculateRotationMatrixAroundY(initialPoint.Latitude.Subtract(new Radian(Math.PI / 2)));

            Matrix p2 = CalculateReflectionMatrix();

            //LA is Left Handed
            return(tempCoordinate.Transform(p2 * rY * rZ, AxisType.LeftHanded).ChangeTo <T>());
        }
Example #15
0
        public static Cartesian3D <T> AverageToLocalAstronomic <T>(ICartesian3D averageTerrestrial,
                                                                   IGeodeticPoint initialPoint,
                                                                   AngularUnit astronomicalLongitude,
                                                                   AngularUnit astronomicalLatitude)
            where T : LinearUnit, new()
        {
            //average Terrestrial is right handed
            // Error.NO.1: initialPoint.ToCartesian<T> is not correct we need the coordinate in CT System

            ICartesian3D tempCoordinate = averageTerrestrial.Shift(Transformation.GeodeticToAverage <T>(initialPoint));

            Matrix rZ = CalculateRotationMatrixAroundZ(astronomicalLongitude.Subtract(new Radian(Math.PI)));

            Matrix rY = CalculateRotationMatrixAroundY(astronomicalLatitude.Subtract(new Radian(Math.PI / 2)));

            Matrix p2 = CalculateReflectionMatrix();

            //LA is Left Handed
            return(tempCoordinate.Transform(p2 * rY * rZ, AxisType.LeftHanded).ChangeTo <T>());
        }
Example #16
0
        public IGeodetic Shift(ISphericalPoint newBase)
        {
            ICartesian3D temp = this.GetCartesianForm <TLinear>().Shift(newBase.ToCartesian <TLinear>());

            return(temp.ToGeodeticForm <TLinear, TAngular>(this.Datum, this.LongitudinalRange));
        }
Example #17
0
        public IGeodetic RotateAboutZ(AngularUnit value, RotateDirection direction)
        {
            ICartesian3D temp = this.GetCartesianForm <TLinear>().RotateAboutZ(value, direction);

            return(temp.ToGeodeticForm <TLinear, TAngular>(this.Datum, this.LongitudinalRange));
        }
Example #18
0
        public static Astronomical <TAngular> InstantaneousToApparentPlace <TAngular>(ICartesian3D InstantaneousTerrestrial,
                                                                                      AngularUnit greenwichApparentSideralTime,
                                                                                      AngleRange horizontalAngleRange)
            where TAngular : AngularUnit, new()
        {
            Matrix rZ = CalculateRotationMatrixAroundZ(greenwichApparentSideralTime.Negate());

            return(InstantaneousTerrestrial.Rotate(rZ).ToAstronomicForm <TAngular>(horizontalAngleRange));
        }