【类 型】:fix

【主	题】:3d绕行 ABypassB函数 注释 日志修改
【描	述】:
	[原因]:日志输出不明确
	[过程]:
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
tk 2024-06-24 19:00:18 +08:00
parent 1ed8524773
commit 248fe77995

View File

@ -1663,14 +1663,14 @@ namespace FlightRouteV2
{
isPass = false;
long t = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
StrPrint("-------3D绕行开始-------");
//StrPrint("-------3D绕行开始-------");
List<List<Vector3>> re = new List<List<Vector3>>();
///判断有没有碰撞 有碰撞继续 没有直接返回
List<int[]> planesCollision = AirImitation(aVecs, bVecs); //获取碰撞组
if (planesCollision.Count == 0)
{
StrPrint("没有检测到碰撞,故不用添加中间航点");
StrPrint($"-------3D绕行结束-------");
StrPrint("执行成功:没有检测到碰撞,故不用添加中间航点");
//StrPrint($"-------3D绕行结束-------");
isPass = true;
return re;//直接返回
}
@ -1688,6 +1688,7 @@ namespace FlightRouteV2
///碰撞数
int collisionCou;
///第一次绕行 中间1航点
StrPrint($"3D航线第一次计算开始。");
List<int> collisionGroup = TwoArrToArr(planesCollision); //整合数组
List<Vector3> middleVecs = new List<Vector3>(); //中心航点坐标组
for (int i = 0; i < planeCou; i++)
@ -1699,7 +1700,7 @@ namespace FlightRouteV2
{
if (cancellationToken.IsCancellationRequested)//外部法取消指令
{
StrPrint("-------3D绕行操作被取消-------");
StrPrint("取消3D航线操作。");
return null; // 退出函数
}
int progress = 0;//进度
@ -1708,7 +1709,7 @@ namespace FlightRouteV2
progress++;
GetVal(progress / collisionGroup.Count * 100);
List<Vector3> grv = GetRingVec(aVecs[i], bVecs[i], 0.5, 5, 4, 1500, 300);//中间可绕行航点列表
StrPrint($"进度:{progress}/{collisionGroup.Count},本次绕行{grv.Count}次");
StrPrint($"3D航线第一次计算进度:{progress}/{collisionGroup.Count},本次计算{grv.Count}次");
foreach (Vector3 v in grv)
{
middleVecs[i] = v;
@ -1731,21 +1732,22 @@ namespace FlightRouteV2
//没有碰撞 返回一个中间航点 并返回
if (collisionGroup.Count == 0)
{
StrPrint("第一次绕行成功!");
StrPrint("执行成功:第一次计算即成功!");
t = DateTimeOffset.UtcNow.ToUnixTimeSeconds() - t;
StrPrint($"用时:{t}秒");
StrPrint($"-------3D绕行结束-------");
//StrPrint($"-------3D绕行结束-------");
re.Add(middleVecs);
return re;
}
else
{
string mappingOutput = string.Join(", ", collisionGroup.Select(index => $"{mappingId[index]}号")); // 构建映射关系字符串
StrPrint($"{collisionGroup.Count}架有碰撞:{mappingOutput}");
StrPrint("第一次绕行未成功!");
StrPrint($"3D航线第一次计算之后仍有{collisionGroup.Count}架有碰撞:{mappingOutput}");
//StrPrint("第一次绕行未成功!");
}
///第二次绕行 两头 两航点
StrPrint($"3D航线第二次计算开始。");
bool isPassMark = false;
planesCollision = AirImitation(aVecs, bVecs); //获取碰撞组
collisionGroup = TwoArrToArr(planesCollision); //整合数组
@ -1761,7 +1763,7 @@ namespace FlightRouteV2
{
if (cancellationToken.IsCancellationRequested)//外部法取消指令
{
StrPrint("-------3D绕行操作被取消-------");
StrPrint("取消3D航线操作。");
return null; // 退出函数
}
int progress = 0;//进度
@ -1774,7 +1776,7 @@ namespace FlightRouteV2
sgrv1.Insert(0, secondMiddleVecsOne[i]);
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}次");
StrPrint($"3D航线第二次计算进度:{progress}/{collisionGroup.Count},本次绕行{sgrv1.Count * sgrv2.Count}次");
foreach (Vector3 v1 in sgrv1)
{
secondMiddleVecsOne[i] = v1;
@ -1808,10 +1810,10 @@ namespace FlightRouteV2
//没有碰撞 返回两个中间航点 并返回
if (collisionGroup.Count == 0)
{
StrPrint("第二次绕行成功!");
StrPrint("执行成功:第二次计算成功!");
t = DateTimeOffset.UtcNow.ToUnixTimeSeconds() - t;
StrPrint($"用时:{t}秒");
StrPrint($"-------3D绕行结束-------");
//StrPrint($"-------3D绕行结束-------");
re.Add(secondMiddleVecsOne);
re.Add(secondMiddleVecsTwo);
return re;
@ -1819,11 +1821,12 @@ namespace FlightRouteV2
else
{
string mappingOutput = string.Join(", ", collisionGroup.Select(index => $"{mappingId[index]}号")); // 构建映射关系字符串
StrPrint($"{collisionGroup.Count}架有碰撞:{mappingOutput}");
StrPrint("第二次绕行未成功!");
StrPrint($"3D航线第二次计算之后仍有{collisionGroup.Count}架有碰撞:{mappingOutput}");
//StrPrint("第二次绕行未成功!");
}
///第三次绕行 两头 两航点 中间一行点(实际添加两航点 但是0.6位置航点暂不启用留给第四次绕行) 沿用第二次绕行
StrPrint($"3D航线第二次计算开始。");
isPassMark = false;
List<Vector3> thirdMiddleVecs = new List<Vector3>(); //中心航点坐标组1
for (int i = 0; i < planeCou; i++)
@ -1834,7 +1837,7 @@ namespace FlightRouteV2
{
if (cancellationToken.IsCancellationRequested)//外部法取消指令
{
StrPrint("-------3D绕行操作被取消-------");
StrPrint("取消3D航线操作。");
return null; // 退出函数
}
int progress = 0;//进度
@ -1891,10 +1894,9 @@ namespace FlightRouteV2
//没有碰撞 返回三个中间航点 并返回
if (collisionGroup.Count == 0)
{
StrPrint("第三次绕行成功!");
StrPrint("执行成功:第三次计算成功!");
t = DateTimeOffset.UtcNow.ToUnixTimeSeconds() - t;
StrPrint($"用时:{t}秒");
StrPrint($"-------3D绕行结束-------");
re.Add(secondMiddleVecsOne);
re.Add(thirdMiddleVecs);
re.Add(secondMiddleVecsTwo);
@ -1903,14 +1905,14 @@ namespace FlightRouteV2
else
{
string mappingOutput = string.Join(", ", collisionGroup.Select(index => $"{mappingId[index]}号")); // 构建映射关系字符串
StrPrint($"{collisionGroup.Count}架有碰撞:{mappingOutput}");
StrPrint("第三次绕行未成功!");
StrPrint($"3D航线第三次计算之后仍有{collisionGroup.Count}架有碰撞:{mappingOutput}");
StrPrint("执行失败3D航线经过三次计算仍有碰撞。");
}
///end
t = DateTimeOffset.UtcNow.ToUnixTimeSeconds() - t;
StrPrint($"用时:{t}秒");
StrPrint($"-------3D绕行结束-------");
//StrPrint($"-------3D绕行结束-------");
return re;
}
/// <summary>