11 releases
0.2.4 | Dec 8, 2020 |
---|---|
0.2.3 | Sep 1, 2020 |
0.2.2 |
|
0.1.8 | Aug 21, 2020 |
#1578 in Algorithms
369 downloads per month
140KB
1K
SLoC
chull
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