pub struct PathNetwork {
pub nodes: HashMap<u64, SplineNode>,
pub edges: HashMap<u64, SplineEdge>,
pub splines: HashMap<u64, CatmullRomSpline>,
/* private fields */
}Fields§
§nodes: HashMap<u64, SplineNode>§edges: HashMap<u64, SplineEdge>§splines: HashMap<u64, CatmullRomSpline>Implementations§
Source§impl PathNetwork
impl PathNetwork
pub fn new() -> Self
pub fn add_node(&mut self, position: Vec3) -> u64
pub fn add_spline(&mut self, spline: CatmullRomSpline) -> u64
pub fn connect_nodes( &mut self, from: u64, to: u64, spline_id: u64, one_way: bool, )
Sourcepub fn dijkstra(&self, start: u64, goal: u64) -> Option<Vec<u64>>
pub fn dijkstra(&self, start: u64, goal: u64) -> Option<Vec<u64>>
Dijkstra shortest path from start to goal
Sourcepub fn astar(&self, start: u64, goal: u64) -> Option<Vec<u64>>
pub fn astar(&self, start: u64, goal: u64) -> Option<Vec<u64>>
A* path planning with Euclidean heuristic
pub fn nearest_node(&self, pos: Vec3) -> Option<u64>
Source§impl PathNetwork
impl PathNetwork
pub fn total_length(&self) -> f32
pub fn node_degree(&self, id: u64) -> usize
pub fn junction_nodes(&self) -> Vec<u64>
pub fn dead_end_nodes(&self) -> Vec<u64>
pub fn edge_passable(&self, edge_id: u64) -> bool
Trait Implementations§
Source§impl Clone for PathNetwork
impl Clone for PathNetwork
Auto Trait Implementations§
impl Freeze for PathNetwork
impl RefUnwindSafe for PathNetwork
impl Send for PathNetwork
impl Sync for PathNetwork
impl Unpin for PathNetwork
impl UnsafeUnpin for PathNetwork
impl UnwindSafe for PathNetwork
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.