TriMesh | R Documentation |
This function triangulates the polygonal domain by using Delaunay Triangulation.
TriMesh(bdy, n, pt = NULL, holes = NULL)
bdy |
A two by |
n |
An integer parameter controlling the fineness of the triangulation
and subsequent triangulation. As n increases the fineness increases. Usually, |
holes |
A list of vertices that are the inner boundary points,
default set to ' |
In the function, we firstly get grid points inside and on the boundary of
the polygon with extreme points bdy
and interior holes defined by holes
. Then delaunay triangulation
is used to generate triangulations by using the grid points.
And lastly we delete triangles within the holes or outside the boundary of the region.
V |
an |
Tr |
a |
# rectangular domain
bb = rbind(c(0, 0), c(1, 0), c(1, 1), c(0, 1))
VT = TriMesh(bb, 3)
typeof(VT$V)
typeof(VT$Tr)
# irregular domain
data("horseshoe")
TriMesh(hs, n = 9)
pt = rbind(c(-0.475, -0.5), c(0.020, -0.5), c(0.435, -0.5), c(0.890, -0.5),
c(1.345, -0.5), c(1.800, -0.5), c(2.255, -0.5), c(2.710, -0.5), c(3.165, -0.5),
c(-0.475, 0.5), c(0.020, 0.5), c(0.435, 0.5), c(0.890, 0.5), c(1.345, 0.5),
c(1.800, 0.5), c(2.255, 0.5), c(2.710, 0.5), c(3.165, 0.5))
VT = TriMesh(hs, n = 4, pt = pt)
lines(hs, lwd = 1)
points(pt, pch = 20, col = 4)
data("shape")
TriMesh(shape, 15)
data("weird")
TriMesh(weird, 30)
# region with holes
data("BMP")
TriMesh(BMP$bound, 25, holes = list(as.matrix(BMP$H1), as.matrix(BMP$H2)))
data("mymontreal")
TriMesh(mymontreal$bound, 25, holes = list(mymontreal$H1, mymontreal$H2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.