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