[][src]Struct plexus::graph::VertexView

pub struct VertexView<B> where
    B: Reborrow,
    B::Target: AsStorage<Vertex<<B as Geometric>::Geometry>> + Geometric, 
{ /* fields omitted */ }

View of a vertex entity.

Exposes references to a vertex entity and provides the primary vertex API.

See the module documentation for more information about views.

Implementations

impl<B, M> VertexView<B> where
    B: Reborrow<Target = M>,
    M: AsStorage<Vertex<<B as Geometric>::Geometry>> + Geometric, 
[src]

pub fn to_ref(&self) -> VertexView<&M>[src]

pub fn position<'a>(&'a self) -> &'a VertexPosition<<B as Geometric>::Geometry> where
    <B as Geometric>::Geometry: 'a,
    <<B as Geometric>::Geometry as GraphGeometry>::Vertex: AsPosition
[src]

impl<'a, B, M, G> VertexView<B> where
    B: ReborrowInto<'a, Target = M>,
    M: AsStorage<Vertex<G>> + Geometric<Geometry = G>,
    G: GraphGeometry
[src]

pub fn into_ref(self) -> VertexView<&'a M>[src]

Examples

use decorum::N64;
use nalgebra::Point3;
use plexus::graph::MeshGraph;
use plexus::prelude::*;
use plexus::primitive::cube::Cube;
use plexus::primitive::generate::Position;

let mut graph = Cube::new()
    .polygons::<Position<Point3<N64>>>()
    .collect::<MeshGraph<Point3<N64>>>();
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();

impl<B, M, G> VertexView<B> where
    B: Reborrow<Target = M>,
    M: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Geometric<Geometry = G>,
    G: GraphGeometry
[src]

pub fn into_outgoing_arc(self) -> ArcView<B>[src]

Converts the vertex into its leading (outgoing) arc.

pub fn outgoing_arc(&self) -> ArcView<&M>[src]

Gets the leading (outgoing) arc of the vertex.

pub fn shortest_path(&self, key: VertexKey) -> Result<Path<&M>, GraphError>[src]

pub fn into_shortest_path(self, key: VertexKey) -> Result<Path<B>, GraphError>[src]

pub fn shortest_path_with<Q, F>(
    &self,
    key: VertexKey,
    f: F
) -> Result<Path<&M>, GraphError> where
    Q: Copy + Metric,
    F: Fn(VertexView<&M>, VertexView<&M>) -> Q, 
[src]

pub fn into_shortest_path_with<Q, F>(
    self,
    key: VertexKey,
    f: F
) -> Result<Path<B>, GraphError> where
    Q: Copy + Metric,
    F: Fn(VertexView<&M>, VertexView<&M>) -> Q, 
[src]

pub fn valence(&self) -> usize[src]

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
[src]

impl<B, M, G> VertexView<B> where
    B: Reborrow<Target = M>,
    M: AsStorage<Arc<G>> + AsStorage<Face<G>> + AsStorage<Vertex<G>> + Consistent + Geometric<Geometry = G>,
    G: GraphGeometry
[src]

pub fn normal(&self) -> Result<Vector<VertexPosition<G>>, GraphError> where
    G: VertexNormal,
    G::Vertex: AsPosition
[src]

impl<'a, B, M, G> VertexView<B> where
    B: ReborrowInto<'a, Target = M>,
    M: 'a + AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Geometric<Geometry = G>,
    G: GraphGeometry
[src]

pub fn into_adjacent_vertices(
    self
) -> impl Clone + Iterator<Item = VertexView<&'a M>>
[src]

pub fn into_incoming_arcs(self) -> impl Clone + Iterator<Item = ArcView<&'a M>>[src]

pub fn into_outgoing_arcs(self) -> impl Clone + Iterator<Item = ArcView<&'a M>>[src]

impl<B, G> VertexView<B> where
    B: Reborrow,
    B::Target: AsStorage<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Geometric<Geometry = G>,
    G: GraphGeometry
[src]

pub fn adjacent_vertices(
    &self
) -> impl Clone + Iterator<Item = VertexView<&B::Target>>
[src]

pub fn incoming_arcs(&self) -> impl Clone + Iterator<Item = ArcView<&B::Target>>[src]

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.

pub fn outgoing_arcs(&self) -> impl Clone + Iterator<Item = ArcView<&B::Target>>[src]

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.

pub fn traverse_by_breadth(
    &self
) -> impl Clone + Iterator<Item = VertexView<&B::Target>>
[src]

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.

pub fn traverse_by_depth(
    &self
) -> impl Clone + Iterator<Item = VertexView<&B::Target>>
[src]

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.

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 + Geometric<Geometry = G>,
    G: GraphGeometry
[src]

pub fn into_adjacent_faces(
    self
) -> impl Clone + Iterator<Item = FaceView<&'a M>>
[src]

impl<B, G> VertexView<B> where
    B: Reborrow,
    B::Target: AsStorage<Arc<G>> + AsStorage<Face<G>> + AsStorage<Vertex<G>> + Consistent + Geometric<Geometry = G>,
    G: GraphGeometry
[src]

pub fn adjacent_faces(
    &self
) -> impl Clone + Iterator<Item = FaceView<&B::Target>>
[src]

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.

impl<'a, M, G> VertexView<&'a mut M> where
    M: AsStorage<Arc<G>> + AsStorageMut<Vertex<G>> + Consistent + Geometric<Geometry = G>,
    G: 'a + GraphGeometry
[src]

pub fn into_adjacent_vertex_orphans(
    self
) -> impl Iterator<Item = VertexOrphan<'a, G>>
[src]

