pub struct DijkstraMap { /* private fields */ }Expand description
Dijkstra map for multi-goal pathfinding
Implementations§
Source§impl DijkstraMap
impl DijkstraMap
pub fn new(width: usize, height: usize) -> Self
Sourcepub fn get(&self, x: usize, y: usize) -> f32
pub fn get(&self, x: usize, y: usize) -> f32
Examples found in repository?
examples/advanced_pathfinding.rs (line 75)
72fn print_dijkstra_map(dijkstra: &terrain_forge::spatial::DijkstraMap) {
73 for y in 0..dijkstra.height() {
74 for x in 0..dijkstra.width() {
75 let cost = dijkstra.get(x, y);
76 if cost == f32::INFINITY {
77 print!("### ");
78 } else if cost < 100.0 {
79 print!("{:3.0} ", cost);
80 } else {
81 print!("+++ ");
82 }
83 }
84 println!();
85 }
86}pub fn set(&mut self, x: usize, y: usize, cost: f32)
Sourcepub fn width(&self) -> usize
pub fn width(&self) -> usize
Examples found in repository?
examples/advanced_pathfinding.rs (line 74)
72fn print_dijkstra_map(dijkstra: &terrain_forge::spatial::DijkstraMap) {
73 for y in 0..dijkstra.height() {
74 for x in 0..dijkstra.width() {
75 let cost = dijkstra.get(x, y);
76 if cost == f32::INFINITY {
77 print!("### ");
78 } else if cost < 100.0 {
79 print!("{:3.0} ", cost);
80 } else {
81 print!("+++ ");
82 }
83 }
84 println!();
85 }
86}Sourcepub fn height(&self) -> usize
pub fn height(&self) -> usize
Examples found in repository?
examples/advanced_pathfinding.rs (line 73)
72fn print_dijkstra_map(dijkstra: &terrain_forge::spatial::DijkstraMap) {
73 for y in 0..dijkstra.height() {
74 for x in 0..dijkstra.width() {
75 let cost = dijkstra.get(x, y);
76 if cost == f32::INFINITY {
77 print!("### ");
78 } else if cost < 100.0 {
79 print!("{:3.0} ", cost);
80 } else {
81 print!("+++ ");
82 }
83 }
84 println!();
85 }
86}Trait Implementations§
Source§impl Clone for DijkstraMap
impl Clone for DijkstraMap
Source§fn clone(&self) -> DijkstraMap
fn clone(&self) -> DijkstraMap
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DijkstraMap
impl RefUnwindSafe for DijkstraMap
impl Send for DijkstraMap
impl Sync for DijkstraMap
impl Unpin for DijkstraMap
impl UnwindSafe for DijkstraMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more