Browse Source

添加路径测试的代码

zzj 6 years ago
parent
commit
c80d37b4c6
1 changed files with 20 additions and 0 deletions
  1. 20 0
      ant.cpp

+ 20 - 0
ant.cpp

@@ -207,6 +207,24 @@ bool visit_site_status::visit(std::shared_ptr<site> s)
 	return true;
 }
 
+static void test_find_path(card_path&cp,const point&p1,const point&p2)
+{
+	printf("\nfind-path:  from=(%.3lf,%.3lf),to=(%.3lf,%.3lf)\n",p1.x,p1.y,p2.x,p2.y);
+	std::vector<point> rc=cp.find_path(p1,p2);
+	for(uint32_t i=0;i<rc.size();i++)
+		printf("x=%.3lf,y=%.3lf\n",rc[i].x,rc[i].y);
+}
+
+static void test_find_poss_path(const card_path&cp ,const point&from)
+{
+	log_info("\nfind-poss_path:  from=(%.3lf,%.3lf)\n",from.x,from.y);
+	std::vector<line_v> rc=cp.find_possible_path(from,3);
+	for(uint32_t i=0;i<rc.size();i++)
+	{
+		log_info("poss path from=(%.3lf,%.3lf) to=(%.3lf,%.3lf)\n", rc[i][0].x,rc[i][0].y, rc[i][1].x,rc[i][1].y);
+	}
+}
+
 void sit_list::read_ant_path(int id)
 {
 	std::string sql = "SELECT reader_id,tof_flag,b_x,b_y,b_z,e_x,e_y,e_z,spacing_ratio FROM dat_reader_path_tof_n";
@@ -354,6 +372,8 @@ void sit_list::read_ant_path(int id)
 	}
 
 	card_path::init();
+
+	test_find_path(card_path::inst(),point(4714.70,-8.06),point(5427.04,-304.02));
 }
 
 void sit_list::init_site(int id)