[−][src]Static gridly::prelude::DIAGONAL_ADJACENCIES
pub static DIAGONAL_ADJACENCIES: [Vector; 4]
This array contains unit vectors associated with the 4 diagonal directions. It is intended to allow for easy iteration over diagonally 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 corners: Vec<Location> = DIAGONAL_ADJACENCIES.iter().map(|v| root + v).collect(); assert!(corners.contains(&L(0, 1))); assert!(corners.contains(&L(0, 3))); assert!(corners.contains(&L(2, 3))); assert!(corners.contains(&L(2, 1))); assert_eq!(corners.len(), 4);