Robert Garrett c48fe1ed2e Add unit tests for force functions
Finally time to just use the unit testing tools Cargo gives me. These
are all a bunch of simple tests to verify that the functions work as
expected.

... They don't. I made the assertion that the input ranges are (0, 1)
when, in fact, they are not. The boid's view distance is scaled into
a unit vector space. The trouble with this is that a valid coordinate
is (-1, 0). The force functions don't have the correct shape at this
range.

The fix is to get the absolute value -- the vector's magnitude -- and
feed that through the force calculation function. This way it *is* in
the range (0, 1). The magnitude can then be multiplied back over the
deviation vector to get a proper force application.

This unit vector can then optionally be multiplied back up to have more
exaggerated effects. The {COHESION,SEPARATION,ALIGNMENT}_FACTOR's can
pick up that role again.
2024-07-15 11:38:39 -05:00
2024-07-15 11:38:39 -05:00
2024-07-05 08:45:34 -05:00
Description
A Boids implementation in Rust and Bevy, with a WASM build.
AGPL-3.0 84 MiB
Languages
Rust 76.5%
HTML 12.4%
Makefile 9.7%
Dockerfile 1.4%