# Boids 鸟群 — Reynolds 三原则

由分离、对齐、聚合三条局部规则涌现的群体行为

> 标准页面: https://elysiatools.com/zh/visualizations/boids-flocking-reynolds

- **分类:** Math

## 概述

Interactive Boids flocking simulation — Craig Reynolds' 1986 model where lifelike group behavior emerges from only three local rules (no global leader): separation (steer to avoid crowding), alignment (match neighbour heading), cohesion (steer toward neighbour centroid). Distinct from existing agent-based cases (Langton ant = single-agent cellular automaton on a lattice; Schelling segregation = discrete-grid game theory) — this is continuous-space multi-agent swarm dynamics with emergent polarization, milling, splitting and re-merging. Neighbour lookup uses a uniform spatial-hash grid so each boid checks only its own cell + 8 neighbours, keeping the whole step O(n) and smooth up to 500 boids. Three independent sliders (0–3) control the separation/alignment/cohesion weights, plus population (10–500), vision radius, and max speed. 5 presets: classic, tight ball, loose swarm, milling, streaming. Click the canvas to drop a grey predator — boids within its threat radius flee directly away (polarization drops), then cohesion/alignment self-heal the flock once the predator leaves, mimicking real starling murmurations. Live metrics: polarization (|mean velocity direction|, 0=chaos to 1=uniform), mean speed, centroid, predator count, with a polarization bar. Optional overlays: centroid trail and per-boid vision-radius rings. Integration uses semi-implicit Euler with wrap-around (toroidal) boundaries and per-boid speed clamping. Verified by 53 model tests (vector math, spatial-hash cross-cell queries, force directions, wrap-around, emergent polarization rise, predator flight+recovery). Educational content covers the three Reynolds rules, emergence and self-organization, local perception and the spatial hash, predator escape and self-healing re-grouping, and applications (films like Batman Returns / LOTR, swarm robotics, UAV coordination, particle swarm optimization). Multi-language support (zh, en, es, fr, de, ru, pt).

## 相关内容

- [零级反应 - Zero-Order Reaction](https://elysiatools.com/zh/visualizations/zero-order-reaction): 零级反应动力学和浓度随时间变化的交互式可视化
- [一级反应 - First-Order Reaction](https://elysiatools.com/zh/visualizations/first-order-reaction): 一级反应动力学和指数浓度衰减的交互式可视化
- [二级反应 - Second-Order Reaction](https://elysiatools.com/zh/visualizations/second-order-reaction): 二级反应动力学和双分子碰撞动力学的交互式可视化
- [阿伦尼乌斯方程 - Arrhenius Equation](https://elysiatools.com/zh/visualizations/arrhenius-equation): 温度对反应速率影响的交互式可视化 - 探索活化能、指数因子和速率常数的关系
- [可逆反应 - Reversible Reaction](https://elysiatools.com/zh/visualizations/reversible-reaction): A ⇌ B 可逆反应动力学的交互式可视化 - 探索正逆反应速率、平衡常数和浓度随时间的变化
- [连续反应 - Consecutive Reaction](https://elysiatools.com/zh/visualizations/consecutive-reaction): A → B → C 连续反应动力学的交互式可视化 - 探索中间物浓度峰值、决速步和所有物种的完整演化
- [链式反应 - Chain Reaction](https://elysiatools.com/zh/visualizations/chain-reaction): 自由基链式反应聚合的交互式可视化 - 探索引发、增长、终止步骤，链增长动画和分子量分布
- [勒夏特列原理 - Le Chatelier's Principle](https://elysiatools.com/zh/visualizations/le-chateliers-principle): 勒夏特列原理的交互式可视化 - 探索浓度、压强和温度变化如何影响化学平衡，配合分子动力学动画展示平衡移动过程
