View source: R/coord-methods.r
convex_hull2d | R Documentation |
convex_hull2d()
is a S3 generic for computing the convex hull of an object.
There is an implemented method supporting Coord2D class objects
using grDevices::chull()
to compute the convex hull.
convex_hull2d(x, ...)
## S3 method for class 'Coord2D'
convex_hull2d(x, ...)
x |
An object representing object to compute convex hull of such as a Coord2D class object. |
... |
Further arguments passed to or from other methods. |
An object of same class as x
representing just the subset of points on the convex hull.
The method for Coord2D class objects returns these points in counter-clockwise order.
p <- as_coord2d(x = rnorm(25), y = rnorm(25))
print(convex_hull2d(p))
# Equivalent to following caculation using `grDevices::chull()`
all.equal(convex_hull2d(p),
p[rev(grDevices::chull(as.list(p)))])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.