ashape {alphahull} | R Documentation |

## alpha-shape calculation

### Description

This function calculates the `\alpha`

-shape of a given sample for `\alpha>0`

.

### Usage

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

### Arguments

`x` , `y` |
The |

`alpha` |
Value of |

### Details

An attempt is made to interpret the arguments x and y in a way suitable for computing the `\alpha`

-shape, see `xy.coords`

.

The `\alpha`

-shape 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 `\alpha`

-shape is computed without invoking again the function `delvor`

(it reduces the computational cost).

The function `ashape`

returns (among other values) the matrix `edges`

. The structure of `edges`

is that of matrix `mesh`

returned by the function `delvor`

. Note that the `\alpha`

-shape is a subgraph of the Delaunay triangulation and, therefore, `edges`

is a submatrix of `mesh`

.

### Value

A list with the following components:

`edges` |
A |

`length` |
Length of the |

`alpha` |
Value of |

`alpha.extremes` |
Vector with the indexes of the sample points that are |

`delvor.obj` |
Object of class |

`x` |
A 2-column matrix with the coordinates of the set of points. |

### 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.

### See Also

### Examples

```
## Not run:
# 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-shape
ashape.obj <- ashape(x, alpha = alpha)
# If we change the value of alpha there is no need to compute
# again the Delaunay triangulation and Voronoi Diagram
alpha <- 0.4
ashape.obj.new <- ashape(ashape.obj$delvor.obj, alpha = alpha)
# 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-shape
ashape.obj <- ashape(x, alpha = alpha)
## End(Not run)
```

*alphahull*version 2.5 Index]