Flocking is a term applied to the behavior of birds and other flying animals that are organized into a swarm or flock.
From our point of view, it is especially interesting that flocking behavior can be simulated by applying only three rules to each particle (Boid). These rules are as follows:
We will implement the rules for flocking behavior. Perform the following steps to do so:
Change the number of the particles, their radius, and mass.
int numParticle = 50; float radius = 5.f; float mass = 1.f;
Add a definition for new methods and properties to the
Particle
class inside theParticle.h
header file.void flock(std::vector<Particle*>& particles); ci::Vec2f steer(ci::Vec2f target,...