コード例 #1
0
ファイル: Graph.cpp プロジェクト: argenos/Menge
	RoadMapPath * Graph::getPath( const Agents::BaseAgent * agent, const BFSM::Goal * goal ) {
		// Find the closest visible node to agent position
		size_t startID = getClosestVertex( agent->_pos, agent->_radius );
		// Find the closest visible node to goal position
		Vector2 goalPos = goal->getCentroid();
		size_t endID = getClosestVertex( goalPos, agent->_radius );
		// Compute the path based on those nodes
		RoadMapPath * path = getPath( startID, endID );
		if ( path ) { 
			path->setGoalPos( goal );
		}
		return path;
	}
コード例 #2
0
bool KVFModel::mousePressAction(Point2 pos, double radius)
{
    Vertex v = getClosestPin(pos,radius);
    if (v == -1)
    	v = getClosestVertex(pos);

	togglePinVertex(v);
	return true;
}
コード例 #3
0
ファイル: Circle.cpp プロジェクト: thomasplain/arkanoids
AxisSet* Circle::getSeparatingAxes(const Shape* s) const
{
	AxisSet *as =  new AxisSet();

	std::auto_ptr<OrderedPair> closestPoint(s->getClosestVertex(getCentre()));

	if (s->isVertex(*closestPoint))
	{
			std::auto_ptr<OrderedPair> closestPointToVertex(getClosestVertex(*closestPoint));
		Vector separatingAxis = Vector(*closestPointToVertex)
				- Vector(*closestPoint);
		if (!(separatingAxis == Vector(0, 0)))
		{
			as->add(separatingAxis.Normalise());
		}
	}

	return as;
}