Vec2f Animal::getCohesionForce(vector<Animal> animals, float dist) { float neighbourDist = dist; Vec2f sum = Vec2f(0, 0); int count = 0; for (vector<Animal>::iterator it = animals.begin(); it != animals.end(); ++it) { if (isNear(*it, neighbourDist)) { sum = sum + pointToVec(it->getPos()); count++; } } if (count > 0) { sum = sum / count; return getSeek(sum); } else { return Vec2f(0, 0); } }
bool FileAsset::isEOF() const { return getSeek() == getSize(); }
bool Sound::finish() const { return getSeek() >= 1.0f; }