| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -21,9 +21,9 @@ 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 R = 2000;			  // 飞机横截面的近似半径
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					const double MARGIN = 1000;		  // 布线的空间范围,从STL模型向外延申的长度
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					// const double minDis = 30;		  //*
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					const double R = 2000;		// 飞机横截面的近似半径
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					const double MARGIN = 1000; // 布线的空间范围,从STL模型向外延申的长度
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					//----------------------mark----------------------
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					const int MAXBranchPointNumOnSegment = 2;					// 分支上的最大分支点数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					const int MAXPointNum = N + MAXBranchPointNumOnSegment * N; // 最大分支点数加最大卡箍数
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -145,8 +145,8 @@ inline double distan(P A, P B, int inOut1, int inOut2) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						double len = distan1(A, B); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						// 求交判断并赋值惩罚参数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						// if (intersection_model == 1) 
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						if (0) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						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); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -154,13 +154,14 @@ inline double distan(P A, P B, int inOut1, int inOut2) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (hit == 0) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								penalty_par_intersection = 1; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							else | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								penalty_par_intersection = 400; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								penalty_par_intersection = 100; //*原400
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							cout << "out: len:" << len << " intersection_distance" << intersection_distance << endl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//----------------------mark-----------------------//
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							// 注释效果好
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							// if(len>intersection_distance)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							// 	penalty_par_distance=8;
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							// else
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							// 	penalty_par_distance=1;
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							// 注释下面效果可能好
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (len > intersection_distance) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								penalty_par_distance = 8; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							else | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								penalty_par_distance = 1; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						double len1 = sqrt((A.y - Ycenter) * (A.y - Ycenter) + (A.z - Zcenter) * (A.z - Zcenter)); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -226,8 +227,8 @@ inline double distan(P A, P B) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						angel = min(angel, pi / 2 - angel); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						double len = distan1(A, B); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						// if (intersection_model == 1)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						if(0) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						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); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -235,7 +236,8 @@ inline double distan(P A, P B) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (hit == 0) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								penalty_par_intersection = 1; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							else | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								penalty_par_intersection = 400; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								penalty_par_intersection = 100; //*原400
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							cout << "no_out: len:" << len << " intersection_distance" << intersection_distance << endl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (len > intersection_distance) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								penalty_par_distance = 8; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							else | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |