예제 #1
0
파일: a_star.cpp 프로젝트: Arroon/openage
Path to_point(coord::phys3 start,
              coord::phys3 end,
              std::function<bool(const coord::phys3 &)> passable) {
	auto valid_end = [&](const coord::phys3 &point) -> bool {
		coord::phys_t dx = point.ne - end.ne;
		coord::phys_t dy = point.se - end.se;
		return std::hypot(dx, dy) < path_grid_size;
	};
	auto h = [&](const coord::phys3 &point) -> cost_t { return euclidean_cost(point, end); };
	return a_star(start, valid_end, h, passable);
}
예제 #2
0
파일: a_star.cpp 프로젝트: SFTtech/openage
Path to_point(coord::phys3 start,
              coord::phys3 end,
              std::function<bool(const coord::phys3 &)> passable) {

	auto valid_end = [&](const coord::phys3 &point) -> bool {
		return euclidean_squared_cost(point, end) < path_grid_size.to_float();
	};
	auto heuristic = [&](const coord::phys3 &point) -> cost_t {
		return euclidean_cost(point, end);
	};
	return a_star(start, valid_end, heuristic, passable);
}