polyhedron

Crates.iopolyhedron
lib.rspolyhedron
version0.1.1
created_at2025-06-21 03:21:26.09881+00
updated_at2025-06-21 03:24:17.704913+00
descriptionA half edge and radial edge implementation.
homepage
repository
max_upload_size
id1720491
size1,400,702
Makogan (Makogan)

documentation

README

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.

Commit count: 0

cargo fmt