condor-for-games 0.4.0

Rust pathfinding library for grids, polygonal scenes, navmeshes, and replanning.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Small caller-owned weighted grid search.

use condor::{Dijkstra, Grid, Pathfinder, Point, SearchRequest};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut grid = Grid::new(4, 4)?;
    grid.set_traversal_cost(Point::new(1, 0), 5)?;
    grid.set_traversal_cost(Point::new(1, 1), 5)?;
    let result = Dijkstra.search(
        &grid,
        SearchRequest::new(Point::new(0, 0), Point::new(3, 3)),
    )?;
    println!("found={} cost={:?}", result.is_found(), result.cost());
    Ok(())
}