murk-space 0.1.9

Spatial data structures and field storage for Murk simulations
Documentation

murk-space

Spatial backends for the Murk simulation engine.

Provides the Space trait and concrete lattice backends: Line1D, Ring1D, Square4, Square8, Hex2D, Fcc12, and composable ProductSpace. Each backend defines topology, neighborhoods, edge behavior, and region planning.

Available via the top-level murk crate as murk::space.

Installation

cargo add murk-space

Most users should depend on the top-level murk crate, which re-exports this as murk::space.

Usage

use murk_space::{Square4, EdgeBehavior, Space};

let grid = Square4::new(16, 16, EdgeBehavior::Absorb).unwrap();
assert_eq!(grid.cell_count(), 256);
assert_eq!(grid.ndim(), 2);

let coord = vec![2i32, 3].into();
let neighbors = grid.neighbours(&coord);
assert_eq!(neighbors.len(), 4);

let distance = grid.distance(&vec![0i32, 0].into(), &vec![3i32, 4].into());
assert_eq!(distance, 7.0);

Documentation