Plexus

Plexus is a Rust library for generating and manipulating 3D meshes.

Build Status Documentation Crate

Generation and Iterator Expressions

Meshes can be generated from primitives like cubes and spheres using iterator expressions. Primitives emit topological structures like Triangles or Quads, 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 ordered_float::OrderedFloat; use plexus::buffer::conjoint::ConjointBuffer; use plexus::generate::{sphere, MapVertices, SpatialPolygons};

use render::{self, Vertex}; // Module in the local crate providing rendering.

type r32 = OrderedFloat; // f32 with Eq and Hash implementations.

// Construct a buffer of index and vertex data from a sphere primitive and // render it. Note that (r32, r32, r32) is convertible to Vertex via the // From trait in this example. let buffer = sphere::UVSphere::::withunitradius(16, 16) .spatialpolygons() .mapverticies(|(x, y, z)| (r32::from(x), r32::from(y), r32::from(z))) .mapverticies(|(x, y, z)| (x * 10.0, y * 10.0, z * 10.0)) .collect::>(); render::draw(buffer.asindexslice(), buffer.asvertex_slice()); ```