Struct de_pathing::graph::VisibilityGraph
source · pub struct VisibilityGraph {
nodes: Vec<GraphNode>,
}
Expand description
Edge based visibility sub-graph.
Be careful to distinguish between triangle edges and graph edges:
-
triangle edge - a geometric edge of a triangle (each triangle has 3).
-
graph node - a node in a graph. In the case of
VisibilityGraph
, each graph node represents a triangle edge. -
graph edge - an edge between two nodes in a graph. In the case of
VisibilityGraph
, each graph edge represents direct visibility between two triangle edges.If triangle edges A and B are connected by a graph edge (i.e. are neighbours in
VisibilityGraph
), then any point on triangle edge A is accessible (visible) on straight line from any point on triangle B.The opposite statement doesn’t always hold: two triangle edges might be fully visible one from another and not share a graph edge. However, such triangles are always connected by a graph path.
Fields§
§nodes: Vec<GraphNode>
Implementations§
source§impl VisibilityGraph
impl VisibilityGraph
sourcepub(crate) fn new_node(&mut self, segment: Segment) -> u32
pub(crate) fn new_node(&mut self, segment: Segment) -> u32
Prepares a graph node without any neighbours, pushes it to the graph and returns corresponding edge (node) ID.
Only single node must be created when multiple triangles share an edge (have coincidental edge line segment).
§Arguments
segment
- line segment of the triangle edge.
sourcepub(crate) fn add_neighbours(
&mut self,
edge_id: u32,
triangle_id: u32,
neighbour_a_id: u32,
neighbour_b_id: u32
)
pub(crate) fn add_neighbours( &mut self, edge_id: u32, triangle_id: u32, neighbour_a_id: u32, neighbour_b_id: u32 )
Adds 2 neighbours accessible via one of the adjacent triangles to a graph node (triangle edge).
§Arguments
-
edge_id
- ID of the edge whose neighbors are added. -
triangle_id
- ID of the traversed triangle (i.e. the triangle containing the source and target edges). -
neighbour_a_id
- edge ID of the a neighbor. -
neighbour_b_id
- edge ID of the a neighbor.
§Panics
Panics if edge_id
already stores more than two neighbours.
sourcepub(crate) fn segment(&self, edge_id: u32) -> Segment
pub(crate) fn segment(&self, edge_id: u32) -> Segment
Returns a geometry of a graph node (triangle edge).
sourcepub(crate) fn neighbours(&self, edge_id: u32) -> &[Step]
pub(crate) fn neighbours(&self, edge_id: u32) -> &[Step]
Returns all neighbors of a graph node (triangle edge).
Auto Trait Implementations§
impl Freeze for VisibilityGraph
impl RefUnwindSafe for VisibilityGraph
impl Send for VisibilityGraph
impl Sync for VisibilityGraph
impl Unpin for VisibilityGraph
impl UnwindSafe for VisibilityGraph
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.