Static gridly::prelude::ORTHOGONAL_ADJACENCIES
source · pub static ORTHOGONAL_ADJACENCIES: [Vector; 4]
Expand description
This array contains unit vectors associated with the 4 orthogonally adjacent directions. It is intended to allow for easy iteration over orthogonally adjacent locations. The order of the vectors is unspecified and should not be relied upon.
Example
use gridly::prelude::*;
use gridly::shorthand::*;
let root = L(1, 2);
let adjacent: Vec<Location> = ORTHOGONAL_ADJACENCIES.iter().map(|v| root + v).collect();
assert!(adjacent.contains(&L(0, 2)));
assert!(adjacent.contains(&L(2, 2)));
assert!(adjacent.contains(&L(1, 3)));
assert!(adjacent.contains(&L(1, 1)));
assert_eq!(adjacent.len(), 4);