Exemplo n.º 1
0
std::vector<HFAEntry*> HFAEntry::FindChildren( const char *pszName,
                                               const char *pszType)

{
    int bErrorDetected = FALSE;
    return FindChildren(pszName, pszType, 0, &bErrorDetected);
}
Exemplo n.º 2
0
node A_Star(const scalar& size, const std::vector<std::vector<char> >& obstacles, std::set<node>* closed_set,cv::Mat* graphical_display, cv::VideoWriter& writer) {

	static const int kImageScale = 600/size.y;
	node goal_node;
	goal_node.state.x = size.x-1;
	goal_node.state.y = 0;

	node initial;
	initial.parent(0,0);
	initial.state.x = 0;
	initial.state.y = size.y-1;
	initial.path_cost = 0;
	initial.heuristic_cost = sqrt(pow(size.x-1,2)+pow(size.y-1,2));

	OpenSetType open_set;
	open_set.insert(initial);

	while(open_set.size() > 0) {
		node current = *(open_set.begin());
		if((open_set.begin()->state==goal_node.state)) {
			return current;
		}
		open_set.erase(open_set.begin());
		closed_set->insert(current);
		FindChildren(size,obstacles,&current);

		PushChildren(goal_node,current,&open_set,closed_set);

		for(int x=0;x<kImageScale;x++) {
			for(int y=0;y<kImageScale;y++) {
				graphical_display->at<cv::Vec3b>(current.state.y*kImageScale+y,current.state.x*kImageScale+x)[1]=255;
			}
		}

		imshow("progress",*graphical_display);
		writer<<*graphical_display;
		cv::waitKey(1);

	}
	//if we get this far there was no path found
	node no_path;
	no_path.state.x=-1;
	return no_path;
}
Exemplo n.º 3
0
ActorPtr Actor::FindChildren(const std::string& name) {
	return FindChildren([&](const Actor& actor) {
		return actor.GetName() == name;
	});
}