impl<B> VertexView<B> where
    B: ReborrowMut,
    B::Target: AsStorage<Arc<<B as Geometric>::Geometry>> + AsStorageMut<Vertex<<B as Geometric>::Geometry>> + Consistent + Geometric, 
[src]

pub fn adjacent_vertex_orphans(
    &mut self
) -> impl Iterator<Item = VertexOrphan<<B as Geometric>::Geometry>>
[src]

impl<'a, M, G> VertexView<&'a mut M> where
    M: AsStorageMut<Arc<G>> + AsStorage<Vertex<G>> + Consistent + Geometric<Geometry = G>,
    G: 'a + GraphGeometry
[src]

pub fn into_incoming_arc_orphans(self) -> impl Iterator<Item = ArcOrphan<'a, G>>[src]

impl<B> VertexView<B> where
    B: ReborrowMut,
    B::Target: AsStorageMut<Arc<<B as Geometric>::Geometry>> + AsStorage<Vertex<<B as Geometric>::Geometry>> + Consistent + Geometric, 
[src]

pub fn incoming_arc_orphans(
    &mut self
) -> impl Iterator<Item = ArcOrphan<<B as Geometric>::Geometry>>
[src]

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.

impl<'a, M, G> VertexView<&'a mut M> where
    M: AsStorage<Arc<G>> + AsStorageMut<Face<G>> + AsStorage<Vertex<G>> + Consistent + Geometric<Geometry = G>,
    G: 'a + GraphGeometry
[src]

pub fn into_adjacent_face_orphans(
    self
) -> impl Iterator<Item = FaceOrphan<'a, G>>
[src]

impl<B> VertexView<B> where
    B: ReborrowMut,
    B::Target: AsStorage<Arc<<B as Geometric>::Geometry>> + AsStorageMut<Face<<B as Geometric>::Geometry>> + AsStorage<Vertex<<B as Geometric>::Geometry>> + Consistent + Geometric, 
[src]

pub fn adjacent_face_orphans(
    &mut self
) -> impl Iterator<Item = FaceOrphan<<B as Geometric>::Geometry>>
[src]

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.

impl<'a, M, G> VertexView<&'a mut M> where
    M: AsStorage<Arc<G>> + AsStorage<Edge<G>> + AsStorage<Face<G>> + AsStorage<Vertex<G>> + Default + Mutable<Geometry = G>,
    G: GraphGeometry
[src]

pub fn remove(self)[src]

Removes the vertex.

Any and all dependent topology is 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 topological structures.

Examples

Removing a corner from a cube by removing its vertex:

use decorum::N64;
use nalgebra::Point3;
use plexus::graph::MeshGraph;
use plexus::prelude::*;
use plexus::primitive::cube::Cube;
use plexus::primitive::generate::Position;

let mut graph = Cube::new()
    .polygons::<Position<Point3<N64>>>()
    .collect::<MeshGraph<Point3<f64>>>();
let key = graph.vertices().nth(0).unwrap().key();
graph.vertex_mut(key).unwrap().remove();

Trait Implementations

impl<B, M, G> Clone for VertexView<B> where
    B: Reborrow<Target = M>,
    M: AsStorage<Vertex<G>> + Geometric<Geometry = G>,
    G: GraphGeometry,
    View<B, Vertex<G>>: Clone
[src]

impl<B, M, G> ClosedView for VertexView<B> where
    B: Reborrow<Target = M>,
    M: AsStorage<Vertex<G>> + Geometric<Geometry = G>,
    G: GraphGeometry
[src]

type Key = VertexKey

type Entity = Vertex<G>

fn key(&self) -> Self::Key[src]

Gets the key for the vertex.

impl<B, M, G> Copy for VertexView<B> where
    B: Reborrow<Target = M>,
    M: AsStorage<Vertex<G>> + Geometric<Geometry = G>,
    G: GraphGeometry,
    View<B, Vertex<G>>: Copy
[src]

impl<B, M, G> Deref for VertexView<B> where
    B: Reborrow<Target = M>,
    M: AsStorage<Vertex<G>> + Geometric<Geometry = G>,
    G: GraphGeometry
[src]

type Target = Vertex<G>

The resulting type after dereferencing.

impl<B, M, G> DerefMut for VertexView<B> where
    B: ReborrowMut<Target = M>,
    M: AsStorageMut<Vertex<G>> + Geometric<Geometry = G>,
    G: GraphGeometry
[src]

impl<'a, M, G> From<VertexView<&'a mut M>> for VertexOrphan<'a, G> where
    M: AsStorageMut<Vertex<G>> + Geometric<Geometry = G>,
    G: GraphGeometry
[src]

impl<B, M, G> PartialEq<VertexView<B>> for VertexView<B> where
    B: Reborrow<Target = M>,
    M: AsStorage<Vertex<G>> + Consistent + Geometric<Geometry = G>,
    G: GraphGeometry
[src]

Auto Trait Implementations

impl<B> RefUnwindSafe for VertexView<B> where
    B: RefUnwindSafe,
    <<B as Reborrow>::Target as Geometric>::Geometry: GraphGeometry

impl<B> Send for VertexView<B> where
    B: Send,
    <<B as Reborrow>::Target as Geometric>::Geometry: GraphGeometry

impl<B> Sync for VertexView<B> where
    B: Sync,
    <<B as Reborrow>::Target as Geometric>::Geometry: GraphGeometry

impl<B> Unpin for VertexView<B> where
    B: Unpin,
    <<B as Reborrow>::Target as Geometric>::Geometry: GraphGeometry

impl<B> UnwindSafe for VertexView<B> where
    B: UnwindSafe,
    <<B as Reborrow>::Target as Geometric>::Geometry: GraphGeometry

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FromGeometry<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> IntoGeometry<U> for T where
    U: FromGeometry<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Slottable for T where
    T: Copy
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,