📄 kongjianhoufangjiaohui.txt
字号:
...{
double bs = matrix_AAtemp[q, vv];
for (int p = 0; p < 12; p++)
...{
matrix_AAtemp[q, p] -= bs * matrix_AAtemp[vv, p];
}
}
else
...{
continue;
}
}
}
//得到matrix_AA的逆阵后存在matrix_AAR
for (int i = 0; i < 6; i++)
...{
for (int j = 0; j < 6; j++)
...{
matrix_AAR[i, j] = matrix_AAtemp[i, j + 6];
}
}
//matrix_AAR * matrix_AT存在matrix_AARAT
for (int i = 0; i < 6; i++)
...{
for (int j = 0; j < 6; j++)
...{
matrix_AARAT[i, j] = 0;
for (int vv = 0; vv < 6; vv++)
...{
matrix_AARAT[i, j] += matrix_AAR[i, vv] * matrix_AT[vv, j];
}
}
}
//matrix_AARAT x L
//存在matrix_X中
for (int i = 0; i < 6; i++)
...{
for (int j = 0; j < 1; j++)
...{
matrix_X[i, j] = 0;
for (int vv = 0; vv < 6; vv++)
...{
matrix_X[i, j] += matrix_AARAT[i, vv] * L[vv, j];
}
}
}
//计算外方位元素值
XS += matrix_X[0, 0];
YS += matrix_X[1, 0];
ZS += matrix_X[2, 0];
r += matrix_X[3, 0];
w += matrix_X[4, 0];
k += matrix_X[5, 0];
}
public void Judge(int n,double d) //反复调用Matrix()方法进行迭代,并判断是否满足限差
...{
if (Math.Abs(matrix_X[3, 0]) >= d || Math.Abs(matrix_X[4, 0]) >= d || Math.Abs(matrix_X[5, 0]) >= d)
...{
Console.WriteLine("================== 迭代开始 ==================");
Console.WriteLine();
for (int nu = 0; nu< n; nu++)
...{
Matrix();
Console.WriteLine("======第{0}次迭代 φ, w ,k 值====== ", nu + 1);
for (int i = 3; i < 6; i++)
...{
for (int j = 0; j < 1; j++)
...{
Console.WriteLine(matrix_X[i, j]);
}
}
if (Math.Abs(matrix_X[3, 0]) <= d && Math.Abs(matrix_X[4, 0]) <= d && Math.Abs(matrix_X[5, 0]) <= d)
...{
Console.WriteLine("===============在第{0}次迭代改正数值小于限差==============", nu + 1);
Console.WriteLine();
Console.WriteLine("===========================迭代结束==========================");
Console.WriteLine();
Console.WriteLine("Enter键显示计算结果......");
Console.ReadLine();
Output();
TestRusults();
break;
}
}
if (Math.Abs(matrix_X[3, 0]) >= d || Math.Abs(matrix_X[4, 0]) >= d || Math.Abs(matrix_X[5, 0]) >= d)
...{
Console.WriteLine(" ------------------------- 错误!-------------------------");
Console.WriteLine("已达到指定迭代次数,仍不能满足指定限差要求,程序无法继续执行。");
Console.WriteLine();
Console.WriteLine("大虾请检查数据后重新来过.");
}
}
else
...{
Console.WriteLine();
Console.WriteLine("====满足限差要求,无需迭代====");
Console.WriteLine();
Console.WriteLine("Enter键显示计算结果......");
Console.ReadLine();
Output();
TestRusults();
}
}
public void Output()//输出计算结果
...{
Console.WriteLine("================= 计算结果 =================");
Console.WriteLine("XS={0}",XS);
Console.WriteLine("YS={0}",YS);
Console.WriteLine("ZS={0}",ZS);
Console.WriteLine("φ={0}",r);
Console.WriteLine("w={0}",w);
Console.WriteLine("k={0}",k);
Console.WriteLine();
Console.WriteLine("Enter键进入第四点检验.....");
Console.ReadLine();
}
public void TestRusults()//测试结果
...{
//像点坐标和地面点坐标
double t_X, t_Y, t_Z;
double test_x, test_y;
Console.WriteLine("================ 第四点验检验 ================");
Console.WriteLine("输入地面点坐标 X(m) ");
string strTest_X = Console.ReadLine();
t_X = double.Parse(strTest_X);
Console.WriteLine("输入地面点坐标 Y(m)");
string strTest_Y = Console.ReadLine();
t_Y = double.Parse(strTest_Y);
Console.WriteLine("输入地面点坐标 Z(m)");
string strTest_Z = Console.ReadLine();
t_Z = double.Parse(strTest_Z);
Console.WriteLine();
test_x = -f * (a1 * (t_X - XS) + b1 * (t_Y - YS) + c1 * (t_Z - ZS)) / (a3 * (t_X - XS) + b3 * (t_Y - YS) + c3 * (t_Z - ZS)) + x0;
test_y = -f * (a2 * (t_X - XS) + b2 * (t_Y - YS) + c2 * (t_Z - ZS)) / (a3 * (t_X - XS) + b3 * (t_Y - YS) + c3 * (t_Z - ZS)) + y0;
Console.WriteLine("======== 该点像点坐标(mm) ========");
Console.WriteLine("x={0}", test_x * 1000);
Console.WriteLine("y={0}",test_y*1000);
Console.WriteLine("Enter退出......");
Console.ReadLine();
}
}//end of public class Data
public static void Main()//主方法
...{
try
...{
Console.WriteLine("============ 输入迭代次数 ============");
string str_n = Console.ReadLine();
int n = int.Parse(str_n);
Console.WriteLine("============ 输入限差 ============");
string str_d = Console.ReadLine();
double d = double.Parse(str_d);
//生成实例
Data p = new Data();
//调用方法
p.Input();
p.Matrix();
p.Judge(n,d);
}
catch(Exception)
...{
Console.WriteLine("发生错误,大虾请重试!");
Console.ReadLine();
}
}
}//end of class Program
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -