先后方交会求外方位元素
Private Sub Command1_Click()
Dim x(4) As Double, y(4) As DoubleDim a(8, 6) As Double
Dim Xd(4) As Double, Yd(4) As Double, Zd(4) As Double
Dim n As Integer, i As Integer
Dim Xy(4) As Double, Yy(4) As Double, x_x(4) As Double, y_y(4) As Double, z_z(4) As Double
Dim Zs0 As Double, Xs0 As Double, Ys0 As Double, ψ As Double, ω As Double, κ As Double, f As Double, dx(6, 1) As Double
Dim L(8, 1) As Double
Dim a1 As Double, a2 As Double, a3 As Double, b1 As Double, b2 As Double, b3 As Double, c1 As Double, c2 As Double, c3 As Double
Dim v As Variant
ψ = 0
ω = 0
κ = 0
n = 0
f = 153.24
Xy(1) = Text5: Xy(2) = Text7: Xy(3) = Text9: Xy(4) = Text11
Yy(1) = Text6: Yy(2) = Text8: Yy(3) = Text10: Yy(4) = Text12
Xd(1) = Text13: Xd(2) = Text16: Xd(3) = Text19: Xd(4) = Text22
Yd(1) = Text14: Yd(2) = Text17: Yd(3) = Text20: Yd(4) = Text23
Zd(1) = Text15: Zd(2) = Text18: Zd(3) = Text21: Zd(4) = Text24
Zs0 = 2000
Xs0 = (Xd(1) + Xd(2) + Xd(3) + Xd(4)) / 4
Ys0 = (Yd(1) + Yd(2) + Yd(3) + Yd(4)) / 4
Do
a1 = Cos(ψ) * Cos(κ) - Sin(ψ) * Sin(ω) * Sin(κ)
a2 = -Cos(ψ) * Sin(κ) - Sin(ψ) * Sin(ω) * Cos(κ)
a3 = -Sin(ψ) * Cos(ω)
b1 = Cos(ω) * Sin(κ)
b2 = Cos(ω) * Cos(κ)
b3 = -Sin(ω)
c1 = Sin(ψ) * Cos(κ) + Cos(ψ) * Sin(ω) * Sin(κ)
c2 = -Sin(ψ) * Sin(κ) + Cos(ψ) * Sin(ω) * Cos(κ)
c3 = Cos(ω) * Cos(ψ)
For i = 1 To 4
x_x(i) = a1 * (Xd(i) - Xs0) + b1 * (Yd(i) - Ys0) + c1 * (Zd(i) - Zs0)
y_y(i) = a2 * (Xd(i) - Xs0) + b2 * (Yd(i) - Ys0) + c2 * (Zd(i) - Zs0)
z_z(i) = a3 * (Xd(i) - Xs0) + b3 * (Yd(i) - Ys0) + c3 * (Zd(i) - Zs0)
x(i) = -f * x_x(i) / z_z(i)
y(i) = -f * y_y(i) / z_z(i)
L(2 * i - 1, 1) = Xy(i) - x(i)
L(2 * i, 1) = Yy(i) - y(i)
a(2 * i - 1, 1) = (a1 * f + a3 * Xy(i)) / z_z(i)
a(2 * i - 1, 2) = (b1 * f + b3 * Xy(i)) / z_z(i)
a(2 * i - 1, 3) = (c1 * f + c3 * Xy(i)) / z_z(i)
a(2 * i - 1, 4) = Yy(i) * Sin(ω) - ((Xy(i) / f) * (Xy(i) * Cos(κ) - Yy(i) * Sin(κ)) + f * Cos(κ)) * Cos(ω)
a(2 * i - 1, 5) = -f * Sin(κ) - (Xy(i) / f) * (Xy(i) * Sin(κ) + Yy(i) * Cos(κ))
a(2 * i - 1, 6) = Yy(i)
a(2 * i, 1) = (a2 * f + a3 * Yy(i)) / z_z(i)
a(2 * i, 2) = (b2 * f + b3 * Yy(i)) / z_z(i)
a(2 * i, 3) = (c2 * f + c3 * Yy(i)) / z_z(i)
a(2 * i, 4) = -Xy(i) * Sin(ω) - ((Yy(i) / f) * (Xy(i) * Cos(κ) - Yy(i) * Sin(κ)) - f * Sin(κ)) * Cos(ω)
a(2 * i, 5) = -f * Cos(κ) - Yy(i) / f * (Xy(i) * Sin(κ) + Yy(i) * Cos(κ))
a(2 * i, 6) = -Xy(i)
Next i
Call EquationResult(a, L, dx)
ψ = ψ + dx(4, 1): ω = ω + dx(5, 1): κ = κ + dx(6, 1)
Xs0 = Xs0 + dx(1, 1): Ys0 = Ys0 + dx(2, 1): Zs0 = Zs0 + dx(3, 1)
Text25 = Xs0: Text26 = Ys0: Text27 = Zs0
n = n + 1
Loop While Abs(dx(4, 1)) > 0.00003 Or Abs(dx(5, 1)) > 0.00003 Or Abs(dx(6, 1)) > 0.00003 Or Abs(dx(1, 1)) > 0.001 Or Abs(dx(2, 1)) > 0.001 Or Abs(dx(3, 1)) > 0.001
MsgBox "迭代次数为" & n & "次"
End Sub
在前方交会求待定点的坐标
Program:using System
using System.Collections.Generic
using System.Linq
using System.Text
namespace 测绘工程
{
class Program
{
static void Main(string[] args)
{
string a
Console.WriteLine("1:距离计算")
Console.WriteLine("2:度、分、秒转换")
Console.WriteLine("3:度与弧度转换")
Console.WriteLine("4:前方交会")
Console.WriteLine("5:距离交会")
Console.WriteLine(" ")
a=Console.ReadLine()
switch (a)
{
case "1"://计算距离
Distance distance = new Distance()
Console.WriteLine("请输入第一个点位坐标:")
distance.X1 = Convert.ToDouble(Console.ReadLine())
distance.Y1 = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个点位坐标:")
distance.X2 = Convert.ToDouble(Console.ReadLine())
distance.Y2 = Convert.ToDouble(Console.ReadLine())
distance.Calcu()
Console.ReadLine()
break
case "2"://度、分、秒转换
zhuanhuan zhuanhuan = new zhuanhuan()
string b
Console.WriteLine("1:度转换为分")
Console.WriteLine("2:度转换为秒")
Console.WriteLine("3:分转换为秒")
Console.WriteLine("4:分转换为度")
Console.WriteLine("5:秒转换为度")
Console.WriteLine("6:秒转换为分")
Console.WriteLine(" ")
b = Console.ReadLine()
switch(b)
{
case "1":
Console.WriteLine("度数:")
double dushu=Convert.ToDouble(Console.ReadLine())
zhuanhuan.A(dushu)
Console.WriteLine("转换后度数为:"+"{0:f4}"+"分",dushu)
Console.ReadLine()
break
case "2":
Console.WriteLine("度数:")
dushu = Convert.ToDouble(Console.ReadLine())
dushu=(zhuanhuan.A(dushu))
dushu = (zhuanhuan.A(dushu))
Console.WriteLine("转换后度数为:" + "{0:f4}" + "秒", dushu)
Console.ReadLine()
break
case "3":
Console.WriteLine("分:")
dushu = Convert.ToDouble(Console.ReadLine())
zhuanhuan.A(dushu)
Console.WriteLine("转换后度数为:" +"{0:f4}"+ "秒", dushu)
Console.ReadLine()
break
case "4":
Console.WriteLine("分:")
dushu = Convert.ToDouble(Console.ReadLine())
dushu = (zhuanhuan.B(dushu))
Console.WriteLine("转换后度数为:" + "{0:f4}" + "度", dushu)
Console.ReadLine()
break
case "5":
Console.WriteLine("秒:")
dushu = Convert.ToDouble(Console.ReadLine())
dushu = (zhuanhuan.B(dushu))
dushu = (zhuanhuan.B(dushu))
Console.WriteLine("转换后度数为:" + "{0:f4}" + "度",dushu)
Console.ReadLine()
break
case "6":
Console.WriteLine("秒:")
dushu = Convert.ToDouble(Console.ReadLine())
dushu = (zhuanhuan.B(dushu))
Console.WriteLine("转换后度数为:" + "{0:f4}" + "分", dushu)
Console.ReadLine()
break
}
break
case "3":
{
string aa
double bb
huduzhi huduzhi = new huduzhi()
Console.WriteLine("1:角度制转换为弧度制")
Console.WriteLine("2:弧度制转换为角度制")
Console.WriteLine(" ")
aa = Console.ReadLine()
if (aa == "1")
{
Console.WriteLine("角度为:")
bb =Convert.ToDouble(Console.ReadLine())
bb=huduzhi.A(bb)
Console.WriteLine("弧度为: "+"{0:f4}",bb)
Console.ReadLine()
}
if (aa == "2")
{
Console.WriteLine("弧度为:")
bb = Convert.ToDouble(Console.ReadLine())
bb=huduzhi.B(bb)
Console.WriteLine("角度为: " + "{0:f4}", bb)
Console.ReadLine()
}
break
}
case "4":
{
jiaohui jiaohui = new jiaohui()
Console.WriteLine("请输入第一个控制点X坐标:")
jiaohui.XA =Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第一个控制点Y坐标:")
jiaohui.YA =Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个控制点X坐标:")
jiaohui.XB =Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个控制点Y坐标:")
jiaohui.YB = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第一个观测方位角(弧度制):")
jiaohui.QBAP = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个观测方位角(弧度制):")
jiaohui.QPBA = Convert.ToDouble(Console.ReadLine())
jiaohui.qianfang()
}
break
case "5":
{
julijiaohui julijiaohui = new julijiaohui()
Console.WriteLine("请输入第一个控制点X坐标:")
julijiaohui.XA = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第一个控制点Y坐标:")
julijiaohui.YA = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个控制点X坐标:")
julijiaohui.XB = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个控制点Y坐标:")
julijiaohui.YB = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第一个控制点与待求点距离:")
julijiaohui.DAP = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个控制与待求点距离:")
julijiaohui.DBP = Convert.ToDouble(Console.ReadLine())
julijiaohui.juli()
}
break
}
}
}
}
角度前方交会的计算公式如下:
上式虽然漂亮,但是并不适合于编写程序代码,因为角 A、B 可能会接近 0 或 180 度。编写程序时,可使用下式:
关于sign,它的取值为+1或-1,具体要求为:
当 A、B、P 的排列顺序与方位角的增加方向一致时,它取值为1;
当 A、B、P 的排列顺序与方位角的增加方向相反时,它取值为-1。
更具体的说,就是:
测量坐标系下,A、B、P 顺时针排列时,sign=1;A、B、P 逆时针排列时,sign=-1。
数学坐标系下,A、B、P 逆时针排列时,sign=1;A、B、P 顺时针排列时,sign=-1。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)