delvor {alphahull} | R Documentation |
This function returns a matrix with information about the Delaunay triangulation and Voronoi diagram of a given sample.
delvor(x, y = NULL)
x, y |
The |
An attempt is made to interpret the arguments x and y in a way suitable for computing the Delaunay triangulation and Voronoi diagram . Any reasonable way of defining the coordinates is acceptable, see xy.coords
.
The function tri.mesh
from package tripack calculates the Delaunay triangulation of at least three non-collinear points using Fortran functions from the library TRIPACK. Using the Delaunay triangulation, the function delvor
calculates the correspondig Voronoi diagram. For each edge of the Delaunay triangulation there is a segment in the Voronoi diagram, given by the union of the circumcenters of the two neighbour triangles that share the edge. For those triangles with edges on the convex hull, the corresponding line in the Voronoi diagram is a semi-infinite segment, whose boundless extreme is calculated by the function dummycoor
. The function delvor
returns the sample, the output object of class "tri"
from the function tri.mesh
and a matrix mesh
with all the necessary information of the Delaunay triangulation and Voronoi diagram. Thus, for each edge of the Delaunay triangulation the output matrix contains the indexes and coordinates of the sample points that form the edge, the indexes and coordinates of the extremes of the corresponding segment in the Voronoi diagram, and an indicator that takes the value 1 for those extremes of the Voronoi diagram that represent a boundless extreme.
A list with the following components:
mesh |
A n.edges-row matrix, where n.edges is the total number of different edges of the Delaunay triangulation. |
x |
A 2-column matrix with the coordinates of the sample points. |
tri.obj |
Object of class |
Renka, R. J. (1996). Algorithm 751: TRIPACK: a constrained two-dimensional Delaunay triangulation package, ACM Trans. Math. Softw., 22(1), pp.1-8.
## Not run: # Simple example from TRIPACK data(tritest) # Delaunay triangulation and Voronoi diagram calculation delvor.obj <- delvor(tritest) # Random sample in the unit square x <- matrix(runif(20), nc = 2) # Delaunay triangulation and Voronoi diagram calculation delvor.obj <- delvor(x) ## End(Not run)