|
@@ -9,10 +9,12 @@
|
|
|
#include "zlist.h"
|
|
|
#include "line.h"
|
|
|
#include "ant.h"
|
|
|
+#include "config_file.h"
|
|
|
|
|
|
#include "card_path.h"
|
|
|
#include "visit.h"
|
|
|
|
|
|
+extern config_file config;
|
|
|
namespace{
|
|
|
|
|
|
static const double PI=3.1416;
|
|
@@ -196,7 +198,7 @@ void log_path(const std::vector<base_path>&path,const vertex_list&v_list)
|
|
|
for(int i=0,len=path.size();i<len;i++)
|
|
|
{
|
|
|
double c=path[i].arg(v_list)/PI*180;
|
|
|
- log_info("base_path %.6lf, %03d,(%d,%s),(%d,%s)\n",c,i,path[i][0],v_list[path[i][0]].to_string().c_str(),path[i][1],v_list[path[i][1]].to_string().c_str());
|
|
|
+ log_info("base_path %.6lf, %03d,(%d,%s),(%d,%s)",c,i,path[i][0],v_list[path[i][0]].to_string().c_str(),path[i][1],v_list[path[i][1]].to_string().c_str());
|
|
|
}
|
|
|
}
|
|
|
struct handle_path :visitor<std::shared_ptr<site>>
|
|
@@ -403,6 +405,44 @@ static std::vector<base_path> init_path(std::vector<base_path> & ret,vertex_list
|
|
|
log_path(ret,v);
|
|
|
#endif
|
|
|
|
|
|
+ //非路径交点配置
|
|
|
+ std::vector<point> no_cross;
|
|
|
+ auto in_no_cross=[&no_cross](const point&pt){
|
|
|
+ for(auto p:no_cross)
|
|
|
+ {
|
|
|
+ if(p.dist(pt)<3)
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ };
|
|
|
+
|
|
|
+ do
|
|
|
+ {
|
|
|
+ config_file cfg;
|
|
|
+ if(cfg.open("../etc/path-not-cross.ini"))
|
|
|
+ break;
|
|
|
+
|
|
|
+ auto kset=cfg.keys();
|
|
|
+ if(kset.empty())
|
|
|
+ break;
|
|
|
+
|
|
|
+ for(auto k:kset)
|
|
|
+ {
|
|
|
+ const char* v=cfg.get(k,"");
|
|
|
+
|
|
|
+ point tmp;
|
|
|
+ if(sscanf(v,"%lf,%lf",&tmp.x,&tmp.y)==2)
|
|
|
+ no_cross.push_back(tmp);
|
|
|
+ }
|
|
|
+
|
|
|
+ for(auto p:no_cross)
|
|
|
+ {
|
|
|
+ log_info("no_cross_point:x=%lf,y=%lf",p.x,p.y);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }while(1);
|
|
|
+
|
|
|
std::vector<std::vector<int>> p0(ret.size());
|
|
|
std::vector<base_path> ret2;
|
|
|
for(int i=0,len=ret.size();i<len;i++)
|
|
@@ -416,6 +456,9 @@ static std::vector<base_path> init_path(std::vector<base_path> & ret,vertex_list
|
|
|
if(cr.empty())
|
|
|
continue;
|
|
|
|
|
|
+ if(in_no_cross(cr))
|
|
|
+ continue;
|
|
|
+
|
|
|
double arg=fabs(ret[i].as_line(v).arg()-ret[j].as_line(v).arg());
|
|
|
while(arg>PI/2)
|
|
|
arg-=PI/2;
|