divchain | R Documentation |
Create the “dividing chain” of a Dirichlet tessellation. The tessellation must have been created from a set of points having associated “tags”. The dividing chain consists of those edges of Dirichlet tiles which separate points having different values of the given tags.
divchain(x, ...)
## Default S3 method:
divchain(x, y, z, ...)
## S3 method for class 'deldir'
divchain(x, ...)
x |
Either an object specifying coordinates (in the case of the
|
y |
A numeric vector constituting the |
z |
A vector or factor specifying “auxiliary” values or
“tags”. If this argument is left |
... |
Arguments to be passed to |
An object of class “divchain” consisting of a data frame with columns named “x0”, “y0”, “x1”, “y1”, “v01”, “v02”, “v03”, “v11”, “v12” and “v13”.
The columns named “x0” and “y0” consist of the coordinates of one endpoint of an edge of a Dirichlet tile and the columns named “x1” and “y1” consist of the coordinates of the other endpoint.
The columns named “vij”, i = 0, 1, j = 1, 2, 3, consist
of the indices of the vertices of the Delaunay triangles
whose circumcentres constitute the respective endpoints of the
corresponding edge of a Dirichlet tile. The entries of column
“vi3” may (also) take the values $-1, -2, -3$, and $-4$.
This will be the case if the circumcentre in question lay outside
of the rectangular window rw
(see deldir()
)
enclosing the points being tessellated. In these circumstances the
corresponding endpoint of the tile edge is the intersection of the
line joining the two circumcentres with the boundary of rw
,
and the numeric value of the entry of column “vi3” indicates
which side. The numbering follows the convention for numbering
the sides of a plot region in R
: 1 for the bottom side,
2 for the left side, 3 for the top side and 4 for the right side.
Note that the triple of vertices uniquely identify the endpoint of the tile edge.
The object has an attribute rw
which is equal to
the specification of the rectangular window within which
the triangulation/tessellation in question was constructed.
(See deldir()
.)
This function was created in response to a question asked
on stackoverflow.com
by a user named “Dan”.
deldir()
plot.divchain()
set.seed(42)
x <- runif(50)
y <- runif(50)
z <- factor(kmeans(cbind(x,y),centers=4)$cluster)
dc1 <- divchain(x,y,z,rw=c(0,1,0,1))
dxy <- deldir(x,y,z=z,rw=c(0,1,0,1))
dc2 <- divchain(dxy)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.