| Crates.io | polyhedron |
| lib.rs | polyhedron |
| version | 0.1.1 |
| created_at | 2025-06-21 03:21:26.09881+00 |
| updated_at | 2025-06-21 03:24:17.704913+00 |
| description | A half edge and radial edge implementation. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1720491 |
| size | 1,400,702 |
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:
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.