1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// 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);
//! ```
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;