Browse Source

调整参数实现多线缆

取消求交
divide_struct_def_imp
郑敬润 10 months ago
parent
commit
3429655999
  1. 65
      data/Tinyroute_test/temp/START_A-F.xml
  2. 25
      data/Tinyroute_test/temp/START_END.xml
  3. 2
      include/Astar.h
  4. 24
      include/Const.h

65
data/Tinyroute_test/temp/START_A-F.xml

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project PUBLIC "-//Mentor Graphics Corporation//Project 2014.1//EN" "D:/MentorGraphics/Capital/dtd/project.dtd">
<!-- Application Version: 2014.1.SP1610.27 [Build 4] - 25 September 2016 (17:59 IST)-->
<project>
<designmgr>
<harnessdesign>
<harnesscontainer>
<connectivity id="_1000">
<connector id="_1001" name="START" partnumber="0000">
<pin id="_1002" name="start">
</pin>
</connector>
<connector id="_1003" name="A" partnumber="0000">
<pin id="_1004" name="a">
</pin>
</connector>
<connector id="_1005" name="B" partnumber="0000">
<pin id="_1006" name="b">
</pin>
</connector>
<connector id="_1007" name="C" partnumber="0000">
<pin id="_1008" name="c">
</pin>
</connector>
<connector id="_1009" name="D" partnumber="0000">
<pin id="_1010" name="d">
</pin>
</connector>
<connector id="_1011" name="E" partnumber="0000">
<pin id="_1012" name="e">
</pin>
</connector>
<connector id="_1013" name="F" partnumber="0000">
<pin id="_1014" name="f">
</pin>
</connector>
<wire id="_2002" name="Stoa" wirecsa="0.616" outsidediameter="1.415">
<connection pinref="_1002"/>
<connection pinref="_1004"/>
</wire>
<wire id="_2003" name="Stoa" wirecsa="0.616" outsidediameter="1.415">
<connection pinref="_1002"/>
<connection pinref="_1006"/>
</wire>
<wire id="_2004" name="Stoa" wirecsa="0.616" outsidediameter="1.415">
<connection pinref="_1002"/>
<connection pinref="_1008"/>
</wire>
<wire id="_2005" name="Stoa" wirecsa="0.616" outsidediameter="1.415">
<connection pinref="_1002"/>
<connection pinref="_1010"/>
</wire>
<wire id="_2006" name="Stoa" wirecsa="0.616" outsidediameter="1.415">
<connection pinref="_1002"/>
<connection pinref="_1012"/>
</wire>
<wire id="_2007" name="Stoa" wirecsa="0.616" outsidediameter="1.415">
<connection pinref="_1002"/>
<connection pinref="_1014"/>
</wire>
</connectivity>
</harnesscontainer>
</harnessdesign>
</designmgr>
</project>

25
data/Tinyroute_test/temp/START_END.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project PUBLIC "-//Mentor Graphics Corporation//Project 2014.1//EN" "D:/MentorGraphics/Capital/dtd/project.dtd">
<!-- Application Version: 2014.1.SP1610.27 [Build 4] - 25 September 2016 (17:59 IST)-->
<project>
<designmgr>
<harnessdesign>
<harnesscontainer>
<connectivity id="_1000">
<connector id="_1001" name="START" partnumber="0000">
<pin id="_1002" name="start">
</pin>
</connector>
<connector id="_1021" name="END" partnumber="0000">
<pin id="_1022" name="end">
</pin>
</connector>
<wire id="_2001" name="Stoa" wirecsa="0.616" outsidediameter="1.415">
<connection pinref="_1002"/>
<connection pinref="_1022"/>
</wire>
</connectivity>
</harnesscontainer>
</harnessdesign>
</designmgr>
</project>

2
include/Astar.h

