Struct fyrox::utils::astar::PathFinder
source · pub struct PathFinder { /* private fields */ }Expand description
See module docs.
Implementations§
source§impl PathFinder
impl PathFinder
sourcepub fn set_vertices(&mut self, vertices: Vec<PathVertex>)
pub fn set_vertices(&mut self, vertices: Vec<PathVertex>)
Sets active set of vertices. Links between vertices must contain valid indices (which are not out-of-bounds), otherwise path from/to such vertices won’t be built.
sourcepub fn link_bidirect(&mut self, a: usize, b: usize)
pub fn link_bidirect(&mut self, a: usize, b: usize)
Creates bidirectional link between two vertices. Bidirectional means
that point a can be reached from point b as well as point b
can be reached from point a.
sourcepub fn link_unidirect(&mut self, a: usize, b: usize)
pub fn link_unidirect(&mut self, a: usize, b: usize)
Creates unidirectional link between vertex a and vertex b. Unidirectional
means that there is no direct link between b to a, only from a to b.
sourcepub fn vertex(&self, index: usize) -> Option<&PathVertex>
pub fn vertex(&self, index: usize) -> Option<&PathVertex>
Returns shared reference to a path vertex at the given index.
sourcepub fn vertex_mut(&mut self, index: usize) -> Option<&mut PathVertex>
pub fn vertex_mut(&mut self, index: usize) -> Option<&mut PathVertex>
Returns mutable reference to a path vertex at the given index.
sourcepub fn vertices(&self) -> &[PathVertex]
pub fn vertices(&self) -> &[PathVertex]
Returns reference to the array of vertices.
sourcepub fn vertices_mut(&mut self) -> &mut [PathVertex]
pub fn vertices_mut(&mut self) -> &mut [PathVertex]
Returns reference to the array of vertices.
sourcepub fn add_vertex(&mut self, vertex: PathVertex) -> u32
pub fn add_vertex(&mut self, vertex: PathVertex) -> u32
Adds a new vertex to the path finder.
sourcepub fn pop_vertex(&mut self) -> Option<PathVertex>
pub fn pop_vertex(&mut self) -> Option<PathVertex>
Removes last vertex from the graph. Automatically cleans “dangling” references to the deleted vertex from every other vertex in the graph and shifts indices of neighbour vertices, to preserve graph structure.
sourcepub fn remove_vertex(&mut self, index: usize) -> PathVertex
pub fn remove_vertex(&mut self, index: usize) -> PathVertex
Removes a vertex at the given index from the graph. Automatically cleans “dangling” references to the deleted vertex from every other vertex in the graph and shifts indices of neighbour vertices, to preserve graph structure.
sourcepub fn insert_vertex(&mut self, index: u32, vertex: PathVertex)
pub fn insert_vertex(&mut self, index: u32, vertex: PathVertex)
Inserts the vertex at the given index. Automatically shifts neighbour indices of every other vertex in the graph to preserve graph structure.
sourcepub fn build(
&mut self,
from: usize,
to: usize,
path: &mut Vec<Vector3<f32>>
) -> Result<PathKind, PathError>
pub fn build( &mut self, from: usize, to: usize, path: &mut Vec<Vector3<f32>> ) -> Result<PathKind, PathError>
Tries to build path from begin point to end point. Returns path kind:
- Full: there are direct path from begin to end.
- Partial: there are not direct path from begin to end, but it is closest.
- Empty: no path available - in most cases indicates some error in input params.
Notes
This is more or less naive implementation, it most certainly will be slower than specialized solutions.
sourcepub fn build_and_convert<F, T>(
&mut self,
from: usize,
to: usize,
path: &mut Vec<T>,
func: F
) -> Result<PathKind, PathError>where
F: FnMut(usize, &PathVertex) -> T,
pub fn build_and_convert<F, T>( &mut self, from: usize, to: usize, path: &mut Vec<T>, func: F ) -> Result<PathKind, PathError>where F: FnMut(usize, &PathVertex) -> T,
Tries to build path from begin point to end point. Returns path kind:
- Full: there are direct path from begin to end.
- Partial: there are not direct path from begin to end, but it is closest.
- Empty: no path available - in most cases indicates some error in input params.
Notes
This is more or less naive implementation, it most certainly will be slower than specialized solutions.
Trait Implementations§
source§impl Clone for PathFinder
impl Clone for PathFinder
source§fn clone(&self) -> PathFinder
fn clone(&self) -> PathFinder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for PathFinder
impl Debug for PathFinder
source§impl Default for PathFinder
impl Default for PathFinder
source§impl PartialEq for PathFinder
impl PartialEq for PathFinder
source§fn eq(&self, other: &PathFinder) -> bool
fn eq(&self, other: &PathFinder) -> bool
self and other values to be equal, and is used
by ==.source§impl Visit for PathFinderwhere
Vec<PathVertex>: Visit,
impl Visit for PathFinderwhere Vec<PathVertex>: Visit,
impl StructuralPartialEq for PathFinder
Auto Trait Implementations§
impl RefUnwindSafe for PathFinder
impl Send for PathFinder
impl Sync for PathFinder
impl Unpin for PathFinder
impl UnwindSafe for PathFinder
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ScriptMessagePayload for Twhere
T: 'static + Send,
impl<T> ScriptMessagePayload for Twhere T: 'static + Send,
source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
self as &dyn Anysource§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
self as &dyn Any§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.