ahull {alphahull} | R Documentation |
alpha-convex hull calculation
Description
This function calculates the \alpha
-convex hull of a given sample of points in the plane for \alpha>0
.
Usage
ahull(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
-convex hull. Any reasonable way of defining the coordinates is acceptable, see xy.coords
.
The \alpha
-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 \alpha
-convex hull is computed with no need to invoke again the function delvor
(it reduces the computational cost).
The complement of the \alpha
-convex hull can be written as the union of O(n)
open balls and halfplanes, see complement
.
The boundary of the \alpha
-convex hull is formed by arcs of open balls of radius \alpha
(besides possible isolated sample points). The arcs are determined by the intersections of some of the balls that define the complement of the \alpha
-convex hull. The extremes of an arc are given by c+rA_\theta v
and c+rA_{-\theta}v
where c
and r
represent the center and radius of the arc, repectively, and A_\theta v
represents the clockwise rotation of angle \theta
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 |
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 |
length |
Length of the boundary of the |
complement |
Output matrix from |
alpha |
Value of |
ashape.obj |
Object of class |
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.
See Also
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)[1]){
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)