/// <summary> /// 空间直角坐标系到,站心坐标系的转换。 /// </summary> /// <param name="vector">站心坐标系的目标向量</param> /// <param name="lonlat">站心的大地坐标</param> /// <param name="unit">当前输入的角度单位</param> /// <returns></returns> public static NEU XyzToNeu(XYZ vector, LonLat lonlat, AngleUnit unit = AngleUnit.Degree) { //double[][] trans = (GetGlobalToLocalCoordMatrix(lonlat)); //double[] result = MatrixUtil.GetMultiply(trans, vector.Array); //XYZ xyz = XYZ.Parse(result); NEU neu = XyzToNeu(vector, lonlat.Lat, lonlat.Lon, unit); return(neu); }
/// <summary> /// 计算卫星的站心极坐标,指定了经纬度,更加精确,避免重复计算。 /// </summary> /// <param name="satXyz"></param> /// <param name="stationPosition"></param> /// <param name="unit">即表示输入角度的单位,也要求输出角度的单位</param> /// <param name="lat"></param> /// <param name="lon"></param> /// <returns></returns> public static Polar XyzToPolar(XYZ satXyz, XYZ stationPosition, double lon, double lat, AngleUnit unit = AngleUnit.Degree) { XYZ deltaXyz = satXyz - stationPosition;//地面到卫星的向径。 lon = Math.Abs(lon) < 1E-10 ? 0 : lon; NEU neu = XyzToNeu(deltaXyz, lat, lon, unit); return(NeuToPolar(neu, unit)); }
/// <summary> /// 站心极坐标转换为地心大地坐标 /// </summary> /// <param name="localPolar">目标在地心极坐标的位置</param> /// <param name="sitePosInGeoCenter">测站大地坐标</param> /// <param name="el">参考椭球</param> /// <param name="unit">角度单位</param> /// <returns></returns> public static GeoCoord LocalPolarToGeoCoord(Polar localPolar, GeoCoord sitePosInGeoCenter, Geo.Referencing.Ellipsoid el = null, AngleUnit unit = AngleUnit.Degree) { if (el == null) { el = Geo.Referencing.Ellipsoid.WGS84; } NEU neu = PolarToNeu(localPolar); XYZ xyz = NeuToXyz(neu, sitePosInGeoCenter); return(XyzToGeoCoord(xyz, unit)); }
/// <summary> /// 将NEU偏差根据站星径向换算为等效距离偏差 /// </summary> /// <param name="neuCorrection"></param> /// <param name="polar"></param> /// <returns></returns> public static double GetDirectionLength(NEU neuCorrection, Polar polar) { double azimuth = polar.Azimuth * CoordConsts.DegToRadMultiplier; double elevation = polar.Elevation * CoordConsts.DegToRadMultiplier; double cosel = Math.Cos(elevation); double e0 = Math.Sin(azimuth) * cosel; double e1 = Math.Cos(azimuth) * cosel; double e2 = Math.Sin(elevation); double rangeCorretion = neuCorrection.E * e0 + neuCorrection.N * e1 + neuCorrection.U * e2; return(rangeCorretion); }
/// <summary> /// 计算 测站-卫星 方向的距离。 /// </summary> /// <param name="neuCorrection">测站改正 NEU</param> /// <param name="receiverXyz">测站坐标</param> /// <param name="satXyz">卫星坐标</param> /// <returns></returns> public static double GetDirectionLength(NEU neuCorrection, XYZ receiverXyz, XYZ satXyz) { XYZ ray = (satXyz - receiverXyz); GeoCoord geoCoord = CoordTransformer.XyzToGeoCoord(receiverXyz); //此处修改为 NEU 坐标系。Rotate vector ray to UEN reference frame NEU rayNeu = CoordTransformer.XyzToNeu(ray, geoCoord, AngleUnit.Degree); NEU directionUnit = rayNeu.UnitNeuVector();//方向向量 //计算沿着射线方向的改正数。Compute corrections = displacement vectors components along ray direction. double rangeCorretion = neuCorrection.Dot(directionUnit); return(rangeCorretion); }
/// <summary> /// 站心坐标系到站心极坐标系。 /// </summary> /// <param name="neu"></param> /// <param name="unit">默认单位为度</param> /// <returns></returns> public static Polar NeuToPolar(NEU neu, AngleUnit unit = AngleUnit.Degree) { double r = neu.Length; double a = Math.Atan2(neu.E, neu.N); if (a < 0)//以北向为基准,顺时针,无负号 { a += 2.0 * CoordConsts.PI; } double o = Math.Asin(neu.U / r); if (unit != AngleUnit.Radian) { a = AngularConvert.RadTo(a, unit); o = AngularConvert.RadTo(o, unit); } return(new Polar(r, a, o) { Unit = unit }); }
/// <summary> /// 北东天坐标 /// </summary> /// <param name="neu"></param> public ENU(NEU neu) : this(neu.E, neu.N, neu.U) { }
/// <summary> /// 站心坐标系到地心坐标系 /// </summary> /// <param name="sat"> 站心坐标系,如卫星,天线</param> /// <param name="siteCoord">坐标原点在地心坐标系中的坐标</param> /// <returns></returns> public static XYZ NeuToXyz(NEU sat, GeoCoord siteCoord) { XYZ siteXyz = CoordTransformer.GeoCoordToXyz(siteCoord); return(EnuToXyz(sat.ENU, siteXyz)); }
/// <summary> /// 站心坐标系到地心坐标系。 /// </summary> /// <param name="neu">本地坐标系</param> /// <param name="siteCoord">本地坐标原点在地心坐标系中的坐标</param> /// <returns></returns> public static XYZ NeuToXyz(NEU neu, XYZ siteCoord) { GeoCoord coord = XyzToGeoCoord(siteCoord); return(NeuToXyz(neu, coord)); }