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>

//! 2.5D mesh implementations for layered pathfinding.
//!
//! This module provides structures and traits for pathfinding in "2.5D" spaces - essentially
//! stacked 2D layers with vertical connections between them. Unlike true 3D pathfinding which
//! would support 26 neighbors (including diagonals across layers), this implementation provides
//! a simpler model where each cell has:
//! - 8 in-layer neighbors (like 2D: 4 orthogonal + 4 diagonal)
//! - 2 vertical neighbors (directly above and below)
//!
//! This 2.5D approach is ideal for games with multiple floors, platformers with layers,
//! or any scenario where movement is primarily 2D within a layer but with limited
//! vertical transitions between layers.
//!
//! # Main Types
//!
//! - [`Full25D`] - A fully connected rectangular volume where all cells are walkable.
//!   Each cell can connect to its neighbors in the current layer (8 neighbors like 2D)
//!   plus cells directly above and below (2 more = 10 total neighbors).
//!
//! - [`Compact25D`] - An optimized 2.5D volume that supports walls/obstacles. It compresses
//!   walkable cells and pre-computes successors for memory efficiency.
//!
//! # Traits
//!
//! - [`Shape3D`] - Provides volume dimensions via `shape()` returning `(width, height, depth)`.
//!
//! - [`Index3D`] - Converts between 2.5D coordinates `(x, y, z)` and linear indices.
//!
//! # Example
//!
//! ```
//! use shortestpath::{Gradient, Mesh, mesh_25d::Full25D};
//!
//! // Create a 10x10x10 volume
//! let mesh = Full25D::new(10, 10, 10);
//!
//! // Setup pathfinding with center as target
//! let mut gradient = Gradient::from_mesh(&mesh);
//! gradient.set_distance(555, 0.0); // Center of 10x10x10 volume
//! gradient.spread(&mesh);
//!
//! // Query distance from corner to center
//! let distance = gradient.get_distance(0);
//! println!("Distance from corner to center: {}", distance);
//! ```

mod compact_25d;
mod full_25d;

pub use compact_25d::*;
pub use full_25d::*;

// Re-export 3D traits from mesh_3d for convenience
pub use crate::mesh_3d::{Index3D, Shape3D};