GetRingVec函数 设置了圆盘最小值为3米范围
NormalPull函数 增加了判断是否是矩阵的 判断返回 null则判定为不是矩阵
This commit is contained in:
parent
2944715bab
commit
48bdb1e650
@ -1620,14 +1620,14 @@ namespace FlightRouteV2
|
||||
if (cancellationToken.IsCancellationRequested)//外部法取消指令
|
||||
{
|
||||
StrPrint("-------3D绕行操作被取消-------");
|
||||
return re; // 退出函数
|
||||
return null; // 退出函数
|
||||
}
|
||||
int progress = 0;//进度
|
||||
foreach (int i in collisionGroup)//开始绕碰撞组
|
||||
{
|
||||
progress++;
|
||||
GetVal(progress/collisionGroup.Count*100);
|
||||
List<Vector3> grv = GetRingVec(aVecs[i], bVecs[i], 0.5, 5, 4, 1500);//中间可绕行航点列表
|
||||
List<Vector3> grv = GetRingVec(aVecs[i], bVecs[i], 0.5, 5, 4, 1500,300);//中间可绕行航点列表
|
||||
StrPrint($"进度:{progress}/{collisionGroup.Count},本次绕行{grv.Count}次");
|
||||
foreach (Vector3 v in grv)
|
||||
{
|
||||
@ -1682,7 +1682,7 @@ namespace FlightRouteV2
|
||||
if (cancellationToken.IsCancellationRequested)//外部法取消指令
|
||||
{
|
||||
StrPrint("-------3D绕行操作被取消-------");
|
||||
return re; // 退出函数
|
||||
return null; // 退出函数
|
||||
}
|
||||
int progress = 0;//进度
|
||||
foreach (int i in collisionGroup)//开始绕碰撞组
|
||||
@ -1690,9 +1690,9 @@ namespace FlightRouteV2
|
||||
progress++;
|
||||
GetVal(progress / collisionGroup.Count * 100);
|
||||
//StrPrint($"迭代{c}次{i}号绕行");
|
||||
List<Vector3> sgrv1 = GetRingVec(aVecs[i], bVecs[i], 0, 30, 10,600);//中间可绕行航点列表
|
||||
List<Vector3> sgrv1 = GetRingVec(aVecs[i], bVecs[i], 0, 30, 10,600, 300);//中间可绕行航点列表
|
||||
sgrv1.Insert(0, secondMiddleVecsOne[i]);
|
||||
List<Vector3> sgrv2 = GetRingVec(aVecs[i], bVecs[i], 1, 30, 10,600);//中间可绕行航点列表
|
||||
List<Vector3> sgrv2 = GetRingVec(aVecs[i], bVecs[i], 1, 30, 10,600, 300);//中间可绕行航点列表
|
||||
sgrv2.Insert(0, secondMiddleVecsTwo[i]);
|
||||
StrPrint($"进度:{progress}/{collisionGroup.Count},本次绕行{sgrv1.Count * sgrv2.Count}次");
|
||||
foreach (Vector3 v1 in sgrv1)
|
||||
@ -1755,7 +1755,7 @@ namespace FlightRouteV2
|
||||
if (cancellationToken.IsCancellationRequested)//外部法取消指令
|
||||
{
|
||||
StrPrint("-------3D绕行操作被取消-------");
|
||||
return re; // 退出函数
|
||||
return null; // 退出函数
|
||||
}
|
||||
int progress = 0;//进度
|
||||
foreach (int i in collisionGroup)//开始绕碰撞组
|
||||
@ -1763,11 +1763,11 @@ namespace FlightRouteV2
|
||||
GetVal(progress / collisionGroup.Count * 100);
|
||||
progress++;
|
||||
//StrPrint($"迭代{c}次{i}号绕行");
|
||||
List<Vector3> sgrv1 = GetRingVec(aVecs[i], bVecs[i], 0, 100, 10, 600);//中间可绕行航点列表
|
||||
List<Vector3> sgrv1 = GetRingVec(aVecs[i], bVecs[i], 0, 100, 10, 600, 300);//中间可绕行航点列表
|
||||
sgrv1.Insert(0, secondMiddleVecsOne[i]);
|
||||
List<Vector3> sgrv2 = GetRingVec(aVecs[i], bVecs[i], 1, 100, 10, 600);//中间可绕行航点列表
|
||||
List<Vector3> sgrv2 = GetRingVec(aVecs[i], bVecs[i], 1, 100, 10, 600, 300);//中间可绕行航点列表
|
||||
sgrv2.Insert(0, secondMiddleVecsTwo[i]);
|
||||
List<Vector3> grv = GetRingVec(secondMiddleVecsOne[i], secondMiddleVecsTwo[i], 0.5, 80, 4, 1500);//中间可绕行航点列表
|
||||
List<Vector3> grv = GetRingVec(secondMiddleVecsOne[i], secondMiddleVecsTwo[i], 0.5, 80, 4, 1500, 300);//中间可绕行航点列表
|
||||
StrPrint($"进度:{progress}/{collisionGroup.Count},本次绕行{sgrv1.Count * sgrv2.Count * grv.Count}次");
|
||||
foreach (Vector3 vm in grv)
|
||||
{
|
||||
@ -1931,17 +1931,20 @@ namespace FlightRouteV2
|
||||
/// <param name="maxPaunchRadius">设定圆盘半径 的最大值 单位是厘米</param>
|
||||
/// <param name="direction">层排布方向 "retrun"前后堆叠 "forward"向前排列(如:起点向目标点方向) "backward"向后排列</param>
|
||||
/// <returns>绕行航点列表</returns>
|
||||
public static List<Vector3> GetRingVec(Vector3 aVec, Vector3 bVec, double middleProportion, double transfer, double paunch,double maxPaunchRadius, string direction = "retrun")
|
||||
public static List<Vector3> GetRingVec(Vector3 aVec, Vector3 bVec, double middleProportion, double transfer, double paunch,double maxPaunchRadius, double minPaunchRadius,string direction = "retrun")
|
||||
{
|
||||
List<Vector3> ringVec = new List<Vector3>(); //记录所有绕行中间航点坐标
|
||||
/// 根据a到b的长度 算出中间绕行几圈
|
||||
double discRadius = GageLength(aVec, bVec) / paunch;//圆盘半径
|
||||
if (discRadius > maxPaunchRadius)
|
||||
{
|
||||
discRadius = maxPaunchRadius;//设定圆盘不经不超过最大值
|
||||
discRadius = maxPaunchRadius;//设定圆盘直径上限
|
||||
}
|
||||
if (discRadius < minPaunchRadius)
|
||||
{
|
||||
discRadius = minPaunchRadius;//设定圆盘直径下限
|
||||
}
|
||||
int ringCou = (int)Math.Ceiling(discRadius / transfer ); //算层数和圈数 ps:层的厚度 和 圈的直径 为 paunch/航线长度
|
||||
if (ringCou < 2) ringCou = 2; //最少两圈 两层
|
||||
/// 不是单圈的话 设置层数跟圈数相等
|
||||
int layCou = ringCou;
|
||||
if (singleCircle) layCou = 1;
|
||||
@ -1976,8 +1979,8 @@ namespace FlightRouteV2
|
||||
/// <returns>拉散图案的坐标组</returns>
|
||||
public static Vector3[] NormalPull(Vector3[] aVecs, Vector3[] bVecs, SomeCalculateWay StrPrint)
|
||||
{
|
||||
Vector3[] new_aVecs = aVecs.ToArray();
|
||||
Vector3[] new_bVecs = bVecs.ToArray();
|
||||
Vector3[] new_aVecs = aVecs.ToArray(); //a图副本
|
||||
Vector3[] new_bVecs = bVecs.ToArray(); //矩阵副本
|
||||
int planeCou = new_aVecs.Length; //获取飞机总数
|
||||
///a图b图 中心
|
||||
Vector3 aCenterPos = GetPosCenter(new_aVecs, false);
|
||||
@ -1997,6 +2000,20 @@ namespace FlightRouteV2
|
||||
}
|
||||
}
|
||||
int ran = (int)Math.Ceiling((double)planeCou/(double)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])))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
///计算a图的法线标量
|
||||
Vector3 side1 = new_aVecs[1] - new_aVecs[0];
|
||||
Vector3 side2 = new_aVecs[2] - new_aVecs[0];
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -42,7 +42,7 @@ namespace FlyCube
|
||||
|
||||
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);
|
||||
List<Vector3> vecs = FlyVecFun.GetRingVec(aVec,bVec,0.3,100,1,1200, 300);
|
||||
string txta = "";
|
||||
for (int i = 0; i < vecs.Count; i++)
|
||||
{
|
||||
@ -141,6 +141,7 @@ namespace FlyCube
|
||||
private void ByPassCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
cts.Cancel(); //取消掉 异步执行的 绕行函数
|
||||
cts = new CancellationTokenSource();
|
||||
}
|
||||
// 异步回调函数 输出日志
|
||||
private async void StrPrintAsync(string str)
|
||||
|
Loading…
Reference in New Issue
Block a user