Make a spatial segment object
Usage
fm_segm(...)
# Default S3 method
fm_segm(loc = NULL, idx = NULL, grp = NULL, is.bnd = TRUE, crs = NULL, ...)
# S3 method for class 'fm_segm'
fm_segm(..., grp = NULL, grp.default = 0L, is.bnd = NULL)
# S3 method for class 'fm_segm_list'
fm_segm(x, grp = NULL, grp.default = 0L, ...)
fm_segm_join(x, grp = NULL, grp.default = 0L, is.bnd = NULL)
fm_segm_split(x, grp = NULL, grp.default = 0L)
# S3 method for class 'inla.mesh.segment'
fm_segm(..., grp.default = 0)
# S3 method for class 'fm_mesh_2d'
fm_segm(x, boundary = TRUE, grp = NULL, ...)
fm_is_bnd(x)
fm_is_bnd(x) <- value
Arguments
- ...
Passed on to submethods
- loc
Matrix of point locations, or
SpatialPoints
, orsf
/sfc
point object.- idx
Segment index sequence vector or index pair matrix. The indices refer to the rows of
loc
. Ifloc==NULL
, the indices will be interpreted as indices into the point specification supplied tofm_rcdt_2d()
. Ifis.bnd==TRUE
, defaults to linking all the points inloc
, asc(1:nrow(loc),1L)
, otherwise1:nrow(loc)
.- grp
When joining segments, use these group labels for segments instead of the original group labels.
- is.bnd
TRUE
if the segments are boundary segments, otherwiseFALSE
.- crs
An optional
fm_crs()
,sf::st_crs()
orsp::CRS()
object- grp.default
If
grp.default
isNULL
, use these group labels for segments with NULL group.- x
Mesh to extract segments from
- boundary
logical; if
TRUE
, extract the boundary segments, otherwise interior constrain segments.- value
logical
Methods (by class)
fm_segm(fm_segm)
: Join multiplefm_segm
objects into a singlefm_segm
object. Ifis.bnd
is non-NULL, it overrides the input segment information. Otherwise, it checks if the inputs are consistent.fm_segm(fm_segm_list)
: Joinfm_segm
objects from afm_segm_list
into a singlefm_segm
object. Equivalent tofm_segm_join(x)
fm_segm(fm_mesh_2d)
: Extract the boundary or interior segments of a 2d mesh. Ifgrp
is non-NULL, extracts only segments matching the matching the set of groups given bygrp
.
Functions
fm_segm()
: Create a newfm_segm
object.fm_segm_join()
: Join multiplefm_segm
objects into a singlefm_segm
object. Ifis.bnd
is non-NULL, it overrides the segment information. Otherwise it checks for consistency.fm_segm_split()
: Split anfm_segm
object bygrp
into anfm_segm_list
object, optionally keeping only some groups.
See also
Other object creation and conversion:
fm_as_fm()
,
fm_as_lattice_2d()
,
fm_as_mesh_1d()
,
fm_as_mesh_2d()
,
fm_as_mesh_3d()
,
fm_as_segm()
,
fm_as_sfc()
,
fm_as_tensor()
,
fm_lattice_2d()
,
fm_mesh_1d()
,
fm_mesh_2d()
,
fm_simplify()
,
fm_tensor()
Examples
fm_segm(rbind(c(0, 0), c(1, 0), c(1, 1), c(0, 1)), is.bnd = FALSE)
#> fm_segm object:
#> 3 interior edges
#> Bounding box = (0,1) x (0,1) x (0,0)
fm_segm(rbind(c(0, 0), c(1, 0), c(1, 1), c(0, 1)), is.bnd = TRUE)
#> fm_segm object:
#> 4 boundary edges
#> Bounding box = (0,1) x (0,1) x (0,0)
fm_segm_join(fmexample$boundary_fm)
#> fm_segm object:
#> 72 boundary edges (1 group: 1)
#> Bounding box = (-5.331027, 4.061656) x (-3.998161, 5.415609) x (0,0)
fm_segm(fmexample$mesh, boundary = TRUE)
#> fm_segm object:
#> 29 boundary edges (1 group: 1)
#> Bounding box = (-5.331027, 4.061656) x (-3.998161, 5.415609) x (0,0)
fm_segm(fmexample$mesh, boundary = FALSE)
#> fm_segm object:
#> 54 interior edges (1 group: 1)
#> Bounding box = (-3.344418, 2.076846) x (-1.995602, 3.404937) x (0,0)