This function returns a matrix with information about the Delaunay triangulation and Voronoi diagram of a given sample.
delvor(x, y = NULL)
The x
and y
arguments provide the x
and y
coordinates of a set of points. Alternatively, a single argument x
can be provided, see Details.
A list with the following components:
A \(n.edges\)-row matrix, where \(n.edges\) is the total number of different edges of the Delaunay triangulation.
A 2-column matrix with the coordinates of the sample points.
Object of class "tri"
. See tri.mesh
in package interp.
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 interp calculates the Delaunay triangulation of at least three non-collinear points. 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 "triSht"
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.
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 {
# Random sample in the unit square
x <- matrix(runif(20), nc = 2)
# Delaunay triangulation and Voronoi diagram calculation
delvor.obj <- delvor(x)
# }
Run the code above in your browser using DataLab