拉散修改

This commit is contained in:
szdot 2024-01-17 20:25:54 +08:00
parent 48bdb1e650
commit b53fa88b7d
6 changed files with 17 additions and 17 deletions

View File

@ -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)]))
{

View File

@ -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<Vector3> vecs = FlyVecFun.GetRingVec(aVec,bVec,0.3,100,1,1200, 300);
string txta = "";
for (int i = 0; i < vecs.Count; i++)
List<Vector3[]> 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);
}
/// <summary>
/// 3D绕行