public int XYZ2BLH(PointXYZ xyz, double a, double f, ref PointBLH blh) { double error = 0; Ellispoid E = new Ellispoid(); E.a = a; E.f = f; blh.Name = xyz.Name; double x = xyz.X + error; double y = xyz.Y + error; double z = xyz.Z + error; double B0 = Math.Atan(z / Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2))); blh.L = Math.Atan(y / x); while (true) { CalculateEllispoid(ref E, B0); blh.B = Math.Atan((z + E.N * Math.Pow(E.e1, 2) * Math.Sin(B0)) / Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2))); if (Math.Abs(blh.B - B0) <= Math.Pow(10.0, -15.0)) { break; } else { B0 = blh.B; } } blh.H = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2)) / Math.Cos(blh.B) - E.N; return(0); }
public int BLH2XYZ(PointBLH blh, Ellispoid E, ref PointXYZ xyz) { xyz.Name = blh.Name; xyz.X = (E.N + blh.H) * Math.Cos(blh.B) * Math.Cos(blh.L); xyz.Y = (E.N + blh.H) * Math.Cos(blh.B) * Math.Sin(blh.L); xyz.Z = (E.N * (1 - Math.Pow(E.e1, 2)) + blh.H) * Math.Sin(blh.B); return(0); }
private void 大地坐标转空间直角坐标ToolStripMenuItem_Click(object sender, EventArgs e) { if (sign == 1) { LpXYZ.Clear(); Conversion convert = new Conversion(); int count = LpBLH.Count; for (int i = 0; i < count; i++) { PointXYZ xyz = new PointXYZ(); convert.CalculateEllispoid(ref E, LpBLH[i].B); convert.BLH2XYZ(LpBLH[i], E, ref xyz); LpXYZ.Add(xyz); } int style = 1; writeListView(style); style = 11; writeFile(style); sign1 = 1; } }