| Crates.io | rita |
| lib.rs | rita |
| version | 0.2.1 |
| created_at | 2025-02-06 16:14:16.866936+00 |
| updated_at | 2025-04-29 20:29:56.383832+00 |
| description | 2D and 3D Randomized Incremental Triangulation Algorithms |
| homepage | |
| repository | https://github.com/glennDittmann/rita |
| max_upload_size | |
| id | 1545793 |
| size | 202,136 |
An implementation of (randomized) incremental weighted Delaunay triangulations in safe rust.
You can create a two- or three-dimensional Delaunay triangulation, including weighted points, as follows.
let vertices = vec![
[0.0, 0.0],
[-0.5, 1.0],
[0.0, 2.5],
[2.0, 3.0],
[4.0, 2.5],
[5.0, 1.5],
[4.5, 0.5],
[2.5, -0.5],
[1.5, 1.5],
[3.0, 1.0],
];
let weights = vec![0.2, 0.3, 0.55, 0.5, 0.6, 0.4, 0.65, 0.7, 0.85, 0.35]; // or None
let mut triangulation = Triangulation::new(None); // specify epsilon here
let result = triangulation.insert_vertices(&vertices, Some(weights), true); // last parameter toggles spatial sorting
let vertices = vec![
[0.0, 0.0, 0.0],
[-0.5, 1.0, 0.5],
[0.0, 2.5, 2.5],
[2.0, 3.0, 5.0],
[4.0, 2.5, 6.5],
[5.0, 1.5, 6.5],
[4.5, 0.5, 5.0],
[2.5, -0.5, 2.0],
[1.5, 1.5, 3.0],
[3.0, 1.0, 4.0],
];
let weights = vec![0.2, 0.3, 0.55, 0.5, 0.6, 0.4, 0.65, 0.7, 0.85, 0.35]; // or None
let mut tetrahedralization = Tetrahedralization::new(None); // specify epsilon here
let result = tetrahedralization.insert_vertices(&vertices, Some(weights), true); // last parameter toggles spatial sorting
The eps parameter is used to perform an approximation technique, which leaves out certain vertices based on epsilon in the incremental insertion process.
:warning: This is a work in progress. :warning: The algorithms work, as test coverage indicates. However, the code is not yet fully optimized and the API is not yet simplified. There might be duplicate and unnecessarily complex code.
Robustness is achieved through geogram_predicates, which itself uses cxx to make the geometric predicates from geogram available in rust.
There is decent preliminary work done in the rust eco-system by Bastien Durix in the crate simple_delaunay_lib.
We forked this and re-fined by adding
Theoretical Concepts
Code structure
Conventions
Algorithmic Improvements
remove unneccary push of 2 extra edges after 2->2 flip
remove unused match case in should_flip_hedge()
early out for match case in should_flip_hedge that always returns false i.e. Flip::None
exchange geo::robust for geogram_predicates which has the same features plus:
add a naive version of last inserted triangle, which speeds up location (especially when using spatial sorting)
WIP
Thanks to Bastien Durix for his prior work on incremental Delaunay triangulations in rust.