Handbook
Glossary
force ( neighbors boid behavior -- force )
Vocabulary
boids
.
simulation
Inputs
neighbors
an
object
boid
an
object
behavior
an
object
Outputs
force
an
object
Definition
IN:
boids.simulation
GENERIC:
force
( neighbors boid behavior -- force )
Methods
USING:
accessors
boids.simulation
kernel
math.vectors
sequences
;
M:
alignment
force
2drop
[
vel>>
]
map
vsum
normalize
;
USING:
accessors
boids.simulation
kernel
math.vectors
sequences
;
M:
cohesion
force
drop
[
[
pos>>
]
map
vavg
]
[
pos>>
]
bi*
v-
normalize
;
USING:
accessors
boids.simulation
kernel
math.vectors
sequences
;
M::
separation
force
( neighbors boid behavior -- force )
behavior
radius>>
:>
r boid
pos>>
neighbors
[
pos>>
v-
[
normalize
]
[
r
v/n
]
bi
v-
]
with
map
vsum
;