Plexus is a Rust library for generating and manipulating 3D meshes.
Meshes can be generated from primitives like cubes and spheres using iterator
expressions. Primitives emit topological structures like Triangle
s or
Quad
s, which contain arbitrary geometric data in their vertices. These can be
transformed and decomposed into other topologies and geometric data via
triangulation, tesselation, and conversion into rendering pipeline data.
```rust use plexus::buffer::conjoint::ConjointBuffer; use plexus::generate::{sphere, HashConjugate}; use plexus::generate::prelude::*; // Common generator traits.
// Example module in the local crate that provides rendering. use render::{self, Vertex};
// Construct a buffer of index and vertex data from a sphere primitive.
// HashConjugate
is used to convert vertex geometry into a conjugate type
// that supports Hash
via the into_hash
function. That type is convertible
// to Vertex
via the From
trait in this example.
let buffer = sphere::UVSphere::
Generators are flexible and easy to use, but only represent vertex geometry and
are difficult to query and manipulate once complete. A Mesh
, represented as a
half-edge graph,
supports arbitrary geometry for vertices, edges, and faces. The graph can also
be queried and manipulated in ways that generators and iterator expressions
cannot.
```rust use nalgebra::Point3; use plexus::r32; use plexus::generate::{sphere, HashConjugate}; use plexus::generate::prelude::*; use plexus::graph::{FaceKey, IntoGeometry, Mesh};
// Construct a mesh from a sphere primitive. Note that the (r32, r32, r32)
// geometry is convertible to Point3<f32>
via the FromGeometry
trait in
// this example.
let mesh: Mesh