2.3 Measuring the swarm
2.3.1 Measures (SwarmMetrics)
| Measure | Range | Definition |
|---|---|---|
| polarization | 0 – 1 | length of the mean unit heading \|Σ v̂ᵢ\| / N: 0 = headings cancel, 1 = all aligned |
| centroid | px | circular mean per axis, correct for groups straddling an edge |
| diameter | px | largest distance between two members |
| elongation | 0 – 1 | 1 − √(λ₂/λ₁) from the position covariance: 0 = round, 1 = a line |
2.3.2 Flocks and their identity
A flock is a group of boids connected through their interaction radius: two boids are linked when they are within max(alignment, cohesion) of each other, i.e. when they influence each other. Groups of at least 5 boids count. Each flock is measured with the same four measures as the whole swarm.
- Why it matters: when the swarm splits, the whole-swarm centroid lies between the flocks where no boid is, and whole-swarm polarization cancels out. Five tightly aligned flocks (polarization ≈ 0.9 each) can give a whole-swarm polarization of 0.23: a single drone for the whole swarm would play disorder while the screen shows order.
- Identity: every frame, each flock is matched to the previous frame's flocks by shared boids. On a split the biggest part keeps the identity; on a merge the merged flock continues its biggest part.
- Stability: a group must exist for 0.5 s before it is an established flock, and a vanished flock is remembered for 0.33 s. Flicker produces a dip in sound, not a pop.
2.3.3 Encounters (SwarmEvents)
An encounter is the moment two boids enter each other's separation radius. It fires once on entering, not while they stay close. A pair only counts as apart again 12.5 px beyond the radius (hysteresis): without it, pairs jittering at the boundary would re-trigger every frame — over 1,000 encounters per second, pinning the sound at its limit. With it: about 16 – 40 per second, varying with how the swarm moves. The margin is fixed rather than growing with the radius, so that even a jammed swarm can part and meet again: at high separation the stage allows only about 131 px between 120 boids, and the jam rains quietly instead of falling silent.