diff --git a/WireRouting_DLL/Astar.cpp b/WireRouting_DLL/Astar.cpp index 0266fe2..c760712 100644 --- a/WireRouting_DLL/Astar.cpp +++ b/WireRouting_DLL/Astar.cpp @@ -404,6 +404,8 @@ void Astar::search() bool updatePreBranchPoint = false; bool updateNextBranchPoint = false; double tempPos1 = 0, tempPos2 = 0; + + // 特殊处理分支点 if (points[xs].type == 1 || points[xs].type == 2) { int bid = points[xs].ref; @@ -460,7 +462,7 @@ void Astar::search() } int top = 0; int tag = T * 2; - while (pre[tag]) + while (pre[tag]) // pre[tag] 值为0导致无结果, { st[++top] = tag; tag = pre[tag]; diff --git a/WireRouting_DLL/BVH.cpp b/WireRouting_DLL/BVH.cpp index 3a0ffae..54725c7 100644 --- a/WireRouting_DLL/BVH.cpp +++ b/WireRouting_DLL/BVH.cpp @@ -1,6 +1,8 @@ #include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier #include "BVH.h" +BVH bvh; + bool PointInTri(Point3 &P, Point3 &P0, Point3 &P1, Point3 &P2) { double area1 = Area2(P, P0, P1); diff --git a/WireRouting_DLL/BVH.h b/WireRouting_DLL/BVH.h index f0d433a..e0a1709 100644 --- a/WireRouting_DLL/BVH.h +++ b/WireRouting_DLL/BVH.h @@ -72,3 +72,5 @@ struct BVH_API BVH void read_stl(string filename); }; + +extern BVH_API BVH bvh; \ No newline at end of file diff --git a/WireRouting_DLL/BasicChannel.cpp b/WireRouting_DLL/BasicChannel.cpp index ef8ea71..2bf2f9b 100644 --- a/WireRouting_DLL/BasicChannel.cpp +++ b/WireRouting_DLL/BasicChannel.cpp @@ -1,6 +1,8 @@ #include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier #include "BasicChannel.h" +BasicChannel basicChannel; + // 仅仅根据卡箍的相对位置创建近似的通道 void BasicChannel::createChannel() { @@ -570,8 +572,12 @@ void BasicChannel::printSingleBundle(int i, ofstream &ofs) } if (inOut != 0) tp.reverse(); + //------------------------mark------------------------ ofs << tp.x << " " << tp.y << " " << tp.z << " "; ofs << tp.dx << " " << tp.dy << " " << tp.dz << endl; + // for blender input + // ofs << tp.x * 100 << " " << tp.y * 100 << " " << tp.z * 100 << " "; + // ofs << tp.dx * 100 << " " << tp.dy * 100 << " " << tp.dz * 100 << endl; } ofs << partBranchPoint.size() << endl; for (int j = 0; j < partBranchPoint.size(); j++) diff --git a/WireRouting_DLL/BasicChannel.h b/WireRouting_DLL/BasicChannel.h index 7b064e7..ab7adcf 100644 --- a/WireRouting_DLL/BasicChannel.h +++ b/WireRouting_DLL/BasicChannel.h @@ -30,6 +30,13 @@ struct BASIC_CHANNEL_API BasicChannel int basicChannelNum; // 基本通道数量 map PointConnectedTobranchPoint[MAXPointNum]; // 连接到分支点的点 + vector>> resClip; + vector> resBranchPoint; + vector startBranchPoint; + vector endBranchPoint; + vector BundleConnectedToBranchPoint[MAXPointNum]; // 连接到分支点的通道 + int Out[N]; + // 仅仅根据卡箍的相对位置创建近似的通道 void createChannel(); @@ -88,15 +95,10 @@ struct BASIC_CHANNEL_API BasicChannel // 加入一条路径来更新通道数据 void addPath(Path path); - vector>> resClip; - vector> resBranchPoint; - vector startBranchPoint; - vector endBranchPoint; - vector BundleConnectedToBranchPoint[MAXPointNum]; // 连接到分支点的通道 - int Out[N]; - void printSingleBundle(int i, ofstream &ofs); // 把bundle信息按格式要求打印出来 void printBundle(string resultfile, bool basic = false); }; + +extern BASIC_CHANNEL_API BasicChannel basicChannel; \ No newline at end of file diff --git a/WireRouting_DLL/BasicEdge.cpp b/WireRouting_DLL/BasicEdge.cpp index 47df32c..b5068b0 100644 --- a/WireRouting_DLL/BasicEdge.cpp +++ b/WireRouting_DLL/BasicEdge.cpp @@ -1,9 +1,7 @@ #include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier #include "BasicEdge.h" -BVH bvh; - -BasicChannel basicChannel; +BasicEdge basicEdge; // 预处理分支点和卡箍之间的连线关系 void BasicEdge::buildEdgeBetweenClipAndBranchPoint() diff --git a/WireRouting_DLL/BasicEdge.h b/WireRouting_DLL/BasicEdge.h index e3a91a1..c6cbf44 100644 --- a/WireRouting_DLL/BasicEdge.h +++ b/WireRouting_DLL/BasicEdge.h @@ -20,10 +20,6 @@ #include using namespace std; -extern BVH BASIC_EDGE_API bvh; - -extern BasicChannel BASIC_EDGE_API basicChannel; - // 存储卡箍与卡箍之间,卡箍与分支点之间,分支点与分支点之间的边关系 struct BASIC_EDGE_API BasicEdge { @@ -69,4 +65,6 @@ public: // 根据新的路径更新边信息 public: void addPath(Path path); -}; \ No newline at end of file +}; + +extern BASIC_EDGE_API BasicEdge basicEdge; diff --git a/WireRouting_DLL/BranchPoint.cpp b/WireRouting_DLL/BranchPoint.cpp index d45d363..afd362e 100644 --- a/WireRouting_DLL/BranchPoint.cpp +++ b/WireRouting_DLL/BranchPoint.cpp @@ -1,6 +1,8 @@ #include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier #include "BranchPoint.h" +BranchPointSet branchPointSet; + void BranchPoint::init() { l = 0; @@ -87,6 +89,14 @@ void BranchPoint::fix() return; fixed = true; t = tempt[mode]; + /* + if(pb1!=NULL){ + pb1->pushL(t*Dis+MinBranchPointDistance-r*Dis); + } + if(pb2!=NULL){ + pb2->pushR(l*Dis-(t*Dis-MinBranchPointDistance)); + } + */ cout << "***********"; if (!Equal(t, l) && !Equal(t, r)) cout << "-------"; @@ -153,11 +163,14 @@ double BranchPoint::computeWeight(P &p, int inOut, bool reverse) // 记录分支点最优位置 void BranchPoint::recordPos(int mode) { + // if(!Equal(t,l)&&!Equal(t,r))cout<<"-------"<= 1 && id <= branchPointNum); return &b[id]; diff --git a/WireRouting_DLL/BranchPoint.h b/WireRouting_DLL/BranchPoint.h index 8ca59db..2fc7c3f 100644 --- a/WireRouting_DLL/BranchPoint.h +++ b/WireRouting_DLL/BranchPoint.h @@ -99,4 +99,6 @@ struct BRANCH_POINT_API BranchPointSet // 获取指向编号为id的分支点的指针 BranchPoint *getBranchPointPointer(int id); -}; \ No newline at end of file +}; + +extern BRANCH_POINT_API BranchPointSet branchPointSet; \ No newline at end of file diff --git a/WireRouting_DLL/BasicTree.cpp b/WireRouting_DLL/BranchTree.cpp similarity index 99% rename from WireRouting_DLL/BasicTree.cpp rename to WireRouting_DLL/BranchTree.cpp index b9ae790..b0c966b 100644 --- a/WireRouting_DLL/BasicTree.cpp +++ b/WireRouting_DLL/BranchTree.cpp @@ -1,8 +1,6 @@ #include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier #include "BranchTree.h" -BasicEdge basicEdge; - void Edge::clear() { to = 0; diff --git a/WireRouting_DLL/BranchTree.h b/WireRouting_DLL/BranchTree.h index 83dbe4d..25c7f01 100644 --- a/WireRouting_DLL/BranchTree.h +++ b/WireRouting_DLL/BranchTree.h @@ -20,8 +20,6 @@ #include using namespace std; -extern BasicEdge BRANCH_TREE_API basicEdge; - struct BRANCH_TREE_API Edge { vector wirenames; diff --git a/WireRouting_DLL/Path.cpp b/WireRouting_DLL/Path.cpp index bd04600..7a0ed08 100644 --- a/WireRouting_DLL/Path.cpp +++ b/WireRouting_DLL/Path.cpp @@ -2,7 +2,6 @@ #include "Path.h" ClipSet clipSet; -BranchPointSet branchPointSet; P dirP(P &A) { diff --git a/WireRouting_DLL/Path.h b/WireRouting_DLL/Path.h index c5344f3..440f40c 100644 --- a/WireRouting_DLL/Path.h +++ b/WireRouting_DLL/Path.h @@ -23,7 +23,6 @@ using namespace std; extern ClipSet PATH_API clipSet; -extern BranchPointSet PATH_API branchPointSet; extern P PATH_API dirP(P &A); diff --git a/WireRouting_DLL/WireRouting_DLL.vcxproj b/WireRouting_DLL/WireRouting_DLL.vcxproj index ace91d3..5eef333 100644 --- a/WireRouting_DLL/WireRouting_DLL.vcxproj +++ b/WireRouting_DLL/WireRouting_DLL.vcxproj @@ -166,8 +166,8 @@ - + diff --git a/WireRouting_DLL/WireRouting_DLL.vcxproj.filters b/WireRouting_DLL/WireRouting_DLL.vcxproj.filters index dd614d0..e89cde6 100644 --- a/WireRouting_DLL/WireRouting_DLL.vcxproj.filters +++ b/WireRouting_DLL/WireRouting_DLL.vcxproj.filters @@ -116,14 +116,14 @@ 源文件 - - 源文件 - 源文件 源文件 + + 源文件 + \ No newline at end of file