2 unstable releases
Uses new Rust 2024
new 0.2.0 | Jul 7, 2025 |
---|---|
0.1.0 | Jul 3, 2025 |
0.0.5 |
|
0.0.4 |
|
#28 in Data formats
796 downloads per month
125KB
2.5K
SLoC
dedup_mesh
Removes duplicated vertices in a 3d mesh, it does so by either a tolerance value or by exact equality.
MSRV
Currently, the minimum supported version is 1.85.1 (because of the 2024 edition)
License
This project is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.
lib.rs
:
dedup_mesh
A library for de-duplicating 3D mesh vertices using spatial hashing and precision-aware clustering.
This crate is designed for robustness, speed, and precision, with strong support for configurable behavior through type-level polymorphism.
Compile-Time Specialization
All major configuration points—such as threading strategy, topology type, pruning behavior, and tolerance handling—are controlled via type parameters, not runtime enums.
This design enables the compiler to optimize each code path statically, resulting in:
- No runtime branching overhead
- Inlining of behavior-specific logic
Note: If you use multiple distinct configurations (e.g., Triangulated
and Edges
), each one will be compiled separately. This increases code size slightly but ensures each variant is optimized independently.
Flexible Vector Support
Input and output vertex types are fully generic:
- Any type that implements
Into<[T; 3]> + Clone + Sync
can be used as input - Any type that implements
From<[T; 3]> + Into<[T; 3]> + Clone + Sync
can be used as output
This means you can directly pass in or receive vertices using types from libraries like
glam
, nalgebra
, cgmath
or your own custom structs
Example
use dedup_mesh::prelude::*;
let (vertices, indices) = dedup::<f32, usize, glam::Vec3, MultiThreaded, Triangulated>(
&input_vertices,
&input_indices,
0.001,
PruneUnused,
PruneDegenerate,
CheckTolerance,
)?;
Features
- Spatial hashing with automatic precision scaling
- Exact or relaxed tolerance policies
- Support for point clouds, edge meshes, and triangles
- Single-threaded and multithreaded execution
- Zero-cost abstraction: unused features are fully optimized out
MSRV
Minimum Supported Rust Version: 1.85.1 (requires Rust 2024 edition)
Crate Status
#![no_std]
: Not yet supported- Parallelism via
rayon
Dependencies
~225–790KB
~16K SLoC