Skip to main content

convex_hull_2d

Function convex_hull_2d 

Source
pub fn convex_hull_2d(points: &[[f64; 2]]) -> Vec<usize>
Expand description

The convex hull of 2D points by Andrew’s monotone chain, O(n log n).

Returns indices into points of the hull vertices in counter-clockwise order, starting from the lexicographically smallest point. Collinear points on hull edges and duplicate points are excluded. Fewer than three distinct points, or all-collinear input, yields the extreme points only (zero, one or two indices).