# [−][src]Module plexus::primitive

Primitive topological structures.

This module provides composable primitives that can form polygonal
structures. This includes simple *$n$-gons* like triangles, *generators*
that form more complex polytopes like spheres, and *iterator expressions*
that compose and decompose streams of topological and geometric data.

Plexus uses the terms *trigon* and *tetragon* for its types, which mean
*triangle* and *quadrilateral*, respectively. This is done for consistency
with higher arity polygon names (e.g., *decagon*). In some contexts, the
term *triangle* is still used, such as in functions concerning
*triangulation*.

# Examples

Generating raw buffers with the positional data for a 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 (indices). let indices = sphere .indexing_polygons::<Position>() .triangulate() .vertices() .collect::<Vec<_>>();

Generating raw buffers with positional data for a cube using an indexer:

use decorum::N64; use nalgebra::Point3; use plexus::index::{Flat3, HashIndexer}; use plexus::prelude::*; use plexus::primitive::cube::Cube; use plexus::primitive::generate::Position; let (indices, positions) = Cube::new() .polygons::<Position<Point3<N64>>>() .triangulate() .index_vertices::<Flat3, _>(HashIndexer::default());

## Modules

cube | Cube primitives. |

decompose | Topological decomposition and tessellation. |

generate | Polytope generation. |

sphere | Sphere primitives. |

## Structs

InteriorMap | |

NGon | $n$-gon with fixed arity. |

## Enums

Polygon | $n$-gon with dynamic arity. |

## Traits

ConstantArity | |

MapVertices | |

Polygonal | |

Rotate | |

Topological | |

Zip |

## Functions

zip_vertices | Zips the vertices and topologies from multiple iterators into a single iterator. |

## Type Definitions

Edge | |

Tetragon | Quadrilateral. |

Trigon | Triangle. |