Trait plexus::index::CollectWithIndexer
source · [−]pub trait CollectWithIndexer<P, Q> where
P: Topological,
Q: Topological<Vertex = P::Vertex>, {
fn collect_with_indexer<T, N>(self, indexer: N) -> Result<T, T::Error>
where
T: FromIndexer<P, Q>,
N: Indexer<Q, P::Vertex>;
}
Expand description
Functions for collecting an iterator of $n$-gons into a mesh data structure.
These functions can be used to collect data from an iterator into mesh data
structures like MeshBuffer
or MeshGraph
.
See HashIndexer
and LruIndexer
.
Required Methods
fn collect_with_indexer<T, N>(self, indexer: N) -> Result<T, T::Error> where
T: FromIndexer<P, Q>,
N: Indexer<Q, P::Vertex>,
fn collect_with_indexer<T, N>(self, indexer: N) -> Result<T, T::Error> where
T: FromIndexer<P, Q>,
N: Indexer<Q, P::Vertex>,
Collects an iterator of $n$-gons into a mesh data structure using the given indexer.
Unlike collect
, this function allows the indexer to be specified.
Errors
Returns an error defined by the implementer if the target type cannot be constructed from the indexed vertex data.
Examples
use decorum::R64;
use nalgebra::Point3;
use plexus::graph::MeshGraph;
use plexus::prelude::*;
use plexus::primitive::cube::Cube;
use plexus::primitive::generate::Position;
use plexus::index::HashIndexer;
let graph: MeshGraph<Point3<f64>> = Cube::new()
.polygons::<Position<Point3<R64>>>()
.collect_with_indexer(HashIndexer::default())
.unwrap();