13 unstable releases
Uses new Rust 2024
| 0.7.1 | Nov 9, 2025 |
|---|---|
| 0.6.1 | Dec 25, 2024 |
| 0.5.5 | Nov 28, 2024 |
#323 in Math
440KB
9K
SLoC
Alum: A Halfedge based Polygon Mesh Library
This library is inspired by OpenMesh, hence has an API very similar to that of OpenMesh. I love using OpenMesh in C++, and wrote this library because I couldn't find an equivalent in Rust. Huge thanks to OpenMesh and it's maintainers for the inspiration!
For now, the features of this library exist to serve my other projects. It has
full parity with the OpenMesh/Core module, and has partial parity with the
OpenMesh/Tools module, and new features will be added as required by my other
projects.
Installation
This can be added to a Rust project as a dependency from crates.io with:
cargo add alum
Or by adding the following to your Cargo.toml:
[dependencies]
alum = "0.6.1"
Usage and Features
The library includes default implementations of mesh adaptors, and corresponding
mesh types with single and double floating point precision. If you're not happy
with these default adaptors, you can write your own adaptor that tells the
library how to work with the vector and scalar types of your choice. Read the
documentation to learn more about
this. These
examples
demonstrate writing custom adaptors and rendering and using various features of
this crate together with three_d
Subdivision
Mesh subdivision is available under the "subdiv" feature. Catmull-Clark, Loop, and Sqrt3 subdivision schemes are implemented. This example demonstrates all three decimation schemes.
Decimation
Decimation is implemented with an architecture very similar to that of OpenMesh,
and is available under the "decimate" feature. You can write your own
implementation of the Decimater trait, to decimate the mesh with a custom
heuristic. The library does come with some commonly useful decimater
implementations. More maybe added later. This
example
demonstrates the decimation of a mesh using the probabilistic quadric minimizing decimater.
Property System
This library also comes with a property system just like the one in OpenMesh,
with some small improvements and differences. The properties are always
synchronized with the mesh elements, through additions, deletions and garbage
collections which result in reordering of elements. Unlike properties in
OpenMesh, the properties here use interior mutability with RefCell<T> and
enforce runtime borrow checking rules. Read the
documentation to learn more.
Dependencies
~0.8–1MB
~15K SLoC