triangulate | R Documentation |
Triangulate a planar straight line graph using the Triangle
library (http://www.cs.cmu.edu/~quake/triangle.html). The
triangulation is a constrained conforming Delaunay triangulation
in which additional vertices, called Steiner points, can be
inserted into segments to improved the quality of the
triangulation. To prevent the insertion of Steiner points on
boundary segments, specify Y=TRUE
. If the maximum triangle
area a
is specified, the area of each triangle is not
allowed to exceed this value. If the the minimum angle q
is
specified, no triangle angle is allowed to be below this value.
triangulate(
p,
a = NULL,
q = NULL,
Y = FALSE,
j = FALSE,
D = FALSE,
S = 10000,
V = 0,
Q = TRUE
)
p |
Planar straight line graph object; see
|
a |
Maximum triangle area. If specified, triangles cannot be larger than this area. |
q |
Minimum triangle angle in degrees. |
Y |
If |
j |
If |
D |
If |
S |
Specifies the maximum number of added Steiner points. If
set to |
V |
Verbosity level. Specify higher values for more detailed information about what the Triangle library is doing. |
Q |
If |
A object with class triangulation
. This contains
the information in the same format as the PSLG, p
, with
an updated list of points P
and point attributes
PA
, along with the following variables:
T |
Triangulation specified as 3 column matrix
in which each row contains indices in |
E |
Set of edges in the triangulation. |
EB |
Boundary markers of edges. For each edge this is 1 if the point is on a boundary of the triangulation and 0 otherwise. |
VP |
The points of the Voronoi tessalation as a 2-column matrix |
VE |
Set of edges of the Voronoi tessalation. An index of -1 indicates an infinite ray. |
VN |
Directions of infinite rays of Voroni tessalation as a 2-column matrix with the same number of rows as |
VA |
Matrix of attributes associated with the polygons of the Voronoi tessalation. |
David Sterratt
## Create an object with a concavity
p <- pslg(P=rbind(c(0, 0), c(0, 1), c(0.5, 0.5), c(1, 1), c(1, 0)),
S=rbind(c(1, 2), c(2, 3), c(3, 4), c(4, 5), c(5, 1)))
## Plot it
plot(p)
## Triangulate it
tp <- triangulate(p)
plot(tp)
## Triangulate it subject to minimum area constraint
tp <- triangulate(p, a=0.01)
plot(tp)
## Load a data set containing a hole
A <- read.pslg(file.path(system.file(package = "RTriangle"), "extdata", "A.poly"))
plot(A)
## Produce a constrained Delaunay triangulation of the PSLG
tA <- triangulate(A, Y=TRUE)
plot(tA)
## Produce a conforming Delaunay triangulation of the PSLG
tA <- triangulate(A, D=TRUE)
plot(tA)
## Triangulate the PSLG with triangles in which no angle
## is smaller than 20 degrees
tA <- triangulate(A, q=20)
plot(tA)
## Triangulate the PSLG with triangles in which no triangle has
## area greater than 0.001
tA <- triangulate(A, a=0.001)
plot(tA)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.