Nearby Flockmates

The boid similation applies three rules to each member of the flock to determine its manoeuvres.
These are based on the position and velocity of its nearby flockmates.
Which flockmates count as 'nearby' is determined by drawing a circle from the centre of the boid, with radius distance, where distance is a fixed length.
Only a certain angle of this circle can be seen, the size of the angle is again fixed, however the angle is measured from the boid's direction of flight:
Note that although this is the theory, in this implementation the boid's have 360 degree vision.
Rule 1: Separation
Separation: steer to avoid crowding local flockmates
The point of this rule, is to avoid collision with the boid's neighbours - consider the fact you never see the birds in a flock bumping into each other!
In this example the boid (indicated by the arrow coming out from it ) will head North West as in that way it will be able to get furthest away from the neighbours that are in its range ( as determined by the method above ).
NB: The boid will also consider the other two rules, and does not move alone in reaction to this rule.
Rule 2: Alignment
Alignment: Steer towards the average heading of flockmates.
This rule is one of the two rules that keeps the flock of birds together. The birds all head in generally the same direction.
NB. The central boid in this picture does not take note of what the other boids outside its range ( outside the circle in the picture ) are doing. However, in a way it does, because it's neighbours take note of the boid's within their circles of vision.
Thus in this example, the central boid will again go North West, as that is the overal direction its near neighbours are travelling.
The boid also seeks to match the speed of its nearby flockmates.
Rule 3: Cohesion
Cohesion: Steer to move towards the average position of local flockmates.
In this picture the central boid, again denoted by the directional arrow, is travelling towards the middle of its fellow boids.
In this way, the boid seeks to stay in the middle of the flock, keeping equidistance from each of its neighbours.
The extent to which each of these is the goal, is sometimes ( and indeed is within this site's simulation ) alterable.