Struct plexus::graph::VertexView
source · [−]pub struct VertexView<B> where
B: Reborrow,
B::Target: AsStorage<Vertex<<B as Parametric>::Data>> + Parametric, { /* private fields */ }
Expand description
View of a vertex entity.
See the graph
module documentation for more information about views.
Implementations
sourceimpl<B, M> VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<<B as Parametric>::Data>> + Parametric,
impl<B, M> VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<<B as Parametric>::Data>> + Parametric,
pub fn to_ref(&self) -> VertexView<&M>
sourceimpl<'a, B, M, G> VertexView<B> where
B: ReborrowInto<'a, Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
impl<'a, B, M, G> VertexView<B> where
B: ReborrowInto<'a, Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
sourcepub fn into_ref(self) -> VertexView<&'a M>
pub fn into_ref(self) -> VertexView<&'a M>
Examples
use decorum::R64;
use nalgebra::Point3;
use plexus::graph::MeshGraph;
use plexus::prelude::*;
use plexus::primitive::cube::Cube;
use plexus::primitive::generate::Position;
type E3 = Point3<R64>;
let mut graph: MeshGraph<E3> = Cube::new().polygons::<Position<E3>>().collect();
let key = graph.arcs().nth(0).unwrap().key();
let vertex = graph.arc_mut(key).unwrap().split_at_midpoint().into_ref();
// This would not be possible without conversion into an immutable view.
let _ = vertex.into_outgoing_arc().into_face().unwrap();
let _ = vertex
.into_outgoing_arc()
.into_opposite_arc()
.into_face()
.unwrap();
sourceimpl<B, M, G> VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
impl<B, M, G> VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
pub fn get<'a>(&'a self) -> &'a G::Vertex where
G: 'a,
pub fn position<'a>(&'a self) -> &'a VertexPosition<G> where
G: 'a,
G::Vertex: AsPosition,
sourceimpl<B, M, G> VertexView<B> where
B: ReborrowMut<Target = M>,
M: AsStorageMut<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
impl<B, M, G> VertexView<B> where
B: ReborrowMut<Target = M>,
M: AsStorageMut<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
impl<B, M, G> VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
Reachable API.
sourceimpl<B, M, G> VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
impl<B, M, G> VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
sourcepub fn into_outgoing_arc(self) -> ArcView<B>
pub fn into_outgoing_arc(self) -> ArcView<B>
Converts the vertex into its outgoing (leading) arc.
sourcepub fn outgoing_arc(&self) -> ArcView<&M>
pub fn outgoing_arc(&self) -> ArcView<&M>
Gets the outgoing (leading) arc of the vertex.
pub fn shortest_path(
&self,
key: VertexKey
) -> Result<Path<'static, &M>, GraphError>
pub fn into_shortest_path(
self,
key: VertexKey
) -> Result<Path<'static, B>, GraphError>
pub fn shortest_path_with<Q, F>(
&self,
key: VertexKey,
f: F
) -> Result<Path<'static, &M>, GraphError> where
Q: Copy + Metric,
F: Fn(VertexView<&M>, VertexView<&M>) -> Q,
pub fn into_shortest_path_with<Q, F>(
self,
key: VertexKey,
f: F
) -> Result<Path<'static, B>, GraphError> where
Q: Copy + Metric,
F: Fn(VertexView<&M>, VertexView<&M>) -> Q,
sourcepub fn valence(&self) -> usize
pub fn valence(&self) -> usize
Gets the valence of the vertex.
A vertex’s valence is the number of adjacent vertices to which it is connected by arcs. The valence of a vertex is the same as its degree, which is the number of edges to which the vertex is connected.
pub fn centroid(&self) -> VertexPosition<G> where
G: VertexCentroid,
G::Vertex: AsPosition,
sourceimpl<B, M, G> VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Arc<G>> + AsStorage<Face<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
impl<B, M, G> VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Arc<G>> + AsStorage<Face<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
pub fn normal(&self) -> Result<Vector<VertexPosition<G>>, GraphError> where
G: VertexNormal,
G::Vertex: AsPosition,
impl<'a, B, M, G> VertexView<B> where
B: ReborrowInto<'a, Target = M>,
M: 'a + AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
Reachable API.
impl<B, G> VertexView<B> where
B: Reborrow,
B::Target: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
Reachable API.
sourceimpl<'a, B, M, G> VertexView<B> where
B: ReborrowInto<'a, Target = M>,
M: 'a + AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
impl<'a, B, M, G> VertexView<B> where
B: ReborrowInto<'a, Target = M>,
M: 'a + AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
pub fn into_adjacent_vertices(
self
) -> impl Clone + Iterator<Item = VertexView<&'a M>>
pub fn into_incoming_arcs(self) -> impl Clone + Iterator<Item = ArcView<&'a M>>
pub fn into_outgoing_arcs(self) -> impl Clone + Iterator<Item = ArcView<&'a M>>
sourceimpl<B, G> VertexView<B> where
B: Reborrow,
B::Target: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
impl<B, G> VertexView<B> where
B: Reborrow,
B::Target: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
pub fn adjacent_vertices(
&self
) -> impl Clone + Iterator<Item = VertexView<&B::Target>>
sourcepub fn incoming_arcs(&self) -> impl Clone + Iterator<Item = ArcView<&B::Target>>
pub fn incoming_arcs(&self) -> impl Clone + Iterator<Item = ArcView<&B::Target>>
Gets an iterator of views over the incoming arcs of the vertex.
The ordering of arcs is deterministic and is based on the leading arc of the vertex.
sourcepub fn outgoing_arcs(&self) -> impl Clone + Iterator<Item = ArcView<&B::Target>>
pub fn outgoing_arcs(&self) -> impl Clone + Iterator<Item = ArcView<&B::Target>>
Gets an iterator of views over the outgoing arcs of the vertex.
The ordering of arcs is deterministic and is based on the leading arc of the vertex.
sourcepub fn traverse_by_breadth(
&self
) -> impl Clone + Iterator<Item = VertexView<&B::Target>>
pub fn traverse_by_breadth(
&self
) -> impl Clone + Iterator<Item = VertexView<&B::Target>>
Gets an iterator that traverses adjacent vertices by breadth.
The traversal moves from the vertex to its adjacent vertices and so on. If there are disjoint subgraphs in the graph, then a traversal will not reach every vertex in the graph.
sourcepub fn traverse_by_depth(
&self
) -> impl Clone + Iterator<Item = VertexView<&B::Target>>
pub fn traverse_by_depth(
&self
) -> impl Clone + Iterator<Item = VertexView<&B::Target>>
Gets an iterator that traverses adjacent vertices by depth.
The traversal moves from the vertex to its adjacent vertices and so on. If there are disjoint subgraphs in the graph, then a traversal will not reach every vertex in the graph.
sourceimpl<'a, B, M, G> VertexView<B> where
B: ReborrowInto<'a, Target = M>,
M: 'a + AsStorage<Arc<G>> + AsStorage<Face<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
impl<'a, B, M, G> VertexView<B> where
B: ReborrowInto<'a, Target = M>,
M: 'a + AsStorage<Arc<G>> + AsStorage<Face<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
sourceimpl<B, G> VertexView<B> where
B: Reborrow,
B::Target: AsStorage<Arc<G>> + AsStorage<Face<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
impl<B, G> VertexView<B> where
B: Reborrow,
B::Target: AsStorage<Arc<G>> + AsStorage<Face<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: GraphData,
sourcepub fn adjacent_faces(
&self
) -> impl Clone + Iterator<Item = FaceView<&B::Target>>
pub fn adjacent_faces(
&self
) -> impl Clone + Iterator<Item = FaceView<&B::Target>>
Gets an iterator of views over the adjacent faces of the vertex.
The ordering of faces is deterministic and is based on the leading arc of the vertex.
sourceimpl<'a, M, G> VertexView<&'a mut M> where
M: AsStorage<Arc<G>> + AsStorageMut<Vertex<G>> + Consistent + Parametric<Data = G>,
G: 'a + GraphData,
impl<'a, M, G> VertexView<&'a mut M> where
M: AsStorage<Arc<G>> + AsStorageMut<Vertex<G>> + Consistent + Parametric<Data = G>,
G: 'a + GraphData,
pub fn into_adjacent_vertex_orphans(
self
) -> impl Iterator<Item = VertexOrphan<'a, G>>
sourceimpl<B> VertexView<B> where
B: ReborrowMut,
B::Target: AsStorage<Arc<<B as Parametric>::Data>> + AsStorageMut<Vertex<<B as Parametric>::Data>> + Consistent + Parametric,
impl<B> VertexView<B> where
B: ReborrowMut,
B::Target: AsStorage<Arc<<B as Parametric>::Data>> + AsStorageMut<Vertex<<B as Parametric>::Data>> + Consistent + Parametric,
pub fn adjacent_vertex_orphans(
&mut self
) -> impl Iterator<Item = VertexOrphan<'_, <B as Parametric>::Data>>
sourceimpl<'a, M, G> VertexView<&'a mut M> where
M: AsStorageMut<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: 'a + GraphData,
impl<'a, M, G> VertexView<&'a mut M> where
M: AsStorageMut<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: 'a + GraphData,
pub fn into_incoming_arc_orphans(self) -> impl Iterator<Item = ArcOrphan<'a, G>>
sourceimpl<B> VertexView<B> where
B: ReborrowMut,
B::Target: AsStorageMut<Arc<<B as Parametric>::Data>> + AsStorage<Vertex<<B as Parametric>::Data>> + Consistent + Parametric,
impl<B> VertexView<B> where
B: ReborrowMut,
B::Target: AsStorageMut<Arc<<B as Parametric>::Data>> + AsStorage<Vertex<<B as Parametric>::Data>> + Consistent + Parametric,
sourcepub fn incoming_arc_orphans(
&mut self
) -> impl Iterator<Item = ArcOrphan<'_, <B as Parametric>::Data>>
pub fn incoming_arc_orphans(
&mut self
) -> impl Iterator<Item = ArcOrphan<'_, <B as Parametric>::Data>>
Gets an iterator of orphan views over the incoming arcs of the vertex.
The ordering of arcs is deterministic and is based on the leading arc of the vertex.
sourceimpl<'a, M, G> VertexView<&'a mut M> where
M: AsStorage<Arc<G>> + AsStorageMut<Face<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: 'a + GraphData,
impl<'a, M, G> VertexView<&'a mut M> where
M: AsStorage<Arc<G>> + AsStorageMut<Face<G>> + AsStorage<Vertex<G>> + Consistent + Parametric<Data = G>,
G: 'a + GraphData,
pub fn into_adjacent_face_orphans(
self
) -> impl Iterator<Item = FaceOrphan<'a, G>>
sourceimpl<B> VertexView<B> where
B: ReborrowMut,
B::Target: AsStorage<Arc<<B as Parametric>::Data>> + AsStorageMut<Face<<B as Parametric>::Data>> + AsStorage<Vertex<<B as Parametric>::Data>> + Consistent + Parametric,
impl<B> VertexView<B> where
B: ReborrowMut,
B::Target: AsStorage<Arc<<B as Parametric>::Data>> + AsStorageMut<Face<<B as Parametric>::Data>> + AsStorage<Vertex<<B as Parametric>::Data>> + Consistent + Parametric,
sourcepub fn adjacent_face_orphans(
&mut self
) -> impl Iterator<Item = FaceOrphan<'_, <B as Parametric>::Data>>
pub fn adjacent_face_orphans(
&mut self
) -> impl Iterator<Item = FaceOrphan<'_, <B as Parametric>::Data>>
Gets an iterator of orphan views over the adjacent faces of the vertex.
The ordering of faces is deterministic and is based on the leading arc of the vertex.
sourceimpl<'a, M, G> VertexView<&'a mut M> where
M: AsStorage<Arc<G>> + AsStorage<Edge<G>> + AsStorage<Face<G>> + AsStorage<Vertex<G>> + Default + Mutable<Data = G>,
G: GraphData,
impl<'a, M, G> VertexView<&'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 remove(self)
pub fn remove(self)
Removes the vertex.
Any and all dependent entities are also removed, such as arcs and edges connected to the vertex, faces connected to such arcs, vertices with no remaining leading arc, etc.
Vertex removal is the most destructive removal, because vertices are a dependency of all other entities.
Examples
Removing a corner from a cube by removing its vertex:
use decorum::R64;
use nalgebra::Point3;
use plexus::graph::MeshGraph;
use plexus::prelude::*;
use plexus::primitive::cube::Cube;
use plexus::primitive::generate::Position;
type E3 = Point3<R64>;
let mut graph: MeshGraph<E3> = Cube::new().polygons::<Position<E3>>().collect();
let key = graph.vertices().nth(0).unwrap().key();
graph.vertex_mut(key).unwrap().remove();
Trait Implementations
sourceimpl<B> Borrow<VertexKey> for VertexView<B> where
B: Reborrow,
B::Target: AsStorage<Vertex<<B as Parametric>::Data>> + Parametric,
impl<B> Borrow<VertexKey> for VertexView<B> where
B: Reborrow,
B::Target: AsStorage<Vertex<<B as Parametric>::Data>> + Parametric,
sourceimpl<B, M, G> Clone for VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
View<B, Vertex<G>>: Clone,
impl<B, M, G> Clone for VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
View<B, Vertex<G>>: Clone,
sourceimpl<B, M, G> ClosedView for VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
impl<B, M, G> ClosedView for VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
sourceimpl<B, M, G> Deref for VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
impl<B, M, G> Deref for VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
sourceimpl<B, M, G> DerefMut for VertexView<B> where
B: ReborrowMut<Target = M>,
M: AsStorageMut<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
impl<B, M, G> DerefMut for VertexView<B> where
B: ReborrowMut<Target = M>,
M: AsStorageMut<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
sourceimpl<'a, M, G> From<VertexView<&'a mut M>> for VertexOrphan<'a, G> where
M: AsStorageMut<Vertex<G>> + Parametric<Data = G>,
G: 'a + GraphData,
impl<'a, M, G> From<VertexView<&'a mut M>> for VertexOrphan<'a, G> where
M: AsStorageMut<Vertex<G>> + Parametric<Data = G>,
G: 'a + GraphData,
sourcefn from(vertex: VertexView<&'a mut M>) -> Self
fn from(vertex: VertexView<&'a mut M>) -> Self
Converts to this type from the input type.
sourceimpl<B, M, G> Hash for VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
impl<B, M, G> Hash for VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
sourceimpl<B, M, G> PartialEq<VertexView<B>> for VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
impl<B, M, G> PartialEq<VertexView<B>> for VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
impl<B, M, G> Copy for VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
View<B, Vertex<G>>: Copy,
impl<B, M, G> Eq for VertexView<B> where
B: Reborrow<Target = M>,
M: AsStorage<Vertex<G>> + Parametric<Data = G>,
G: GraphData,
Auto Trait Implementations
impl<B> RefUnwindSafe for VertexView<B> where
B: RefUnwindSafe,
impl<B> Send for VertexView<B> where
B: Send,
impl<B> Sync for VertexView<B> where
B: Sync,
impl<B> Unpin for VertexView<B> where
B: Unpin,
impl<B> UnwindSafe for VertexView<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.