Learn R Programming

henna (version 0.3.4)

convexHull: Construct the convex hull of a set of points

Description

This function constructs the convex hull of a set of points.

Usage

convexHull(pointsDF, hullIndices = NULL)

Value

A data frame with two columns representing the points on the convex hull.

Arguments

pointsDF

A data frame with the x and y coordinates of the points.

hullIndices

Precalculated hull indices. Default is NULL: hull indices are not provided, but they are calculated by convexHull.

Details

The points must be provided as a data frame with two columns.

Examples

Run this code
pointsDF <- data.frame(a = c(1, 2, 2, 3, 3, 4, 5, 6, 8, 6,
7, 8, 6, 8, 10, 3, 1),
b = c(2, 3, 4, 8, 5, 6, 5, 4, 8, 11, 13, 14, 2, 1, 2, 14, 9))
hull <- convexHull(pointsDF)

Run the code above in your browser using DataLab