Expand description
Polytope generation.
This module provides a generic iterator and traits for generating polygons
and vertices containing geometric attributes of polytopes like cubes and
spheres. The Generate
iterator can be used in iterator expressions.
The primary API of this module is provided by the Generator
trait, which
is implemented by polytope types like Cube
and UvSphere
.
Examples
Generating raw buffers from the positional data of a $uv$-sphere:
use nalgebra::Point3;
use plexus::prelude::*;
use plexus::primitive::generate::Position;
use plexus::primitive::sphere::UvSphere;
let sphere = UvSphere::new(16, 16);
// Generate the unique set of positional vertices.
let positions = sphere
.vertices::<Position<Point3<f64>>>()
.collect::<Vec<_>>();
// Generate polygons that index the unique set of positional vertices. The
// polygons are decomposed into triangles and then into vertices, where each
// vertex is an index into the position data.
let indices = sphere
.indexing_polygons::<Position>()
.triangulate()
.vertices()
.collect::<Vec<_>>();
Structs
Iterator that generates topology and geometric attributes.
Meta-attribute for surface normals.
Meta-attribute for positions.
Traits
Geometric attribute.
Functions for iterating over the topology and geometry of polytopes.