qhull 0.1.0

Rust bindings to Qhull
Documentation

qhull-rs

Rust Qhull bindings

This is a safe wrapper around the qhull-sys crate, it is not feature complete yet, you might prefer to use the raw qhull-sys crate if you need more control.

⚠️Warning⚠️
Errors are not handled properly yet.

Examples

This creates a convex hull of a set of points in 2D:

use qhull::*;

let qh = Qh::builder(2)
    .build_from_iter([
        [0.0, 0.0],
        [1.0, 0.0],
        [0.0, 1.0],
        [0.25, 0.25],
    ]);

assert_eq!(qh.num_faces(), 3);

for simplex in qh.simplices() {
    println!("{:?}", simplex.vertices().map(|v| v.id()).collect::<Vec<_>>());
}

To create a delaunay triangulation, you should use the [Qh::new_delaunay] method.

See the examples directory for more examples, you can run them with cargo run --example <example_name>, for example:

cargo run --example delaunay

Error handling

Qhull uses setjmp/longjmp for error handling, this is not currently supported in Rust, so errors are not handled properly yet.

Relevant links:

To walk around #2625 we might use some custom C code, but this would require some work I'm not willing to do right now.

License

This crate uses Qhull, please refer to the Qhull license for more information when using this crate.