Handbook
Glossary
wrap-pos-in ( pos dim -- pos )
Vocabulary
boids
.
simulation
Inputs
pos
a
sequence
dim
a
sequence
Outputs
pos
a
sequence
Word description
Wraps a position into the given dimensions. Each extent is clamped to at least one so temporarily empty layouts remain usable.
Definition
USING:
kernel
math
math.order
sequences
;
IN:
boids.simulation
:
wrap-pos-in
( pos dim -- pos )
[
1
max
[
mod
]
keep
[
+
]
keep
mod
]
2map
;