build_grid_ahull_fill: Regular grid in alpha-hull

Description Usage Arguments Details Value See Also Examples

View source: R/build_grid_ahull_fill.R

Description

Create a grid within the alpha hull of a set of points.

Usage

1
2
build_grid_ahull_fill(coords, npts, pad = NULL, grid_opts = list(alpha =
  0.3, error_tol = 0.05, run_max = 20, verbose = FALSE))

Arguments

coords

A matrix or data.frame of coordinates with two columns

npts

The approximate number of points of the requested grid

pad

ignored argument

grid_opts

A list with component alpha, error_tol, run_max and verbose that controls the computation of the grid.

Details

This function computes the alpha hull of a set of points, then iteratively finds the best grid of npts points fitting in the hull.

This function computes the alpha hull of a set of points which is an estimate of its overall outline. The intricateness of this outline is determined by the alpha parameter: a value close to zero will produce a very intricate outline and a high value will produce a coarse outline (similar to the convex hull). It is highly recommended to try different values of alpha to see what is most appropriate for one's datasets.

Parameter error_tol controls the acceptable relative error in the grid number of points (e.g. 0.1 for 10 control the iteration process.

Value

The coordinates of a grid of points as a data.frame with approximately npts rows and ncol(coords) columns. Names are transfered from the coords data frame.

See Also

ahull

Other grid.building.functions: build_grid_ahull_crop, build_grid_identical, build_grid_squaretile

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(meadow)

# Plot a grid with diagnostics
grid <- build_grid_ahull_fill(meadow[ ,c('lon','lat')], 10000,
                              grid_opts = list(verbose = TRUE))
plot(grid, pch = 21)

# See the influence of alpha parameter
par(mfrow = c(1, 4))
for ( alpha in c( .3, 1, 4, 10) ) {
  grid <- build_grid_ahull_fill(meadow[ ,c('lon','lat')], 10000,
                                grid_opts = list(alpha = alpha))
  plot(grid, pch = 21)
  title(paste0("alpha=",alpha))
}

rollply documentation built on May 30, 2017, 8:07 a.m.