根据矩阵拉散

This commit is contained in:
szdot 2024-01-04 20:43:17 +08:00
parent 569d1a0569
commit 04c82c4c75

View File

@ -35,12 +35,11 @@ namespace FlyCube
InitializeComponent();
//创建一个 主画布对象
TopCanvas = new MainCanvas(this.LayerPlane);
}
/// <summary>
/// 3D绕行
/// </summary>
private void ByPass_Click(object sender, RoutedEventArgs e)
private async void ByPass_Click(object sender, RoutedEventArgs e)
{
//资源管理器 获取航点文件路径
FileBase.FileClass = new string[] { "航点文件" };
@ -51,9 +50,11 @@ namespace FlyCube
List<Vector3[]> abVecs = FileBase.TxtToPos(FliePath, out string[] fightNames);//从txt文件里面读取航点 信息
Vector3[] aVecs = abVecs[0].ToArray();
Vector3[] bVecs = abVecs[1].ToArray();
Vector3[] new_bVecs = FlyVecFun.ContactABOut(aVecs, bVecs, StrPrint);
//List<List<Vector3>> re = FlyVecFun.ABypassB(aVecs, new_bVecs, StrPrint, GetVal);
//Vector3[] new_bVecs = FlyVecFun.ContactABOut(aVecs, bVecs, StrPrint);
Vector3[] new_bVecs = FlyVecFun.NormalPull(aVecs, bVecs);
//Task<List<List<Vector3>>> reTask = Task.Run(() => FlyVecFun.ABypassB(aVecs, bVecs, StrPrintAsync, GetVal));
//List<List<Vector3>> re = await reTask;
//string txta = "";
//string txtb = "";
@ -62,28 +63,34 @@ namespace FlyCube
for (int i = 0; i < abVecs[0].Length; i++)
{
//if (re.Count > 0)
//{
// txta += i + " 0" + " " + re[0][i].X + " " + re[0][i].Y + " " + re[0][i].Z + "\r\n";
//}
//if (re.Count > 1)
//{
// txtb += i + " 0" + " " + re[1][i].X + " " + re[1][i].Y + " " + re[1][i].Z + "\r\n";
// txtc += i + " 0" + " " + re[2][i].X + " " + re[2][i].Y + " " + re[2][i].Z + "\r\n";
//}
// if (re.Count > 0)
// {
// txta += i + " 0" + " " + re[0][i].X + " " + re[0][i].Y + " " + re[0][i].Z + "\r\n";
// }
// if (re.Count > 1)
// {
// txtb += i + " 0" + " " + re[1][i].X + " " + re[1][i].Y + " " + re[1][i].Z + "\r\n";
// }
// if (re.Count > 2)
// {
// txtc += i + " 0" + " " + re[2][i].X + " " + re[2][i].Y + " " + re[2][i].Z + "\r\n";
// }
txtd += i + " 0" + " " + new_bVecs[i].X + " " + new_bVecs[i].Y + " " + new_bVecs[i].Z + "\r\n";
}
//if (re.Count > 0)
//{
//{
// SaveFile("C:/Users/szdot/Desktop/a.txt", txta);
//}
//if (re.Count > 1)
//{
// SaveFile("C:/Users/szdot/Desktop/b.txt", txtb);
// SaveFile("C:/Users/szdot/Desktop/c.txt", txtc);
//}
//if (re.Count > 2)
//{
// SaveFile("C:/Users/szdot/Desktop/c.txt", txtc);
//}
SaveFile("C:/Users/szdot/Desktop/d.txt", txtd);
}
else
@ -91,11 +98,19 @@ namespace FlyCube
return;
}
}
//回调函数 输出日志
// 异步回调函数 输出日志
private async void StrPrintAsync(string str)
{
await Task.Run(() =>
{
// 输出日志的异步操作
//vLogBox.Text += "\r\n" + str;
MessageBox.Show(str);
});
}
private void StrPrint(string str)
{
//MessageBox.Show(str);
vLogBox.Text += "\r\n" + str;
}
private void GetVal(int val)
{