Trait plexus::index::IndexVertices
source · [−]pub trait IndexVertices<P> where
P: Topological, {
fn index_vertices_with<R, N, K, F>(
self,
indexer: N,
f: F
) -> (Vec<R::Group>, Vec<P::Vertex>)
where
Self: GroupedIndexVertices<R, P>,
R: Grouping,
N: Indexer<P, K>,
F: Fn(&P::Vertex) -> &K,
{ ... }
fn index_vertices<R, N>(self, indexer: N) -> (Vec<R::Group>, Vec<P::Vertex>)
where
Self: GroupedIndexVertices<R, P>,
R: Grouping,
N: Indexer<P, P::Vertex>,
{ ... }
}
Expand description
Functions for collecting an iterator of $n$-gons into raw index and vertex buffers.
Unlike GroupedIndexVertices
, this trait provides functions that are
parameterized with respect to Grouping
.
See HashIndexer
and LruIndexer
.
Examples
use decorum::R64;
use nalgebra::Point3;
use plexus::index::{Flat3, HashIndexer};
use plexus::prelude::*;
use plexus::primitive::generate::Position;
use plexus::primitive::sphere::UvSphere;
let sphere = UvSphere::new(32, 32);
let (indices, positions) = sphere
.polygons::<Position<Point3<R64>>>()
.triangulate()
.index_vertices::<Flat3, _>(HashIndexer::default());
Provided Methods
Indexes an iterator of $n$-gons into raw index and vertex buffers using the given grouping, indexer, and keying function.
Indexes an iterator of $n$-gons into raw index and vertex buffers using the given grouping and indexer.
Examples
use decorum::R64;
use nalgebra::Point3;
use plexus::index::HashIndexer;
use plexus::prelude::*;
use plexus::primitive::cube::Cube;
use plexus::primitive::generate::Position;
use plexus::primitive::Trigon;
// `indices` contains `Trigon`s with index data.
let (indices, positions) = Cube::new()
.polygons::<Position<Point3<R64>>>()
.subdivide()
.triangulate()
.index_vertices::<Trigon<usize>, _>(HashIndexer::default());