소스 검색

去掉拐点与起始点相同的点

zzj 5 년 전
부모
커밋
8a494133e6
2개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      ant.cpp
  2. 5 0
      card_path.cpp

+ 1 - 0
ant.cpp

@@ -376,6 +376,7 @@ void sit_list::read_ant_path(int id)
 	test_find_path(card_path::inst(),point(4727,-8.06),point(2600,-100));
 	test_find_path(card_path::inst(),point(4727,-8.06),point(5427.04,-304.02));
 	test_find_path(card_path::inst(),point(4714.70,-8.06),point(5427.04,-304.02));
+	test_find_path(card_path::inst(),point(4727,-75),point(2200,-75));
 }
 
 void sit_list::init_site(int id)

+ 5 - 0
card_path.cpp

@@ -872,6 +872,11 @@ struct graph
 
 		rc.erase(it1,rc.end());
 
+		if(rc.size() && from.dist(*rc.begin())<0.1)
+		{
+			rc.erase(rc.begin());
+		}
+
 		return std::move(rc);
 	}