| pointsToSegments | R Documentation |
This function constructs a data frame of segments from a data frame of points.
pointsToSegments(pointsDF, joinEnds = TRUE)
pointsDF |
A data frame with the x and y coordinates of the points. Each point must appear only once. |
joinEnds |
Whether to join the last point with the first one. |
A data frame of segments represented using four columns
(x, y, xEnd, yEnd).
pointsDF <- data.frame(x = c(1, 2, 4, 7, 10,
12, 13, 15, 16),
y = c(1, 1, 2, 3, 3, 2, 1, 2, 1))
hullIndices <- grDevices::chull(pointsDF[, 1], pointsDF[, 2])
hull <- convexHull(pointsDF, hullIndices)
pointsToSegments(hull)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.