fm_bary | R Documentation |
Identify knot intervals or triangles and compute barycentric coordinates
fm_bary(mesh, loc, ...)
## S3 method for class 'fm_mesh_1d'
fm_bary(mesh, loc, method = c("linear", "nearest"), restricted = FALSE, ...)
## S3 method for class 'fm_mesh_2d'
fm_bary(mesh, loc, crs = NULL, ...)
## S3 method for class 'inla.mesh'
fm_bary(mesh, ...)
## S3 method for class 'inla.mesh.1d'
fm_bary(mesh, ...)
mesh |
|
loc |
Points for which to identify the containing interval/triangle, and
corresponding barycentric coordinates. May be a vector (for 1d) or a matrix
of raw coordinates, |
... |
Arguments forwarded to sub-methods. |
method |
character; method for defining the barycentric coordinates, "linear" (default) or "nearest" |
restricted |
logical, used for |
crs |
Optional crs information for |
A list with elements t
; either
vector of triangle indices (triangle meshes),
matrix of interval knot indices (1D meshes), or
matrix of lower left box indices (2D lattices),
and bary
, a matrix of barycentric coordinates.
fm_bary(fm_mesh_1d)
: Return a list with elements
t
(start and endpoint knot indices) and bary
(barycentric coordinates), both
2-column matrices.
For method = "nearest"
, t[,1]
contains the index of the nearest mesh knot,
and each row of bary
contains c(1, 0)
.
fm_bary(fm_mesh_2d)
: A list with elements t
(vector of triangle indices) and bary
(3-column matrix of barycentric coordinates). Points that were not found
give NA
entries in t
and bary
.
str(fm_bary(fmexample$mesh, fmexample$loc_sf))
str(fm_bary(fm_mesh_1d(1:4), seq(0, 5, by = 0.5)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.