Example #1
0
/*=====================================================================*/
void Environment::displayAgent()
{
	assert( gVars.gpGraphicMgr != NULL );

	_vector_cit it=_vector.begin(), end=_vector.end();
	for (; it != end; ++it) {
		if (*it) {
			Agent *agent = *it;
			float x = agent->getX();
			float y = agent->getY();
			_last_pos_it last = _last_pos.find(agent);
			if (last != _last_pos.end()) {
				unsigned int dt = _pKernel->getStep() - last->second.step;
				if (dt  < 3) {
					int lastx = last->second.x;
					int lasty = last->second.y;
					x = x + (x - lastx) * dt / 3;
					y = y + (y - lasty) * dt / 3;
				}
				else {
					_last_pos.erase(last);
				}
			}
			gVars.gpGraphicMgr->DisplayAgent(x, y, agent);
// debug
//			cout << "Registered agent with GC : " << (*it)->GetGraphicCode() << endl;
		}
	}
}
Example #2
0
void Agent::addNeigbor(const Agent& agent)
{
    size_t oldSize = nXVec_.size();
    nXVec_.resize(oldSize + 1);
    nYVec_.resize(oldSize + 1);
    nYawVec_.resize(oldSize + 1);
    nXVec_[oldSize] = agent.getX();
    nYVec_[oldSize] = agent.getY();
    nYawVec_[oldSize] = agent.getYaw();
}