[][src]Trait plexus::IteratorExt

pub trait IteratorExt: Iterator + Sized {
    fn perimeter(self) -> Perimeter<Self>
    where
        Self::Item: Clone
, { ... }
fn keys(self) -> Keys<Self>
    where
        Self::Item: PayloadBinding
, { ... } }

Extension methods for types implementing Iterator.

Provided methods

Important traits for Perimeter<I>
fn perimeter(self) -> Perimeter<Self> where
    Self::Item: Clone

Provides an iterator over a window of duplets that includes the first value in the sequence at the beginning and end of the iteration.

Given a collection of ordered elements $\{a, b, c\}$, this iterator yeilds the ordered items $\{(a, b), (b, c), (c, a)\}$.

Important traits for Keys<I>
fn keys(self) -> Keys<Self> where
    Self::Item: PayloadBinding

Maps an iterator over topological views to the keys of those views.

It is often useful to examine or collect the keys of views over a MeshGraph. This iterator avoids redundant use of map to extract keys.

Examples

Collecting keys of faces before a topological mutation:

use decorum::R64;
use nalgebra::Point3;
use plexus::graph::MeshGraph;
use plexus::prelude::*;
use plexus::primitive::generate::Position;
use plexus::primitive::sphere::UvSphere;

type E3 = Point3<R64>;

let mut graph = UvSphere::new(6, 6)
    .polygons::<Position<E3>>()
    .collect::<MeshGraph<E3>>();

let keys = graph
    .faces()
    .filter(|face| face.arity() > 3)
    .keys()
    .collect::<Vec<_>>();
for key in keys {
    graph.face_mut(key).unwrap().poke_with_offset(0.5);
}
Loading content...

Implementors

impl<I> IteratorExt for I where
    I: Iterator
[src]

Loading content...