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

pub struct VertexView<M, G> where
    M: Reborrow,
    M::Target: AsStorage<VertexPayload<G>>,
    G: GraphGeometry
{ /* fields omitted */ }

View of a vertex in a graph.

Provides traversals, queries, and mutations related to vertices in a graph. See the module documentation for more information about topological views.

Methods

impl<M, G> VertexView<M, G> where
    M: Reborrow,
    M::Target: AsStorage<VertexPayload<G>>,
    G: GraphGeometry
[src]

pub fn key(&self) -> VertexKey[src]

Gets the key for the vertex.

pub fn position(&self) -> &VertexPosition<G> where
    G::Vertex: AsPosition
[src]

impl<'a, M, G> VertexView<&'a mut M, G> where
    M: 'a + AsStorage<VertexPayload<G>> + AsStorageMut<VertexPayload<G>>,
    G: 'a + GraphGeometry
[src]

pub fn into_orphan(self) -> VertexOrphan<'a, G>[src]

Converts a mutable view into an orphan view.

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

Converts a mutable view into an immutable view.

This is useful when mutations are not (or no longer) needed and mutual access is desired.

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<M, G> VertexView<M, G> where
    M: Reborrow,
    M::Target: AsStorage<ArcPayload<G>> + AsStorage<VertexPayload<G>> + Consistent,
    G: GraphGeometry
[src]

pub fn into_outgoing_arc(self) -> ArcView<M, G>[src]

Converts the vertex into its leading (outgoing) arc.

pub fn outgoing_arc(&self) -> ArcView<&M::Target, G>[src]

Gets the leading (outgoing) arc of the vertex.

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

Gets an iterator that traverses the vertices of the graph in breadth-first order beginning with the vertex on which this function is called.

The traversal moves from the vertex to its neighboring 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<&M::Target, G>>
[src]

Gets an iterator that traverses the vertices of the graph in depth-first order beginning with the vertex on which this function is called.

The traversal moves from the vertex to its neighboring 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 neighboring_vertices(
    &self
) -> impl Clone + Iterator<Item = VertexView<&M::Target, G>>
[src]

pub fn incoming_arcs(
    &self
) -> impl Clone + Iterator<Item = ArcView<&M::Target, G>>
[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<&M::Target, G>>
[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 centroid(&self) -> VertexPosition<G> where
    G: VertexCentroid,
    G::Vertex: AsPosition
[src]

impl<M, G> VertexView<M, G> where
    M: Reborrow + ReborrowMut,
    M::Target: AsStorage<ArcPayload<G>> + AsStorage<VertexPayload<G>> + AsStorageMut<VertexPayload<G>> + Consistent,
    G: GraphGeometry
[src]

pub fn neighboring_vertex_orphans(
    &mut self
) -> impl Iterator<Item = VertexOrphan<G>>
[src]

impl<M, G> VertexView<M, G> where
    M: Reborrow + ReborrowMut,
    M::Target: AsStorage<ArcPayload<G>> + AsStorageMut<ArcPayload<G>> + AsStorage<VertexPayload<G>> + Consistent,
    G: GraphGeometry
[src]

pub fn incoming_arc_orphans(&mut self) -> impl Iterator<Item = ArcOrphan<G>>[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<M, G> VertexView<M, G> where
    M: Reborrow,
    M::Target: AsStorage<ArcPayload<G>> + AsStorage<FacePayload<G>> + AsStorage<VertexPayload<G>> + Consistent,
    G: GraphGeometry
[src]

pub fn neighboring_faces(
    &self
) -> impl Clone + Iterator<Item = FaceView<&M::Target, G>>
[src]

Gets an iterator of views over the neighboring faces of the vertex.

The ordering of faces is deterministic and is based on the leading arc of the vertex.

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

impl<M, G> VertexView<M, G> where
    M: Reborrow + ReborrowMut,
    M::Target: AsStorage<ArcPayload<G>> + AsStorage<FacePayload<G>> + AsStorageMut<FacePayload<G>> + AsStorage<VertexPayload<G>> + Consistent,
    G: GraphGeometry
[src]

pub fn neighboring_face_orphans(
    &mut self
) -> impl Iterator<Item = FaceOrphan<G>>
[src]

Gets an iterator of orphan views over the neighboring 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, G> where
    M: AsStorage<ArcPayload<G>> + AsStorage<EdgePayload<G>> + AsStorage<FacePayload<G>> + AsStorage<VertexPayload<G>> + Default + Mutable<G>,
    G: 'a + 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<M, G> PayloadBinding for VertexView<M, G> where
    M: Reborrow,
    M::Target: AsStorage<VertexPayload<G>>,
    G: GraphGeometry
[src]

type Key = VertexKey

type Payload = VertexPayload<G>

impl<M, G> Clone for VertexView<M, G> where
    M: Reborrow,
    M::Target: AsStorage<VertexPayload<G>>,
    G: GraphGeometry,
    View<M, VertexPayload<G>>: Clone
[src]

impl<M, G> Copy for VertexView<M, G> where
    M: Reborrow,
    M::Target: AsStorage<VertexPayload<G>>,
    G: GraphGeometry,
    View<M, VertexPayload<G>>: Copy
[src]

impl<M, G> PartialEq<VertexView<M, G>> for VertexView<M, G> where
    M: Reborrow,
    M::Target: AsStorage<VertexPayload<G>> + Consistent,
    G: GraphGeometry
[src]

impl<M, G> Deref for VertexView<M, G> where
    M: Reborrow,
    M::Target: AsStorage<VertexPayload<G>>,
    G: GraphGeometry
[src]

type Target = VertexPayload<G>

The resulting type after dereferencing.

impl<M, G> DerefMut for VertexView<M, G> where
    M: Reborrow + ReborrowMut,
    M::Target: AsStorage<VertexPayload<G>> + AsStorageMut<VertexPayload<G>>,
    G: GraphGeometry
[src]

Auto Trait Implementations

impl<M, G> Send for VertexView<M, G> where
    M: Send

impl<M, G> Sync for VertexView<M, G> where
    M: Sync

impl<M, G> Unpin for VertexView<M, G> where
    M: Unpin

impl<M, G> UnwindSafe for VertexView<M, G> where
    M: UnwindSafe

impl<M, G> RefUnwindSafe for VertexView<M, G> where
    M: RefUnwindSafe

Blanket Implementations

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

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

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

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

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

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

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