ahull {alphahull} R Documentation

## alpha-convex hull calculation

### Description

This function calculates the α-convex hull of a given sample of points in the plane for α>0.

### Usage

```ahull(x, y = NULL, alpha)
```

### Arguments

 `x, y` The `x` and `y` arguments provide the `x` and `y` coordinates of a set of points. Alternatively, a single argument `x` can be provided, see Details. `alpha` Value of α.

### Details

An attempt is made to interpret the arguments x and y in a way suitable for computing the α-convex hull. Any reasonable way of defining the coordinates is acceptable, see `xy.coords`.

The α-convex hull is defined for any finite number of points. However, since the algorithm is based on the Delaunay triangulation, at least three non-collinear points are required.

If `y` is NULL and `x` is an object of class `"delvor"`, then the α-convex hull is computed with no need to invoke again the function `delvor` (it reduces the computational cost).

The complement of the α-convex hull can be written as the union of O(n) open balls and halfplanes, see `complement`. The boundary of the α-convex hull is formed by arcs of open balls of radius α (besides possible isolated sample points). The arcs are determined by the intersections of some of the balls that define the complement of the α-convex hull. The extremes of an arc are given by c+rA_θ v and c+rA_{-θ}v where c and r represent the center and radius of the arc, repectively, and A_θ v represents the clockwise rotation of angle θ of the unitary vector v. Joining the end points of adjacent arcs we can define polygons that help us to determine the area of the estimator , see `areaahull`.

### Value

A list with the following components:

 `arcs` For each arc in the boundary of the α-convex hull, the columns of the matrix `arcs` store the center c and radius r of the arc, the unitary vector v, the angle θ that define the arc and the indices of the end points, see Details. The coordinates of the end points of the arcs are stored in `xahull`. For isolated points in the boundary of the α-convex hull, columns 3 to 6 of the matrix `arcs` are equal to zero. `xahull` A 2-column matrix with the coordinates of the original set of points besides possible new end points of the arcs in the boundary of the α-convex hull. `length` Length of the boundary of the α-convex hull, see `lengthahull`. `complement` Output matrix from `complement`. `alpha` Value of α. `ashape.obj` Object of class `"ashape"` returned by the function `ashape`.

### References

Edelsbrunner, H., Kirkpatrick, D.G. and Seidel, R. (1983). On the shape of a set of points in the plane. IEEE Transactions on Information Theory, 29(4), pp.551-559.

Rodriguez-Casal, R. (2007). Set estimation under convexity type assumptions. Annales de l'I.H.P.- Probabilites & Statistiques, 43, pp.763-774.

Pateiro-Lopez, B. (2008). Set estimation under convexity type restrictions. Phd. Thesis. Universidad de Santiago de Compostela. ISBN 978-84-9887-084-8.

`plot.ahull`.

### Examples

```## Not run:
# Random sample in the unit square
x <- matrix(runif(100), nc = 2)
# Value of alpha
alpha <- 0.2
# Alpha-convex hull
ahull.obj <- ahull(x, alpha = alpha)
plot(ahull.obj)

# Uniform sample of size n=300 in the annulus B(c,0.5)\B(c,0.25),
# with c=(0.5,0.5).
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))
# Value of alpha
alpha <- 0.1
# Alpha-convex hull
ahull.obj <- ahull(x, alpha = alpha)
# The arcs defining the boundary of the alpha-convex hull are ordered
plot(x)
for (i in 1:dim(ahull.obj\$arcs)){
arc(ahull.obj\$arcs[i,1:2],ahull.obj\$arcs[i,3],ahull.obj\$arcs[i,4:5],
ahull.obj\$arcs[i,6],col=2)
Sys.sleep(0.5)
}

# Random sample  from a uniform distribution on a Koch snowflake
# with initial side length 1 and 3 iterations
x <- rkoch(2000, side = 1, niter = 3)
# Value of alpha
alpha <- 0.05
# Alpha-convex hull
ahull.obj <- ahull(x, alpha = alpha)
plot(ahull.obj)

## End(Not run)
```

[Package alphahull version 2.2 Index]