fm_centroids {fmesher}R Documentation

Extract triangle centroids from an fm_mesh_2d

Description

Computes the centroids of the triangles of an fm_mesh_2d() object.

Usage

fm_centroids(x, format = NULL)

Arguments

x

An fm_mesh_2d or inla.mesh object.

format

character; "sf", "df", "sp"

Value

An sf, data.frame, or SpatialPointsDataFrame object, with the vertex coordinates, and a .triangle column with the triangle indices.

Author(s)

Finn Lindgren finn.lindgren@gmail.com

See Also

fm_vertices()

Examples

if (require("ggplot2", quietly = TRUE)) {
  vrt <- fm_centroids(fmexample$mesh, format = "sf")
  ggplot() +
    geom_sf(data = fm_as_sfc(fmexample$mesh)) +
    geom_sf(data = vrt, color = "red")
}


[Package fmesher version 0.1.7 Index]