ahull | R Documentation |
This function calculates the α-convex hull of a given sample of points in the plane for α>0.
ahull(x, y = NULL, alpha)
x, y |
The |
alpha |
Value of α. |
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
.
A list with the following components:
arcs |
For each arc in the boundary of the α-convex hull, the columns of the matrix |
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 |
complement |
Output matrix from |
alpha |
Value of α. |
ashape.obj |
Object of class |
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
.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.