Browse Source

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

zzj 5 years ago
parent
commit
8a494133e6
2 changed files with 6 additions and 0 deletions
  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);
 	}