Commit ee13f58e authored by VAN TOLL Wouter's avatar VAN TOLL Wouter
Browse files

Agent::getNeighborSubsetInRange(): Added an efficient shortcut for when the...

Agent::getNeighborSubsetInRange(): Added an efficient shortcut for when the requested "subset" is simply the entire set of neighbors.
parent 67e46498
......@@ -98,6 +98,11 @@ void Agent::UpdateVelocityAndPosition(float dt)
NeighborList Agent::getNeighborSubsetInRange(float range) const
{
// if the requested range is big enough, simply return all neighbors that were already computed
if (range >= settings_.policy_->getInteractionRange())
return neighbors_;
// otherwise, create a new list that contains a subset
NeighborList result;
// add all neighboring agents in range
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment