Skip to main content

convex_hull_jarvis_2d

convex_hull_jarvis_2d(input, point_count) ⇒ Array.<number>

Simple algorithm for computing convex hull, not the fastest, but it does the job and has very small implementation Please note that the result does not repeat the first vertex, meaning that the last point is not the same as the first point NOTE: complexity is O(nh) where h is the number of point on the hull and n is number of input points

Kind: global function
Returns: Array.<number> - indices of vertices from input that make up the hull, this result is ordered to form a closed loop around the hull if followed
See: https://en.wikipedia.org/wiki/Gift_wrapping_algorithm

ParamTypeDescription
inputArray.<number> | Float32Array | Float64Array2d point set, of form [x0,y0,x1,y1, ... xn,yn]
point_countnumbernumber of points in the input set