pub struct Path<'k, B> where
B: Reborrow,
B::Target: AsStorage<Arc<<B as Parametric>::Data>> + AsStorage<Vertex<<B as Parametric>::Data>> + Consistent + Parametric, { /* private fields */ }
Expand description
Non-intersecting path.
A path is an ordered set of vertices that are joined by arcs. Paths are notated as either sequences or sets. An open path over vertices $A$, $B$, and $C$ is notated $\overrightarrow{(A,B,C)}$ and a closed path over the same vertices is notated $\overrightarrow{\{A,B,C\}}$.
Path
represents non-intersecting paths of the form
$\overrightarrow{(A,\cdots,B)}$, where $A$ is the back of the path and $B$
is the front of the path. Note that closed paths are always of the form
$\overrightarrow{(A,\cdots,A)}$, where the back and front vertices are both
$A$ (the same).
Path
maintains an ordered set of keys and uses copy-on-write semantics to
avoid allocations and copies.
Implementations
sourceimpl<'k, B, M, G> Path<'k, B> where
B: Reborrow<Target = M>,
M: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
impl<'k, B, M, G> Path<'k, B> where
B: Reborrow<Target = M>,
M: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
pub fn to_ref(&self) -> Path<'_, &M>
sourcepub fn into_opposite_path(self) -> Path<'static, B>
pub fn into_opposite_path(self) -> Path<'static, B>
Converts the path into its opposite path.
sourcepub fn opposite_path(&self) -> Path<'static, &M>
pub fn opposite_path(&self) -> Path<'static, &M>
Gets the opposite path.
sourcepub fn push_back(
&mut self,
destination: impl Into<Selector<VertexKey>>
) -> Result<ArcKey, GraphError>
pub fn push_back(
&mut self,
destination: impl Into<Selector<VertexKey>>
) -> Result<ArcKey, GraphError>
Pushes a vertex onto the back of the path.
The back of a path $\overrightarrow{(A,\cdots)}$ is the vertex $A$. This is the source vertex of the first arc that forms the path.
The given vertex must be a source vertex of an arc formed with the back of the path. That is, if the given vertex is $X$, then $\overrightarrow{XA}$ must exist.
Returns the key of the arc $\overrightarrow{XA}$ inserted into the path using the given source vertex $X$.
Errors
Returns an error if the path is closed, the given vertex is not found, or the given vertex does not form an arc with the back of the path.
sourcepub fn push_previous_arc(&mut self) -> Result<ArcKey, GraphError>
pub fn push_previous_arc(&mut self) -> Result<ArcKey, GraphError>
Pushes the source vertex of the previous arc onto the back of the path.
sourcepub fn push_front(
&mut self,
destination: impl Into<Selector<VertexKey>>
) -> Result<ArcKey, GraphError>
pub fn push_front(
&mut self,
destination: impl Into<Selector<VertexKey>>
) -> Result<ArcKey, GraphError>
Pushes a vertex onto the front of the path.
The front of a path $\overrightarrow{(\cdots,B)}$ is the vertex $B$. This is the destination vertex of the last arc that forms the path.
The given vertex must be a destination vertex of an arc formed with the front of the path. That is, if the given vertex is $X$, then $\overrightarrow{BX}$ must exist.
Returns the key of the arc $\overrightarrow{BX}$ inserted into the path using the given source vertex $X$.
Errors
Returns an error if the path is closed, the given vertex is not found, or the given vertex does not form an arc with the front of the path.
sourcepub fn push_next_arc(&mut self) -> Result<ArcKey, GraphError>
pub fn push_next_arc(&mut self) -> Result<ArcKey, GraphError>
Pushes the destination vertex of the next arc onto the front of the path.
sourcepub fn back(&self) -> VertexView<&M>
pub fn back(&self) -> VertexView<&M>
Gets the vertex at the back of the path.
sourcepub fn front(&self) -> VertexView<&M>
pub fn front(&self) -> VertexView<&M>
Gets the vertex at the front of the path.
pub fn shortest_metric_with<Q, F>(
&self,
from: impl Into<Selector<VertexKey>>,
to: impl Into<Selector<VertexKey>>,
f: F
) -> Result<Q, GraphError> where
Q: Metric,
F: Fn(VertexView<&M>, VertexView<&M>) -> Q,
sourceimpl<'k, 'a, B, M, G> Path<'k, B> where
B: ReborrowInto<'a, Target = M>,
M: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
impl<'k, 'a, B, M, G> Path<'k, B> where
B: ReborrowInto<'a, Target = M>,
M: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
sourcepub fn split(
self,
at: impl Into<Selector<VertexKey>>
) -> Result<(Path<'static, &'a M>, Path<'static, &'a M>), GraphError>
pub fn split(
self,
at: impl Into<Selector<VertexKey>>
) -> Result<(Path<'static, &'a M>, Path<'static, &'a M>), GraphError>
Splits the path into two immutable paths at the given vertex.
Given a path $\overrightarrow{(A,\cdots,M,\cdots,B)}$, splitting at the vertex $M$ results in the paths $\overrightarrow{(A,\cdots,M)}$ and $\overrightarrow{(M,\cdots,B)}$.
Splitting a path does not mutate its graph in any way (unlike
ArcView::split_with
or FaceView::split
, for example). To split a
graph along a path (and thus mutate the graph) use
MeshGraph::split_at_path
.
It is not possible to split a path at its back or front vertices.
Errors
Returns an error if the given vertex cannot be found or the path cannot be split at that vertex.
sourceimpl<'k, B, G> Path<'k, B> where
B: Reborrow,
B::Target: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
impl<'k, B, G> Path<'k, B> where
B: Reborrow,
B::Target: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
sourcepub fn vertices(&self) -> impl Clone + Iterator<Item = VertexView<&B::Target>>
pub fn vertices(&self) -> impl Clone + Iterator<Item = VertexView<&B::Target>>
Gets an iterator over the vertices in the path.
sourcepub fn arcs(&self) -> impl Clone + ExactSizeIterator<Item = ArcView<&B::Target>>
pub fn arcs(&self) -> impl Clone + ExactSizeIterator<Item = ArcView<&B::Target>>
Gets an iterator over the arcs in the path.
sourceimpl<'k, 'a, M, G> Path<'k, &'a mut M> where
M: AsStorage<Arc<G>> + AsStorage<Edge<G>> + AsStorage<Face<G>> + AsStorage<Vertex<G>> + Default + Mutable<Data = G>,
G: GraphData,
impl<'k, 'a, M, G> Path<'k, &'a mut M> where
M: AsStorage<Arc<G>> + AsStorage<Edge<G>> + AsStorage<Face<G>> + AsStorage<Vertex<G>> + Default + Mutable<Data = G>,
G: GraphData,
sourcepub fn extrude_contour_with<F>(
self,
f: F
) -> Result<FaceView<&'a mut M>, GraphError> where
F: Fn(&G::Vertex) -> G::Vertex,
pub fn extrude_contour_with<F>(
self,
f: F
) -> Result<FaceView<&'a mut M>, GraphError> where
F: Fn(&G::Vertex) -> G::Vertex,
Extrudes the contour of a boundary path.
A path is a boundary path if all of its arcs are boundary arcs. Extruding the path transforms the vertices along the path in order using the given function and inserts a face between the path and its extruded contour.
Unlike extruding individual arcs, extruding the contour of a path inserts a single face in which all involved arcs participate.
Returns the inserted face.
Errors
Returns an error if the path is not a boundary path.
sourcepub fn extrude_surface_with<F>(self, f: F) -> Result<Self, GraphError> where
F: Fn(G::Vertex) -> G::Vertex,
pub fn extrude_surface_with<F>(self, f: F) -> Result<Self, GraphError> where
F: Fn(G::Vertex) -> G::Vertex,
Extrudes the surface of a closed path.
Trait Implementations
sourceimpl<'k, B: Clone> Clone for Path<'k, B> where
B: Reborrow,
B::Target: AsStorage<Arc<<B as Parametric>::Data>> + AsStorage<Vertex<<B as Parametric>::Data>> + Consistent + Parametric,
impl<'k, B: Clone> Clone for Path<'k, B> where
B: Reborrow,
B::Target: AsStorage<Arc<<B as Parametric>::Data>> + AsStorage<Vertex<<B as Parametric>::Data>> + Consistent + Parametric,
sourceimpl<B, M, G> From<Ring<B>> for Path<'static, B> where
B: Reborrow<Target = M>,
M: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
impl<B, M, G> From<Ring<B>> for Path<'static, B> where
B: Reborrow<Target = M>,
M: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
Auto Trait Implementations
impl<'k, B> RefUnwindSafe for Path<'k, B> where
B: RefUnwindSafe,
impl<'k, B> Send for Path<'k, B> where
B: Send,
impl<'k, B> Sync for Path<'k, B> where
B: Sync,
impl<'k, B> Unpin for Path<'k, B> where
B: Unpin,
impl<'k, B> UnwindSafe for Path<'k, B> where
B: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FromGeometry<T> for T
impl<T> FromGeometry<T> for T
fn from_geometry(other: T) -> T
sourceimpl<T, U> IntoGeometry<U> for T where
U: FromGeometry<T>,
impl<T, U> IntoGeometry<U> for T where
U: FromGeometry<T>,
fn into_geometry(self) -> U
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if 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
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.