Struct de_pathing::finder::PathFinder  
source · pub struct PathFinder {
    triangles: RTree<GraphTriangle>,
    exclusions: RTree<GraphExclusion>,
    graph: VisibilityGraph,
}Expand description
A struct used for path finding.
Fields§
§triangles: RTree<GraphTriangle>Spatial index of triangles. It is used to find edges neighboring start and end pints of a path to be found.
exclusions: RTree<GraphExclusion>All mutually exclusive exclusion areas which are not covered by
triangles. It is used to find way out of unreachable area.
graph: VisibilityGraphImplementations§
source§impl PathFinder
 
impl PathFinder
sourcepub(crate) fn new(bounds: &MapBounds) -> Self
 
pub(crate) fn new(bounds: &MapBounds) -> Self
Creates a new path finder. It is assumed that there are no obstacles
within bounds.
sourcepub(crate) fn from_triangles(
    triangles: Vec<Triangle>,
    exclusions: Vec<ExclusionArea>
) -> Self
 
pub(crate) fn from_triangles( triangles: Vec<Triangle>, exclusions: Vec<ExclusionArea> ) -> Self
Creates a new path finder based on a triangulated accessible area.
§Arguments
- 
triangles- the triangulation of the map. It must a) fully cover area where objects (their centroids so there needs to be padding) can freely move, b) contain not triangle-to-triangle intersections, c) cover any of the area where object cannot freely move. - 
exclusions- mutually exclusive areas which fully cover area not covered bytriangles. There is no intersection between theexclusionsandtriangles. 
sourcepub fn find_path<P: Into<Point<f32>>>(
    &self,
    from: P,
    target: PathTarget
) -> Option<Path>
 
pub fn find_path<P: Into<Point<f32>>>( &self, from: P, target: PathTarget ) -> Option<Path>
Returns a shortest path between two points.
Returns None if there is no path between the two points.
fn locate_triangle_edges(&self, point: Point<f32>) -> Vec<Step>
fn locate_exclusion_edges(&self, point: Point<f32>) -> Vec<Step>
Auto Trait Implementations§
impl Freeze for PathFinder
impl RefUnwindSafe for PathFinder
impl Send for PathFinder
impl Sync for PathFinder
impl Unpin for PathFinder
impl UnwindSafe for PathFinder
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for T
 
impl<T, U> AsBindGroupShaderType<U> for T
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
 
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T [ShaderType] for self. When used in [AsBindGroup]
derives, it is safe to assume that all images in self exist.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.§impl<T> DowncastSync for T
 
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
 
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§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.