# create raster
r <- terra::rast(extent = c(0, 40, 0, 40), resolution = 1, crs = "epsg:2154")
# xy positions
xy <- data.frame(
x = c(10, 20, 31.25, 15),
y = c(10, 20, 31.25, 25)
)
# compute mask
mask1 <- raster_chull_mask(xy, r)
# display binary raster
terra::plot(mask1)
graphics::points(xy)
Run the code above in your browser using DataLab