Handbook
Glossary
simulate ( boids behaviors dt -- boids )
Vocabulary
boids
.
simulation
Inputs
boids
an
object
behaviors
an
object
dt
an
object
Outputs
boids
an
object
Definition
USING:
accessors
kernel
math.vectors
sequences
;
IN:
boids.simulation
::
simulate
( boids behaviors dt -- boids )
boids
[|
boid |
boid boids behaviors
[
[
(force)
]
keep
weight>>
v*n
]
2with
map
vsum
:>
a boid
vel>>
a dt
v*n
v+
normalize
:>
vel boid
pos>>
vel dt
v*n
v+
wrap-pos
:>
pos pos vel
<boid>
]
map
;