Skip to main content

Crate projective_grid

Crate projective_grid 

Source
Expand description

Generic 2D projective grid graph construction, traversal, and homography tools.

This crate provides reusable algorithms for building 4- or 6-connected grid graphs from detected 2D points, assigning grid coordinates via BFS traversal, and computing projective mappings (homographies) for grid rectification.

It is pattern-agnostic: the NeighborValidator trait lets callers plug in pattern-specific logic (chessboard orientation checks, marker constraints, etc.) while the graph construction, traversal, and geometry remain generic.

§Module layout

ModuleResponsibility
squareSquare (4-connected) grid: direction, alignment, index, mesh, rectify, smoothness, validators
hexHex (6-connected) grid: mirrored submodules for axial (q, r) coordinates
graphGeneric KD-tree-based graph builder + NeighborValidator trait
graph_cleanupGraph-level cleanup passes (symmetry, straightness, crossing pruning)
global_step / local_stepCell-size / local-step estimation on point clouds
traverseBFS / DFS on grid graphs (connected components, (i, j) assignment)
homographyProjective geometry (4-point homography, DLT)

Top-level types from square are re-exported here at the crate root so existing consumers (e.g., projective_grid::GridIndex) continue to work unchanged.

Re-exports§

pub use global_step::estimate_global_cell_size;
pub use global_step::GlobalStepEstimate;
pub use global_step::GlobalStepParams;
pub use graph::GridGraph;
pub use graph::GridGraphParams;
pub use graph::NeighborCandidate;
pub use graph::NeighborValidator;
pub use graph_cleanup::enforce_symmetry;
pub use graph_cleanup::prune_by_edge_straightness;
pub use graph_cleanup::prune_crossing_edges;
pub use graph_cleanup::prune_isolated_pairs;
pub use graph_cleanup::segments_properly_cross;
pub use homography::estimate_homography;
pub use homography::homography_from_4pt;
pub use homography::Homography;
pub use local_step::estimate_local_steps;
pub use local_step::LocalStep;
pub use local_step::LocalStepParams;
pub use local_step::LocalStepPointData;
pub use traverse::assign_grid_coordinates;
pub use traverse::connected_components;
pub use square::alignment::GridAlignment;
pub use square::alignment::GridTransform;
pub use square::alignment::GRID_TRANSFORMS_D4;
pub use square::direction::NeighborDirection;
pub use square::direction::NodeNeighbor;
pub use square::index::GridIndex;
pub use square::mesh::GridHomographyMesh;
pub use square::rectify::GridHomography;
pub use square::smoothness::find_inconsistent_corners;
pub use square::smoothness::find_inconsistent_corners_step_aware;
pub use square::smoothness::predict_grid_position;
pub use square::validators::SpatialSquareValidator;
pub use square::validators::XJunctionValidator;

Modules§

circular_stats
Circular-histogram + plateau-aware peak picking + double-angle 2-means helpers.
global_step
Automatic global cell-size estimation for a 2D corner cloud.
graph
graph_cleanup
Post-build geometric sanity passes on a GridGraph.
hex
Hexagonal grid support for pointy-top axial coordinates.
homography
local_step
Generic per-corner local grid-step estimation.
square
Square (4-connected) grid support.
traverse
validators
Re-export of the square-grid submodule at the legacy validators path.

Traits§

Float
Trait alias for floating-point types supported by this crate.