Class alignment_force

Inheritance Relationships

Base Type

  • public rer::client< alignment_force >

Class Documentation

class alignment_force : public rer::client<alignment_force>

A force pulling an agent towards a single other agent, or towards the centroid of the positions of a set of agents.

From FLOCK:Bagarti2018-stochfov.

Public Functions

explicit alignment_force(const config::alignment_force_config *config)
rmath::vector2d operator()(const boid &agent, const std::vector<rmath::vector2d> &others) const

Calculate the force.

Parameters:
  • agent – The current agent.

  • neighbors – The velocities of the neighbors of agent.

Returns:

The heading correction the agent should take to stay aligned with the average position of neighbors.