Skip to contents

Hull vertices in traversal order plus the enclosed area by the shoelace formula. Vertex ORDER matters: the area is only right if the vertices trace the polygon, which is why it is part of the return value rather than left to the caller.

Usage

morie_convex_hull(points)

Arguments

points

Two-column matrix of (x, y).

Value

Named list with hull_indices, hull_points, n_vertices, area, method.

Details

Mirrors morie.fn.cvxhl (whose NumPy-2 break – np.cross on 2-vectors – has no analogue here; grDevices::chull does the scan).

Examples

morie_convex_hull(rbind(c(0, 0), c(1, 0), c(1, 1), c(0, 1), c(.5, .5)))$area
#> [1] 1