(m <- fm_mesh_2d(
fm_hexagon_lattice(
fmexample$boundary_sf[[1]],
edge_len = 0.1 * 5
),
max.edge = c(0.2, 1) * 5,
boundary = fmexample$boundary_sf
))
(m2 <- fm_mesh_2d(
fm_hexagon_lattice(
fmexample$boundary_sf[[1]],
edge_len = 0.1 * 5,
align = "centroid"
),
max.edge = c(0.2, 1) * 5,
boundary = fmexample$boundary_sf
))
if (require("ggplot2", quietly = TRUE) &&
require("patchwork", quietly = TRUE)) {
((ggplot() +
geom_fm(data = m) +
geom_point(aes(0, 0), col = "red")) |
(ggplot() +
geom_fm(data = m2) +
geom_point(aes(0, 0), col = "red") +
geom_sf(data = sf::st_centroid(fmexample$boundary_sf[[1]]))
)
)
}
Run the code above in your browser using DataLab