11 releases

0.2.4 Dec 8, 2020
0.2.3 Sep 1, 2020
0.2.2 Aug 28, 2020
0.1.8 Aug 21, 2020

#1578 in Algorithms

Download history 68/week @ 2024-07-19 104/week @ 2024-07-26 69/week @ 2024-08-02 93/week @ 2024-08-09 100/week @ 2024-08-16 129/week @ 2024-08-23 97/week @ 2024-08-30 73/week @ 2024-09-06 93/week @ 2024-09-13 210/week @ 2024-09-20 164/week @ 2024-09-27 83/week @ 2024-10-04 95/week @ 2024-10-11 110/week @ 2024-10-18 65/week @ 2024-10-25 91/week @ 2024-11-01

369 downloads per month

MIT/Apache

140KB
1K SLoC

chull

Build Status crates.io

Documentation Convex hull approximation based on Quick hull. Available in 3-D or 2-D for now.

Examples

use chull::{ConvexHull,ConvexHullWrapper};
let p1 = vec![1.0, 1.0, 1.0];
let p2 = vec![1.0, 1.0, -1.0];
let p3 = vec![1.0, -1.0, 1.0];
let p4 = vec![1.0, -1.0, -1.0];
let p5 = vec![-1.0, 1.0, 1.0];
let p6 = vec![-1.0, 1.0, -1.0];
let p7 = vec![-1.0, -1.0, 1.0];
let p8 = vec![-1.0, -1.0, -1.0];
let p9 = vec![0.0, 0.0, 0.0];

let points = vec![p1, p2, p3, p4, p5, p6, p7, p8, p9];

// slow but robust
let cube1 = ConvexHullWrapper::try_new(&points, None).unwrap();
// fast but non-robust
let cube2 = ConvexHull::try_new(&points, std::f64::EPSILON*200.0, None).unwrap();

assert_eq!(cube1.volume(), 8.0);
let (v,i) = cube1.vertices_indices();
assert_eq!(v.len(), 8);
assert_eq!(i.len(), 6 * 2 * 3);

License: MIT/Apache-2.0

Dependencies

~500KB
~11K SLoC