triang.list {deldir} | R Documentation |
Create a list of Delaunay triangles
Description
From an object of class “deldir” produces a list of the Delaunay triangles in the triangulation of a set of points in the plane.
Usage
triang.list(object)
Arguments
object |
An object of class “deldir” as produced by |
Value
A list each of whose components is a 3 \times 3
or
3 \times 4
data frame corresponding to one of the
Delaunay triangles specified by “object”. The rows of each
such data frame correspond to the vertices of the corresponding
Delaunay triangle. The columns are:
-
ptNum
(the index of the point in the original sequence of points that is being triangulated. Note that if a point is one of a set of duplicated points thenptNum
is the first of the indices of the points in this set.) -
x
(thex
-coordinate of the vertex) -
y
(they
-coordinate of the vertex) -
z
(the “auxiliary value” or “tag”z
associated with the vertex; present only if such values were supplied in the call todeldir()
)
The returned value has an attribute “rw” consisting of the enclosing rectangle of the triangulation.
Warning
There may not actually be any triangles determined by
object
, in which case this function returns an empty
list with an "rw"
attribute. See Examples.
Note
The code of this function was taken more-or-less directly from code written by Adrian Baddeley for the “delaunay()” function in the “spatstat” package.
Author(s)
Rolf Turner rolfurner@posteo.net
See Also
deldir()
, plot.triang.list()
,
tile.list()
, plot.tile.list()
Examples
set.seed(42)
x <- runif(20)
y <- runif(20)
z <- sample(1:100,20)
d1 <- deldir(x,y,z=z)
t1 <- triang.list(d1)
# A "triangulation" with no triangles!
d2 <- deldir(x=1:10,y=11:20)
plot(d2)
t2 <- triang.list(d2)
plot(t2,showrect=TRUE,rectcol="blue") # Pretty boring!