@ -505,7 +505,7 @@ struct Astar
}
int top = 0;
int tag = T * 2;
while (pre[tag]) // pre[tag] 不存在导致无结果,
while (pre[tag]) // pre[tag] 值为0导致无结果,
{
st[++top] = tag;
tag = pre[tag];

24
include/Const.h

@ -15,21 +15,21 @@ using namespace std;
// 该文件定义一些基本常量和通用函数
const int M = 10010; // 连接器数量
const int N = 5010; // 卡箍数量
const int N = 8010; // 卡箍数量
const int MaxSTL = 210000; // STL文件最大面片数
const double MAXDia = 50; // 卡箍能容纳的最大直径
const int maxCap = 50; // 卡箍能容纳的最大线缆数
const double pi = acos(-1.0); // Π
const double minAngle = pi / 144; // 判断平行和垂直的偏差阈值
const double minDis = 30; //
//const double minDis = 30; //*
const double R = 2000; // 飞机横截面的近似半径
const double MARGIN = 1000; // 布线的空间范围,从STL模型向外延申的长度
//----------------------mark----------------------
const int MAXBranchPointNumOnSegment = 2; // 分支上的最大分支点数
const int MAXPointNum = N + MAXBranchPointNumOnSegment * N; // 最大分支点数加最大卡箍数
double segmentLength = 0.8; //*卡箍到卡箍之间的最长距离,default:0.8
const double MinClipToBranchPointDistance = 55; // 卡箍到分支点的最短距离,default:55
const double MinBranchPointDistance = 55; // 分支点到分支点的最短距离,default:55
double segmentLength = 3000; // *卡箍到卡箍之间的最长距离
const double MinClipToBranchPointDistance = 11; // 卡箍到分支点的最短距离
const double MinBranchPointDistance = 11; // 分支点到分支点的最短距离
P DX = P(1, 0, 0);
P DY = P(0, 1, 0);
@ -42,7 +42,7 @@ double MAXX = -1e9, MINX = 1e9, MAXY = -1e9, MINY = 1e9, MAXZ = -1e9, MINZ = 1e9
vector<Vec3f> vertices; // VS2008
vector<Vec3u> indices; // VS2008
Mesh mesh;
const double intersection_distance = 1;
const double intersection_distance = 100; //*
int intersection_model = 0;
typedef P Point3;
@ -145,7 +145,8 @@ inline double distan(P A, P B, int inOut1, int inOut2)
double len = distan1(A, B);
// 求交判断并赋值惩罚参数
if (intersection_model == 1)
// if (intersection_model == 1)
if (0)
{
LineSegment lineSegment(Vec3f(A.x, A.y, A.z), Vec3f(B.x, B.y, B.z));
static BVH_intersection bvh(mesh);
@ -202,7 +203,7 @@ inline double distan(P A, P B, int inOut1, int inOut2)
// return pow(len,angel*3+1);
double orign_distance = len * (angel * 4 + 1) + 300 * 600 * (angel2 + angel3) / len;
// double orign_distance=len*(angel*0.4+1)+300*600*(angel2+angel3)/len;
// cout<<"dir:"<<orign_distance<<" "<<"patch_par"<<patch_par<<endl;
// return len*(angel*4+1)+300*600*(angel2+angel3)/len;
return orign_distance * penalty_par_intersection * penalty_par_distance;
@ -225,7 +226,8 @@ inline double distan(P A, P B)
angel = min(angel, pi / 2 - angel);
double len = distan1(A, B);
if (intersection_model == 1)
// if (intersection_model == 1)
if(0)
{
LineSegment lineSegment(Vec3f(A.x, A.y, A.z), Vec3f(B.x, B.y, B.z));
static BVH_intersection bvh(mesh);
@ -278,7 +280,9 @@ inline double distan(P A, P B)
// return pow(len,angel*3+1);
double orign_distance = len * (angel * 4 + 1) + 300 * 600 * (angel2 + angel3) / len;
return orign_distance * penalty_par_intersection;
// double orign_distance=len*(angel*0.4+1)+300*600*(angel2+angel3)/len;
return orign_distance * penalty_par_intersection * penalty_par_distance;
// return orign_distance * penalty_par_intersection;
}
// 打印路径信息

Loading…
Cancel
Save