# Coercion methods to and from meshes

Source:`R/fmesher_crs.R`

, `R/fmesher_sf_mesh.R`

, `R/fmesher_sp_mesh.R`

`fm_as.Rd`

Coercion methods to and from meshes

## Usage

```
fm_as_sp_crs(x, ...)
fm_as_sfc(x, ...)
fm_as_inla_mesh_segment(...)
fm_as_inla_mesh(...)
# S3 method for inla.mesh
fm_as_sfc(x, ..., multi = FALSE)
# S3 method for sfc_MULTIPOLYGON
fm_as_inla_mesh(x, ...)
# S3 method for sfc_POLYGON
fm_as_inla_mesh(x, ...)
# S3 method for sfc_POINT
fm_as_inla_mesh_segment(x, reverse = FALSE, grp = NULL, is.bnd = TRUE, ...)
# S3 method for sfc_LINESTRING
fm_as_inla_mesh_segment(x, join = TRUE, grp = NULL, reverse = FALSE, ...)
# S3 method for sfc_POLYGON
fm_as_inla_mesh_segment(x, join = TRUE, grp = NULL, ...)
# S3 method for sfc_MULTIPOLYGON
fm_as_inla_mesh_segment(x, join = TRUE, grp = NULL, ...)
# S3 method for sfc_GEOMETRY
fm_as_inla_mesh_segment(x, grp = NULL, join = TRUE, ...)
# S3 method for sf
fm_as_inla_mesh_segment(x, ...)
# S3 method for sf
fm_as_inla_mesh(x, ...)
fm_sp2segment(sp, ...)
# S3 method for matrix
fm_as_inla_mesh_segment(
sp,
reverse = FALSE,
grp = NULL,
is.bnd = FALSE,
crs = NULL,
closed = FALSE,
...
)
# S3 method for SpatialPoints
fm_as_inla_mesh_segment(
sp,
reverse = FALSE,
grp = NULL,
is.bnd = TRUE,
closed = FALSE,
...
)
# S3 method for SpatialPointsDataFrame
fm_as_inla_mesh_segment(sp, ...)
# S3 method for Line
fm_as_inla_mesh_segment(sp, reverse = FALSE, grp = NULL, crs = NULL, ...)
# S3 method for Lines
fm_as_inla_mesh_segment(sp, join = TRUE, grp = NULL, crs = NULL, ...)
# S3 method for SpatialLines
fm_as_inla_mesh_segment(sp, join = TRUE, grp = NULL, ...)
# S3 method for SpatialLinesDataFrame
fm_as_inla_mesh_segment(sp, ...)
# S3 method for SpatialPolygons
fm_as_inla_mesh_segment(sp, join = TRUE, grp = NULL, ...)
# S3 method for SpatialPolygonsDataFrame
fm_as_inla_mesh_segment(sp, ...)
# S3 method for Polygons
fm_as_inla_mesh_segment(sp, join = TRUE, crs = NULL, grp = NULL, ...)
# S3 method for Polygon
fm_as_inla_mesh_segment(sp, crs = NULL, ...)
```

## Arguments

- x
An object to be coerced/transformed/converted into another class

- ...
Arguments passed on to other methods

- multi
logical; if

`TRUE`

, attempt to a`sfc_MULTIPOLYGON`

, otherwise a set of`sfc_POLYGON`

. Default`FALSE`

- reverse
logical; When TRUE, reverse the order of the input points. Default

`FALSE`

- grp
if non-null, should be an integer vector of grouping labels for one for each segment. Default

`NULL`

- is.bnd
logical; if

`TRUE`

, set the boundary flag for the segments. Default`TRUE`

- join
logical; if

`TRUE`

, join input segments with common vertices. Default`TRUE`

- sp
An

`sp`

style S4 object to be converted- crs
A crs object

- closed
logical; whether to treat a point sequence as a closed polygon. Default:

`FALSE`