submesh.mesh | R Documentation |
Extracts a part of a mesh
submesh.mesh(z, mesh)
z |
A matrix with values indicating which nodes that should be present in the submesh. |
mesh |
An |
An fm_mesh_2d
object.
Finn Lindgren finn.lindgren@gmail.com
## Not run:
if (require(fmesher)) {
nxy <- 30
x <- seq(from = 0, to = 4, length.out = nxy)
lattice <- fm_lattice_2d(x = x, y = x)
mesh <- fm_mesh_2d_inla(lattice = lattice, extend = FALSE, refine = FALSE)
# extract a part of the mesh inside a circle
xy.in <- rowSums((mesh$loc[, 1:2] - 2)^2) < 1
submesh <- excursions:::submesh.mesh(matrix(xy.in, nxy, nxy), mesh)
plot(mesh$loc[, 1:2])
lines(2 + cos(seq(0, 2 * pi, length.out = 100)), 2 + sin(seq(0, 2 * pi, length.out = 100)))
plot(submesh, add = TRUE)
points(mesh$loc[xy.in, 1:2], col = "2")
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.