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>()); }