Line-of-sight simulation

40 people share a square room. Each one is assigned two others and wants to keep both within an unobstructed line of sight — no one else's body may cross the line. Everyone moves at once, each following the steepest descent of its own cost.

Click a person to follow them. Press Esc or click empty space to release.

Starting Python (Pyodide + numpy)…
clear sightline blocked sightline 0 blocked 1 blocked 2 blocked

The person drawn as a square is the one you're following; its two triangles are the targets it's trying to keep in view. The lower panel tracks the share of all sightlines that are clear over time — or, while following someone, how many of their two sightlines are clear. The entire model — angular occlusion, personal-space and wall barriers, steepest-descent dynamics with velocity/acceleration caps and hard non-overlap constraints — is the same numpy code that runs on the desktop, executing here in your browser via Pyodide (CPython compiled to WebAssembly).