projective_grid/lib.rs
1//! Generic 2D projective grid graph construction, traversal, and homography tools.
2//!
3//! This crate provides reusable algorithms for building 4-connected grid graphs
4//! from detected 2D corners, assigning grid coordinates via BFS traversal,
5//! and computing projective mappings (homographies) for grid rectification.
6//!
7//! It is pattern-agnostic: the [`NeighborValidator`] trait lets callers plug in
8//! pattern-specific logic (chessboard orientation checks, marker constraints, etc.)
9//! while the graph construction, traversal, and geometry remain generic.
10//!
11//! # Hex Grid Support
12//!
13//! The [`hex`] module provides 6-connected hexagonal grid counterparts for
14//! pointy-top axial coordinates `(q, r)`.
15//!
16//! # Built-in Validators
17//!
18//! The [`validators`] module provides ready-to-use implementations of
19//! [`NeighborValidator`] and [`hex::HexNeighborValidator`] for common scenarios.
20
21pub mod direction;
22pub mod graph;
23pub mod grid_alignment;
24pub mod grid_index;
25pub mod grid_mesh;
26pub mod grid_rectify;
27pub mod grid_smoothness;
28pub mod hex;
29pub mod homography;
30pub mod traverse;
31pub mod validators;
32
33pub use direction::{NeighborDirection, NodeNeighbor};
34pub use graph::{GridGraph, GridGraphParams, NeighborCandidate, NeighborValidator};
35pub use grid_alignment::{GridAlignment, GridTransform, GRID_TRANSFORMS_D4};
36pub use grid_index::GridIndex;
37pub use grid_mesh::GridHomographyMesh;
38pub use grid_rectify::GridHomography;
39pub use grid_smoothness::{find_inconsistent_corners, predict_grid_position};
40pub use homography::{estimate_homography, homography_from_4pt, Homography};
41pub use traverse::{assign_grid_coordinates, connected_components};