public static Cartesian3DPoint <T> GeodeticToAverage <T>(IGeodeticPoint geodetic) where T : LinearUnit, new() { //check if not geodetic is Right Handed Cartesian3DPoint <T> semiGeodetic = geodetic.ToCartesian <T>(); double tempOrigionX = geodetic.Datum.DatumTranslation.X.ChangeTo <T>().Value; double tempOrigionY = geodetic.Datum.DatumTranslation.Y.ChangeTo <T>().Value; double tempOrigionZ = geodetic.Datum.DatumTranslation.Z.ChangeTo <T>().Value; Matrix rotationMatrix = Transformation.CalculateEulerElementMatrix(geodetic.Datum.DatumMisalignment); Matrix transferMatrix = new Matrix(new double[][] { new double[] { tempOrigionX, tempOrigionY, tempOrigionZ } }); Matrix tempSemiGeodetic = new Matrix(new double[][] { new double[] { semiGeodetic.X.Value, semiGeodetic.Y.Value, semiGeodetic.Z.Value } }); Matrix tempResult = rotationMatrix * tempSemiGeodetic + transferMatrix; return(new Cartesian3DPoint <T>(new T() { Value = tempResult[0, 0] }, new T() { Value = tempResult[1, 0] }, new T() { Value = tempResult[2, 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>()); }
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>()); }
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>()); }
public static OrientationParameter CalculateLocalAstronomicLocalGeodeticParameter(IGeodeticPoint initialPoint, AngularUnit astronomicalLatitude, AngularUnit astronomicalLongitude) { double tempLatSin = initialPoint.Latitude.Sin; double tempLatCos = initialPoint.Latitude.Cos; double tempLongSin = initialPoint.Longitude.Sin; double tempLongCos = initialPoint.Longitude.Cos; double tempEx = initialPoint.Datum.DatumMisalignment.Omega.ChangeTo <Radian>().Value; double tempEy = initialPoint.Datum.DatumMisalignment.Phi.ChangeTo <Radian>().Value; double tempEz = initialPoint.Datum.DatumMisalignment.Kappa.ChangeTo <Radian>().Value; double tempDeltaLambda = astronomicalLongitude.Subtract(initialPoint.Longitude).ChangeTo <Radian>().Value; double tempDeltaPhi = astronomicalLatitude.Subtract(initialPoint.Latitude).ChangeTo <Radian>().Value; double tempDeltaAzimuth = tempDeltaLambda * tempLatSin - tempLatCos * (tempEx * tempLongCos + tempEy * tempLongSin) - tempEz * tempLatSin; double tempKesi = tempDeltaPhi - tempEx * tempLongSin - tempEy * tempLongCos; double tempEta = tempDeltaLambda * tempLongCos + tempLatSin * (tempEx * tempLongCos + tempEy * tempLongSin) - tempEz * tempLatCos; return(new OrientationParameter(new Radian(tempEta), new Radian(tempKesi), new Radian(tempDeltaAzimuth))); }