Add square-grid neighbor queries #6
Loading…
Reference in a new issue
No description provided.
Delete branch "fputs/grid"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds square-grid queries on
lfmath.h: bounds, Manhattan, Chebyshev, and 4- and 8-neighbor lists. No allocation. A too-small destination is left unchanged. Neighbor order is east, north, west, south, then northeast, northwest, southwest, southeast.+xis east and+yis north. Coordinates that would overflowintare omitted. This does not go throughbresenham.Chebyshev is
max(|dx|, |dy|).(0,0)to(3,4)is Chebyshev 4 and Manhattan 7. The brief's parenthetical said 3 and 7; 3 is not the Chebyshev distance, so the test expects 4.Tested with
-DCMAKE_BUILD_TYPE=Debug -DFLINT_SANITIZE=ON -DCMAKE_C_EXTENSIONS=OFF.ctest --label-exclude slow: 25/25 passed.