Skip to contents

Alpha shape calculation for a set of points, and alpha threshold

Usage

ashape(x, y = NULL, alpha, ...)

Arguments

x, y

numeric vector with coordinate points.

alpha

numeric with alpha threshold to use.

...

additional arguments are ignored.

Value

ashape object, which is a list containing:

  • edges: x,y coordinates of Delauney triangulation of the alpha-shape.

  • length: length of the alpha-shape.

  • alpha: value of alpha used.

  • alpha.extremes: integer index of points which were alpha-extremes.

  • delvor.obj: delvor object with Delauney/Voronoi supporting data.

  • x: x,y coordinates of input data

Details

This function is primarily intended to be called by make_point_hull(), since that function also iterates alpha values until it finds a suitable, and successful, threshold.

Examples

n <- 300
theta <- runif(n, 0, 2*pi)
r <- sqrt(runif(n, 0.25^2, 0.5^2))
x <- cbind(0.5+r*cos(theta), 0.5+r*sin(theta))
alpha <- 0.1
ashape.obj <- ashape(x, alpha=alpha)

plot(ashape.obj$x, asp=1)
segments(x0=ashape.obj$edges[, "x1"], x1=ashape.obj$edges[, "x2"],
   y0=ashape.obj$edges[, "y1"], y1=ashape.obj$edges[, "y2"])