Crate polyhedron

Source
Expand description

§Polyhedron

image

Polyhedron is a robust implementation of the radial-edge and the half-edge that supports manifold and non manifold topology. It is suitable for geometry processing work such as:

  • Quering the immediate neighbourhood of a vertex.
  • Quadric based simplification.
  • Remeshing.
  • Subdivision.
  • Laplacian smoothing.

And more.

It is implemented agnostically from the underlying geometry representation, meaning that you can both, use your favourite linear algebra library (glam, nalgebra, etc…); and also represent polyhedrons embedded in larger dimensional spaces. For example the 9-dimensional vertices needed for gaussian subdivision.

The library is implemented using a boolean generic flag to enable either a manifold or non manifold internal representation. The manifold representation is faster but more limited. The non-manifold representaion carries some small overhead.

For example, this is how one would do loop subdivision on a non-manifold mesh:

      // Load data.
      let ObjData {
          vertices,
          vertex_face_indices,
          ..
      } = ObjData::from_disk_file("../../../Assets/cube.obj");

      // Construct a non-manifold mesh.
      let mut test = BasicPolyHedron::<_, _, false>::new(
          vertices.clone(),
          (),
          vertex_face_indices
              .iter()
              .map(|l| l.iter().map(|i| *i as usize)),
      );

      // Test the mesh for incorrect internal representations.
      verify_correctness(&test).unwrap();

      // Subdivide at will.
      for _ in 0..3
      {
          loop_subdivision(&mut test);
      }

The easiest place to see how to use the library is to look at the algorithms implemented in the crate.

If you want to use this sofwtare for commercial use, please contact Foresight Spacial labs as described in the license.

Modules§

algorithms
Mesh algorithms, such as simplification, subdivision and remeshing.
data_container
Abstract trait to wrap over the contianers of geoemtric elements.
handles
Topological handles such as VertHandle or FaceHandle to facilitate mesh queries.
prelude
Prelude.
topo_ids
Topological IDs.
verification
Verification methods to check if certain expected properties are respected by a mesh.

Structs§

EdgeIterator
Iterator over all the edges of a mesh.
FaceIterator
Iterator over all the faces of a mesh.
PolyHedron
Versatile topology data structure ofr a mesh. If the generic parameter MANIFOLD is true the mesh will be compiled assuming all inputs are manifold. This is faster but restricted in the kinds of meshes it accepts. If the parameter is false it will allow for the representation of non-manifold geoemtry, but will use O(n) additional memory for the edges and some operations will be slightly slower.
VertIterator
Iterator over all the vertices of a mesh.

Type Aliases§

BasicPolyHedron
A mesh that only has vertex position data.