| Crates.io | polyhedron |
| lib.rs | polyhedron |
| version | 0.1.3 |
| created_at | 2025-06-21 03:21:26.09881+00 |
| updated_at | 2026-01-16 00:42:26.96676+00 |
| description | A half edge and radial edge implementation. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1720491 |
| size | 1,627,132 |
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 software for commercial use, please contact Foresight Spacial labs as described in the license.
WARNING: This crate has certain design decisions that can cause undefined behaviour if miss used. In particular, handles should not be stored as they may outlive the object that generated them. If you think you can improve safety without making major sacrifices to performance and ergonomics please make a merge request.