Skip to main content

Module hex

Module hex 

Source
Expand description

Hexagonal grid support for pointy-top axial coordinates.

This module provides hex-grid counterparts of the square-grid types in the parent crate: 6-connected graph construction, BFS traversal, smoothness analysis, D6 alignment transforms, and rectification.

§Coordinate Convention

Axial coordinates (q, r) are stored in GridIndex where i = q and j = r. Pointy-top orientation: q increases eastward, r increases south-eastward.

Re-exports§

pub use alignment::GRID_TRANSFORMS_D6;
pub use direction::HexDirection;
pub use direction::HexNodeNeighbor;
pub use graph::HexGridGraph;
pub use graph::HexNeighborValidator;
pub use mesh::AffineTransform2D;
pub use mesh::HexGridHomographyMesh;
pub use mesh::HexMeshError;
pub use rectify::HexGridHomography;
pub use rectify::HexRectifyError;
pub use smoothness::hex_find_inconsistent_corners;
pub use smoothness::hex_predict_grid_position;
pub use traverse::hex_assign_grid_coordinates;
pub use traverse::hex_connected_components;
pub use validators::SpatialHexValidator;

Modules§

alignment
Dihedral group D6 transforms for hexagonal grids in axial coordinates.
direction
Hex grid directions and neighbor metadata for pointy-top axial coordinates.
graph
6-connected hex grid graph construction via KD-tree spatial search.
mesh
Per-triangle homography mesh for hex grid rectification.
rectify
Single global homography from hex grid corners.
smoothness
Hex grid smoothness analysis: predict corner positions from neighbors.
traverse
Connected components and BFS coordinate assignment for hex grid graphs.
validators
Ready-to-use HexNeighborValidator implementations for hex grids.