diff --git a/FlightRouteV2/FlightRouteV2.cs b/FlightRouteV2/FlightRouteV2.cs index c019c3a..0c1bbb6 100644 --- a/FlightRouteV2/FlightRouteV2.cs +++ b/FlightRouteV2/FlightRouteV2.cs @@ -1984,7 +1984,6 @@ namespace FlightRouteV2 int planeCou = new_aVecs.Length; //获取飞机总数 ///a图b图 中心 Vector3 aCenterPos = GetPosCenter(new_aVecs, false); - Vector3 bCenterPos = GetPosCenter(new_bVecs, false); ///判断bVec 矩阵的数量长宽 for (int i = 0; i < planeCou; i++)//把矩阵高度压平 { @@ -2000,20 +1999,18 @@ namespace FlightRouteV2 } } int ran = (int)Math.Ceiling((double)planeCou/(double)row);//行 + StrPrint($"{ran}行{row}列"); if (ran > 2) { for (int i = 0; i < ran - 2; i++) { - if (!(IsVecsOnLine(new_bVecs[1 + i * row], new_bVecs[1 + (i + 1) * row], new_bVecs[1 + (i + 2) * row]))) + if (!(IsVecsOnLine(new_bVecs[i * row], new_bVecs[(i + 1) * row], new_bVecs[(i + 2) * row]))) { + StrPrint("-------降落航点非常规矩阵,故不能做拉散图案操作-------"); return null; } } } - else - { - return null; - } ///计算a图的法线标量 Vector3 side1 = new_aVecs[1] - new_aVecs[0]; Vector3 side2 = new_aVecs[2] - new_aVecs[0]; @@ -2033,7 +2030,7 @@ namespace FlightRouteV2 for (int i = 0; i < ran; i++) { int cou = i * row + k; - if (cou > planeCou) break;// 溢出跳出 + if (cou >= planeCou) break;// 溢出跳出 ///判断图在矩阵的左方 还是右方 if (GageLength(aCenterPos, new_bVecs[0]) > GageLength(aCenterPos, new_bVecs[row - 1])) { @@ -2075,7 +2072,8 @@ namespace FlightRouteV2 for (int i = 0; i < row; i++) { int cou = k * row + i; - if (cou > planeCou) break;// 溢出跳出 + //StrPrint($"{cou}"); + if (cou >= planeCou) break;// 溢出跳出 ///判断图在矩阵的上方 还是下方 if (GageLength(aCenterPos, new_bVecs[0]) > GageLength(aCenterPos, new_bVecs[row * (ran - 1)])) { diff --git a/FlightRouteV2/bin/Debug/FlightRouteV2.dll b/FlightRouteV2/bin/Debug/FlightRouteV2.dll index 351877c..53a40a8 100644 Binary files a/FlightRouteV2/bin/Debug/FlightRouteV2.dll and b/FlightRouteV2/bin/Debug/FlightRouteV2.dll differ diff --git a/FlightRouteV2/bin/Debug/FlightRouteV2.pdb b/FlightRouteV2/bin/Debug/FlightRouteV2.pdb index dfc1ef0..d63f998 100644 Binary files a/FlightRouteV2/bin/Debug/FlightRouteV2.pdb and b/FlightRouteV2/bin/Debug/FlightRouteV2.pdb differ diff --git a/FlightRouteV2/obj/Debug/FlightRouteV2.dll b/FlightRouteV2/obj/Debug/FlightRouteV2.dll index 351877c..53a40a8 100644 Binary files a/FlightRouteV2/obj/Debug/FlightRouteV2.dll and b/FlightRouteV2/obj/Debug/FlightRouteV2.dll differ diff --git a/FlightRouteV2/obj/Debug/FlightRouteV2.pdb b/FlightRouteV2/obj/Debug/FlightRouteV2.pdb index dfc1ef0..d63f998 100644 Binary files a/FlightRouteV2/obj/Debug/FlightRouteV2.pdb and b/FlightRouteV2/obj/Debug/FlightRouteV2.pdb differ diff --git a/FlyCube/MainWindow.xaml.cs b/FlyCube/MainWindow.xaml.cs index 9922407..eecfc0e 100644 --- a/FlyCube/MainWindow.xaml.cs +++ b/FlyCube/MainWindow.xaml.cs @@ -40,19 +40,21 @@ namespace FlyCube //创建一个 主画布对象 TopCanvas = new MainCanvas(this.LayerPlane); - Vector3 aVec = new Vector3(-6650, 1585.775, 3150); - Vector3 bVec = new Vector3(-3864.256, 126.145,0); - List vecs = FlyVecFun.GetRingVec(aVec,bVec,0.3,100,1,1200, 300); - string txta = ""; - for (int i = 0; i < vecs.Count; i++) + List abVecs = FileBase.TxtToPos("C:/Users/szdot/Desktop/1.txt", out string[] fightNames);//从txt文件里面读取航点 信息 + Vector3[] aVecs = abVecs[0].ToArray(); + Vector3[] bVecs = abVecs[1].ToArray(); + Vector3[] vecs = FlyVecFun.NormalPull(aVecs, bVecs, StrPrintAsync); + string txtd = ""; + for (int i = 0; i < vecs.Length; i++) { - txta += i + " 0" + " " + vecs[i].X + " " + vecs[i].Y + " " + vecs[i].Z + "\r\n"; + txtd += i + " 0" + " " + vecs[i].X + " " + vecs[i].Y + " " + vecs[i].Z + "\r\n"; } - if (File.Exists("C:/Users/szdot/Desktop/a.txt")) + string pathd = "C:/Users/szdot/Desktop/d.txt"; + if (File.Exists(pathd)) { - File.Delete("C:/Users/szdot/Desktop/a.txt"); + File.Delete(pathd); } - SaveFile("C:/Users/szdot/Desktop/a.txt", txta); + SaveFile(pathd, txtd); } /// /// 3D绕行