shortestpath 0.10.0

Shortest Path is an experimental library finding the shortest path from A to B.
Documentation
// Copyright (C) 2025 Christian Mauduit <ufoot@ufoot.org>

//! 2D mesh implementations and utilities for pathfinding on grids.
//!
//! This module provides structures and traits for working with 2-dimensional grids
//! in pathfinding algorithms. It includes both simple fully-connected grids and
//! optimized representations that support walls and obstacles.
//!
//! # Main Types
//!
//! - [`Full2D`] - A fully connected rectangular grid where all cells are walkable.
//!   Each cell can connect to its 8 neighbors (4 orthogonal + 4 diagonal).
//!
//! - [`Compact2D`] - An optimized 2D grid that supports walls/obstacles. It compresses
//!   walkable cells and pre-computes successors for memory efficiency.
//!
//! # Traits
//!
//! - [`Shape2D`] - Provides grid dimensions via `shape()` returning `(width, height)`.
//!
//! - [`Index2D`] - Converts between 2D coordinates `(x, y)` and linear indices.
//!
//! # Utilities
//!
//! - `repr_2d` - Functions for visualizing 2D meshes and gradients as text.
//!
//! # Example
//!
//! ```
//! use shortestpath::{Gradient, Mesh, mesh_2d::Full2D};
//!
//! // Create a 10x10 grid
//! let mesh = Full2D::new(10, 10);
//!
//! // Setup pathfinding with center as target
//! let mut gradient = Gradient::from_mesh(&mesh);
//! gradient.set_distance(55, 0.0); // Center of 10x10 grid
//! gradient.spread(&mesh);
//!
//! // Query distance from corner to center
//! let distance = gradient.get_distance(0);
//! println!("Distance from corner to center: {}", distance);
//! ```

mod compact_2d;
mod full_2d;
mod index_2d;
mod repr_2d;
mod shape_2d;

pub use compact_2d::*;
pub use full_2d::*;
pub use index_2d::*;
pub use repr_2d::*;
pub use shape_2d::*;