Repository navigation
Separation
Início / Home · Fundamentos / Foundations
Cada vizinho próximo contribui com uma pequena repulsão. Quanto mais perto, maior sua contribuição. A média dessas contribuições impede que o número de vizinhos sozinho multiplique a força de separação.
English. Each neighbor contributes repulsion, strongest nearby and fading linearly to zero at the radius. Averaging prevents neighbor count alone from multiplying the result.
Diagrama esquemático, sem escala. Azul: agente/velocidade; laranja: alvo/geometria; verde: decisão desejada. Setas representam grandezas distintas, não uma trajetória calculada. Schematic, not to scale. Blue: agent/velocity; orange: target/geometry; green: desired decision. Arrows represent different quantities, not a simulated trajectory.
Notação e funções auxiliares: Fundamentos. O resultado a é
aceleração; apenas o engine integra a posição. This is implementation-oriented
pseudocode, with helpers defined in Foundations; the engine integrates the result.
N = neighborsFor(originalAgent, radius=R)
contributions = []
for other in N:
away = p - other.position
contributions.append(normalize(away) * (1 - length(away)/R))
return limit(A * mean(contributions), A)
| Entrada / Input | Efeito e ajuste / Effect and tuning |
|---|---|
neighborhood |
Observação única do quadro / shared current-frame observation. |
radius = 25 |
R positivo; dentro dele a repulsão cresce linearmente / positive interaction radius. |
Abra esta cena no laboratório / Open this lab scene
Pause, avance um passo e compare os vetores com o diagrama acima. Pause, single-step and compare the vectors with the diagram above.
Importe package:steering_engine/steering_engine.dart. Os trechos abaixo mostram
a configuração; agent, dt, agents e targetSnapshot, quando usados, são
snapshots do quadro atual. Veja o loop completo.
Import the public package; these are configuration snippets in the complete loop
from Foundations, using current-frame snapshots where applicable.
final observed = AgentNeighborhood(agents);
final behavior = Separation(observed, radius: 25);Um único vizinho em (5,0), com p=(0,0), R=10 e A=20: a=(-10,0). Dois vizinhos simétricos cancelam. / A single neighbor yields (-10,0); symmetric contributions cancel.
Não resolve colisões. Sobreposição exata contribui zero: não existe direção geométrica única. No limite R a contribuição é zero. Não subtrai a velocidade atual. / No collision solver, no invented overlap direction and no velocity matching.
- Código / Source
- Alignment · Cohesion · Flocking
- Receitas e diagnóstico / Recipes and troubleshooting
As fórmulas descrevem esta biblioteca, que adapta os conceitos de Reynolds. These formulas describe this implementation; conceptual references are listed on Home.
Home · Repositório / Repository · MIT
Português e English em cada página / in every chapter. Diagramas conceituais, sem escala / conceptual diagrams, not to scale.
steering_engine
- Home
- Fundamentos / Foundations
- Individual
- Composição / Composition
- Navegação / Navigation
- Grupo / Group
- Índice espacial / Spatial index
- Receitas / Recipes