divchain: Dividing chain.

View source: R/divchain.R

divchainR Documentation

Dividing chain.

Description

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.

Usage

   divchain(x, ...)
   ## Default S3 method:
divchain(x, y, z, ...)
   ## S3 method for class 'deldir'
divchain(x, ...)

Arguments

x

Either an object specifying coordinates (in the case of the "default" method; see deldir() for details) or an object of class “deldir”. In the latter case this object must have been created in such a way that the points of the set being tessellated have associate categorical “tags”. That is, deldir() must have been called with a z argument or the x argument to deldir() must have had an appropriate component which could be taken to be z. Note that if the value of z that was used was not a factor, it is coerced to one.

y

A numeric vector constituting the y-coordinates of the set of points being tessellated. See deldir() for details. Not used by the "deldir" method.

z

A vector or factor specifying “auxiliary” values or “tags”. If this argument is left NULL then it is extracted, if possible, from the components of x. See deldir() for further details. If z is not a factor it is coerced to one. See deldir() for details. Not used by the "deldir" method.

...

Arguments to be passed to deldir(). Not used by the "deldir" method.

Value

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().)

Note

This function was created in response to a question asked on stackoverflow.com by a user named “Dan”.

Author(s)

\rolf

See Also

deldir() plot.divchain()

Examples

   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)

deldir documentation built on May 29, 2024, 7:58 a.m.

Related to divchain in deldir...