碰撞检测 距离参数改为5米
This commit is contained in:
parent
cf4a484d64
commit
ee1f47a448
@ -411,7 +411,7 @@ namespace FlightRouteV2
|
||||
/// <summary>
|
||||
/// 飞行过程中间距 平方值
|
||||
/// </summary>
|
||||
public static double SpaceBetweenSquare { get; set; } = 62500;
|
||||
public static double SpaceBetweenSquare { get; set; } = 250000;
|
||||
/// <summary>
|
||||
/// 算绕行时 中间取点 true在正中间取点即 一个圆盘 false在一个圆柱体内取点
|
||||
/// </summary>
|
||||
@ -1373,7 +1373,7 @@ namespace FlightRouteV2
|
||||
/// <param name="swapCount">交换次数</param>
|
||||
/// <param name="crossingLimit">交叉线路数量上限 ps:超过这个数量则不进行交换</param>
|
||||
/// <returns>新的目标点</returns>
|
||||
public static Vector3[] ContactABOut(Vector3[] aVecs, Vector3[] bVecs, SomeCalculateWay StrPrint,bool isStaticSkip = true, double staticThresholdSquare = 25 , bool isSwap = true, int swapCount = 5, int crossingLimit = 6)
|
||||
public static Vector3[] ContactABOut(Vector3[] aVecs, Vector3[] bVecs, SomeCalculateWay StrPrint,bool isStaticSkip = false, double staticThresholdSquare = 25 , bool isSwap = true, int swapCount = 5, int crossingLimit = 6)
|
||||
{
|
||||
long t = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
||||
StrPrint("-------智能选择路径计算,开始-------");
|
||||
@ -1561,7 +1561,7 @@ namespace FlightRouteV2
|
||||
/// <param name="StrPrint">日志输出 回调函数</param>
|
||||
/// <param name="layHight">错层层高</param>
|
||||
/// <returns>返回一个二维向量坐标集合 middle[0]是第一个中间航点 middle[1]是第二个中间航点 返回空数组则代表两个图形不在一个平面上或者不够4个点</returns>
|
||||
public static List<List<Vector3>> CollisionLayer(Vector3[] aVecs, Vector3[] bVecs,SomeCalculateWay StrPrint, double layHight = 185)
|
||||
public static List<List<Vector3>> CollisionLayer(Vector3[] aVecs, Vector3[] bVecs,SomeCalculateWay StrPrint, double layHight = 300)
|
||||
{
|
||||
long t = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
||||
StrPrint("-------错层,开始-------");
|
||||
@ -2056,6 +2056,7 @@ namespace FlightRouteV2
|
||||
/// <param name="aVecs">平面图案坐标组</param>
|
||||
/// <param name="bVecs">回归矩阵坐标组</param>
|
||||
/// <param name="strPrint">日志输出 回调函数</param>
|
||||
/// <param name="pullingDistance">拉散层距</param>
|
||||
/// <returns>拉散图案的坐标组</returns>
|
||||
public static Vector3[] NormalPull(Vector3[] aVecs, Vector3[] bVecs, SomeCalculateWay StrPrint,double pullingDistance = 300)
|
||||
{
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -16,12 +16,13 @@
|
||||
<Label Content="顶视图" FontSize="14" Background="#556b6b6b" Foreground="#FFDCDCDC" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0" />
|
||||
</Canvas>
|
||||
</Grid>
|
||||
|
||||
|
||||
<Grid Name="MainMenu" Width="220" Height="800" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
|
||||
<Button Content="导入航点" HorizontalAlignment="Left" VerticalAlignment="Top" Width="220" Height="49" Margin="0,0,0,0" Click="ImportFcgm_Click"/>
|
||||
<Button Content="导入映射图" HorizontalAlignment="Left" VerticalAlignment="Top" Width="220" Height="49" Margin="0,54,0,0" Click="ImportImg_Click"/>
|
||||
<Button Content="保存航点" HorizontalAlignment="Left" VerticalAlignment="Top" Width="220" Height="49" Margin="0,108,0,0" Click="ExportFcgm_Click"/>
|
||||
<Button Content="渲染" HorizontalAlignment="Left" VerticalAlignment="Top" Width="220" Height="49" Margin="0,162,0,0" Click="Render_Click"/>
|
||||
<Button Content="错层" HorizontalAlignment="Center" VerticalAlignment="Top" Width="220" Height="49" Margin="0,216,0,0" Click="CollisionLayer_Click"/>
|
||||
<Button Content="3D绕行" HorizontalAlignment="Left" VerticalAlignment="Top" Width="220" Height="49" Margin="0,270,0,0" Click="ByPass_Click"/>
|
||||
<Button Content="绕行取消" HorizontalAlignment="Left" VerticalAlignment="Top" Width="220" Height="49" Margin="0,324,0,0" Click="ByPassCancel_Click"/>
|
||||
<TextBox Name="vLogBox" HorizontalAlignment="Center" VerticalAlignment="Top" Width="220" Height="284" Margin="0,378,0,0"/>
|
||||
|
@ -75,6 +75,69 @@ namespace FlyCube
|
||||
//SaveFile(pathd, txtd);
|
||||
|
||||
}
|
||||
private async void CollisionLayer_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//资源管理器 获取航点文件路径
|
||||
FileBase.FileClass = new string[] { "航点文件" };
|
||||
FileBase.Pascal = new string[] { "*.txt" };
|
||||
string FliePath = FileBase.OpenExplorer("航点文件导入", out bool isSelect);
|
||||
if (isSelect)
|
||||
{
|
||||
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);
|
||||
Task<List<List<Vector3>>> reTask = Task.Run(() => FlyVecFun.CollisionLayer(aVecs, new_bVecs, StrPrintAsync));
|
||||
List<List<Vector3>> re = await reTask;
|
||||
|
||||
string txta = "";
|
||||
string txtb = "";
|
||||
string txtd = "";
|
||||
|
||||
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";
|
||||
}
|
||||
txtd += i + " 0" + " " + new_bVecs[i].X + " " + new_bVecs[i].Y + " " + new_bVecs[i].Z + "\r\n";
|
||||
|
||||
}
|
||||
if (re.Count > 0)
|
||||
{
|
||||
string path = "C:/Users/szdot/Desktop/a.txt";
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
SaveFile(path, txta);
|
||||
}
|
||||
if (re.Count > 1)
|
||||
{
|
||||
string path = "C:/Users/szdot/Desktop/b.txt";
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
SaveFile(path, txtb);
|
||||
}
|
||||
|
||||
string pathd = "C:/Users/szdot/Desktop/d.txt";
|
||||
if (File.Exists(pathd))
|
||||
{
|
||||
File.Delete(pathd);
|
||||
}
|
||||
SaveFile(pathd, txtd);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 3D绕行
|
||||
/// </summary>
|
||||
@ -89,13 +152,10 @@ 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);
|
||||
//Vector3[] new_aVecs = FlyVecFun.NormalPull(aVecs, bVecs, StrPrintAsync);
|
||||
|
||||
List<int> mappingId = new List<int>() { 1,2,3,4,10,7,5,8,9,6};
|
||||
|
||||
Vector3[] new_bVecs = FlyVecFun.ContactABOut(aVecs, bVecs, StrPrint);
|
||||
//Vector3[] new_aVecs = FlyVecFun.NormalPull(aVecs, bVecs, StrPrintAsync);//拉散图案
|
||||
bool isPass;
|
||||
Task<List<List<Vector3>>> reTask = Task.Run(() => FlyVecFun.ABypassB(aVecs, bVecs, StrPrintAsync, GetVal, cts.Token, out isPass, mappingId));
|
||||
Task<List<List<Vector3>>> reTask = Task.Run(() => FlyVecFun.ABypassB(aVecs, bVecs, StrPrintAsync, GetVal, cts.Token, out isPass));
|
||||
List<List<Vector3>> re = await reTask;
|
||||
|
||||
string txta = "";
|
||||
@ -117,12 +177,12 @@ namespace FlyCube
|
||||
{
|
||||
txtc += i + " 0" + " " + re[2][i].X + " " + re[2][i].Y + " " + re[2][i].Z + "\r\n";
|
||||
}
|
||||
txtd += i + " 0" + " " + bVecs[i].X + " " + bVecs[i].Y + " " + bVecs[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)
|
||||
{
|
||||
string path = "C:/Users/szdot/Desktop/a.txt";
|
||||
string path = $"C:/Users/szdot/Desktop/a.txt";
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
@ -350,7 +410,7 @@ namespace FlyCube
|
||||
MessageBox.Show("成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 灯光 组
|
||||
|
2
FlyCube/Properties/Settings.Designer.cs
generated
2
FlyCube/Properties/Settings.Designer.cs
generated
@ -12,7 +12,7 @@ namespace FlyCube.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
Loading…
Reference in New Issue
Block a user