complement {alphahull} | R Documentation |
This function calculates the complement of the α-convex hull of a given sample for α>0.
complement(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 α-shape. Any reasonable way of defining the coordinates is acceptable, see xy.coords
.
If y
is NULL and x
is an object of class "delvor"
, then the complement of 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 is calculated as a union of open balls and halfplanes that do not contain any point of the sample. See Edelsbrunnner et al. (1983) for a basic description of the algorithm. The construction of the complement is based on the Delaunay triangulation and Voronoi diagram of the sample, provided by the function delvor
. The function complement
returns a matrix compl
. For each row i
, compl[i,]
contains the information relative to an open ball or halfplane of the complement. The first three columns are assigned to the characterization of the ball or halfplane i
. The information relative to the edge of the Delaunay triangulation that generates the ball or halfplane i
is contained in compl[i,4:16]
. Thus, if the row i
refers to an open ball, compl[i,1:3]
contains the center and radius of the ball. Furthermore, compl[i,17:18]
and compl[i,19]
refer to the unitary vector v and the angle θ that characterize the arc that joins the two sample points that define the ball i
. If the row i
refers to a halfplane, compl[i,1:3]
determines its equation. For the halfplane y>a+bx, compl[i,1:3]=(a,b,-1)
. In the same way, for the halfplane y<a+bx, compl[i,1:3]=(a,b,-2)
, for the halfplane x>a, compl[i,1:3]=(a,0,-3)
and for the halfplane x<a, compl[i,1:3]=(a,0,-4)
.
compl |
Output matrix. For each row |
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.
## Not run: # Random sample in the unit square x <- matrix(runif(100), nc = 2) # Value of alpha alpha <- 0.2 # Complement of the alpha-convex hull compl <- complement(x, alpha = alpha) ## End(Not run)