2 releases
Uses new Rust 2024
| 0.1.0-rc.2 | Apr 4, 2026 |
|---|---|
| 0.1.0-rc.1 | Mar 15, 2026 |
#1097 in Algorithms
38KB
1K
SLoC
grid-map
This library provides two-dimensional grid maps.
There is support for square and hexagonal grids as well as multiple coordinate integer sizes.
Features
You must choose the scale and grid type, or use the default.
Map Configuration Examples:
# 32-bit square map
grid-map = "0.1.0-rc.2"
# 16-bit hexagonal map (with flat tops)
world-map = { package = "grid-map", version = "0.1.0-rc.2", features = ["scale-16", "hex-flat"] }
# 8-bit hexagonal map with pointy tops
city-map = { package = "grid-map", version = "0.1.0-rc.2", features = ["scale-8", "hex-pointy"] }
Scale (mutually exclusive, default: scale-32)
scale-8--u8coordinatesscale-16--u16coordinatesscale-32--u32coordinates
Grid Type (mutually exclusive, default: square)
square-- 4 directions (North, East, South, West)hex-flat-- 6 directions, flat-top hex (North, NorthEast, SouthEast, South, SouthWest, NorthWest)hex-pointy-- 6 directions, pointy-top hex (NorthEast, East, SouthEast, SouthWest, West, NorthWest)
Types
Scale-- the coordinate type (u8,u16, oru32)Dim-- grid dimensions (width, height)Loc-- grid location (x, y)Dir-- cardinal directions (varies by grid type)GridMap<T>-- a two-dimensional grid map