resample_grid {Morphoscape} | R Documentation |
Create a full grid from a set of coordinates
Description
resample_grid()
creates a rectangular grid around supplied coordinates by resampling evenly spaced points between the minimum and maximum values of each coordinate dimension. The grid can optionally be reduced to a convex or concave hull around the supplied coordinates.
Usage
resample_grid(coords2D, resample = 100, padding = 1.2, hull = NULL, alpha = 1,
plot = FALSE)
Arguments
coords2D |
a 2-column matrix data frame of coordinates with the x-coordinates in the first column and the y-coordinates in the second column. The ranges of each column will be used to create the resampled grid. |
resample |
the number of points (or pixels) in the x and y dimensions over which to create the grid. Default is 100 for a kriged surface of 100x100=10,000 pixels. |
padding |
a number representing how much to expand the grid beyond the ranges of the x- and y-coordinates. For example, |
hull |
method to restrict the grid to an alpha hull using |
alpha |
when |
plot |
Logical. When |
Value
A data frame with two columns, x
and y
, containing the resampled coordinate grid. When hull
is specified, any points not in the hull will be absent.
See Also
krige_surf
, which uses resample_grid
for kriging.
ahull
and inahull
, or concaveman
for creating the hull.
Examples
data("warps")
warps_fnc <- as_fnc_df(warps)
# hull with plot to see the hull
grid <- resample_grid(warps_fnc[c("x", "y")],
hull = "concaveman", plot = TRUE)
str(grid)
## Not run:
# Alpha hull with plot to see the hull
grid <- resample_grid(warps_fnc[c("x", "y")],
hull = "alphahull", plot = TRUE)
## End(Not run)