st_hull | R Documentation |
Concave and convex hulls for LAS objects. st_convex_hull
extends sf::st_convex_hull
for LAS
objects. Both functions return a sfc_POLYGON
. concaveman
is very a fast 2D concave hull algorithm
for a set of points.
st_concave_hull(x, method = "concaveman", ...)
## S3 method for class 'LAS'
st_convex_hull(x)
concaveman(x, y = NULL, concavity = 2, length_threshold = 0)
x , y |
An object of class LAS or XY coordinates of points in case of |
method |
string. currently supports "concaveman". |
... |
Propagate to the method. |
concavity |
numeric a relative measure of concavity. 1 results in a relatively detailed shape, Infinity results in a convex hull. You can use values lower than 1, but they can produce pretty crazy shapes. |
length_threshold |
numeric. When a segment length is below this threshold, it stops being considered for further detailed processing. Higher values result in simpler shapes. |
The concaveman algorithm is based on ideas from Park and Oh (2012). A first implementation in JavaScript was proposed by Vladimir Agafonkin in mapbox. This implementation dramatically improved performance over the one stated in the paper using a spatial index. The algorithm was then ported to R by Joël Gombin in the R package concaveman that runs the JavaScript implementation proposed by Vladimir Agafonkin. Later, a C++ version of Vladimir Agafonkin's JavaScript implementation was proposed by Stanislaw Adaszewski in concaveman-cpp. This concaveman function uses Stanislaw Adaszewski's C++ code making the concaveman algorithm an order of magnitude (up to 50 times) faster than the Javascript version.
A sfc_POLYGON
from sf
or a data.frame
in the case of concaveman
Park, J.-S & Oh, S.-J. (2013). A New Concave Hull Algorithm and Concaveness Measure for n-dimensional Datasets. Journal of Information Science and Engineering. 29. 379-392.
x <- runif(35)
y <- runif(35)
hull <- concaveman(x,y)
plot(x,y, asp = 1)
lines(hull, lwd = 3, col = "red")
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las = readLAS(LASfile, filter = "-drop_z_below 1")
hull = st_concave_hull(las, length_threshold = 10)
plot(hull)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.