inla.mesh.create {INLA} | R Documentation

## Low level function for high-quality triangulations

### Description

since `⁠23.08.18⁠` in favour of `fmesher::fm_rcdt_2d_inla()`.

Create a constrained refined Delaunay triangulation (CRDT) for a set of spatial locations.

`inla.mesh.create` generates triangular meshes on subsets of `R^2` and `S^2`. Use the higher level wrapper function `inla.mesh.2d()` for greater control over mesh resolution and coarser domain extensions.

`inla.delaunay` is a wrapper function for obtaining the convex hull of a point set and calling `inla.mesh.create` to generate the classical Delaunay tringulation.

### Usage

    inla.mesh.create(
      loc = NULL,
      tv = NULL,
      boundary = NULL,
      interior = NULL,
      extend = (missing(tv) || is.null(tv)),
      refine = FALSE,
      lattice = NULL,
      globe = NULL,
      cutoff = 1e-12,
      plot.delay = NULL,
      data.dir = NULL,
      keep = (!missing(data.dir) && !is.null(data.dir)),
      timings = FALSE,
      quality.spec = NULL,
      crs = NULL
    )

    inla.delaunay(loc, ...)

### Arguments

`loc` | Matrix of point locations. Can alternatively be a `SpatialPoints` or `SpatialPointsDataFrame` object.
`tv` | A triangle-vertex index matrix, specifying an existing triangulation.
`boundary` | A list of `inla.mesh.segment` objects, generated by `inla.mesh.segment()`, specifying boundary constraint segments.
`interior` | A list of `inla.mesh.segment` objects, generated by `inla.mesh.segment()`, specifying interior constraint segments.
`extend` | `logical` or `list` specifying whether to extend the data region, with parameters list("n") the number of edges in the extended boundary (default=8) list("offset") the extension distance. If negative, interpreted as a factor relative to the approximate data diameter (default=-0.10) Setting to `FALSE` is only useful in combination `lattice` or `boundary`.
`refine` | `logical` or `list` specifying whether to refine the triangulation, with parameters list("min.angle") the minimum allowed interior angle in any triangle. The algorithm is guaranteed to converge for `min.angle` at most 21 (default=`21`) list("max.edge") the maximum allowed edge length in any triangle. If negative, interpreted as a relative factor in an ad hoc formula depending on the data density (default=`Inf`) list("max.n.strict") the maximum number of vertices allowed, overriding `min.angle` and `max.edge` (default=-1, meaning no limit) list("max.n") the maximum number of vertices allowed, overriding `max.edge` only (default=-1, meaning no limit)
`lattice` | An `inla.mesh.lattice` object, generated by `inla.mesh.lattice()`, specifying points on a regular lattice.
`globe` | Subdivision resolution for a semi-regular spherical triangulation with equidistant points along equidistant latitude bands.
`cutoff` | The minimum allowed distance between points. Point at most as far apart as this are replaced by a single vertex prior to the mesh refinement step.
`plot.delay` | On Linux (and Mac if appropriate X11 libraries are installed), specifying a numeric value activates a rudimentary plotting system in the underlying `fmesher` program, showing the triangulation algorithm at work.
`data.dir` | Where to store the `fmesher` data files. Defaults to `tempdir()` if `keep` is `FALSE`, otherwise `"inla.mesh.data"`.
`keep` | `TRUE` if the data files should be kept in `data.dir` or deleted afterwards. Defaults to true if `data.dir` is specified, otherwise false. Warning: If `keep` is false, `data.dir` and its contents will be deleted (unless set to `tempdir()`).
`timings` | If `TRUE`, obtain timings for the mesh construction.
`quality.spec` | List of vectors of per vertex `max.edge` target specification for each location in `loc`, `boundary/interior` (`segm`), and `lattice`. Only used if refining the mesh.
`crs` | An optional `CRS` or `inla.CRS` object
`...` | Optional parameters passed on to `inla.mesh.create`.

### Value

An `inla.mesh` object.

### Functions

- `inla.delaunay()`: since `⁠23.08.18⁠`. Use `fmesher::fm_delaunay_2d()` instead.

### Author(s)

Finn Lindgren finn.lindgren@gmail.com

### See Also

`inla.mesh.2d()`, `inla.mesh.1d()`, `inla.mesh.segment()`, `inla.mesh.lattice()`, `inla.mesh.query()`

### Examples

    loc <- matrix(runif(10 * 2), 10, 2)

    mesh <- inla.delaunay(loc)
    plot(mesh)

    mesh <- inla.mesh.create(loc,
      interior = inla.mesh.segment(idx = 1:2),
      extend = TRUE,
      refine = list(max.edge = 0.1)
    )
    plot(mesh)

    loc2 <- matrix(c(0, 1, 1, 0, 0, 0, 1, 1), 4, 2)
    mesh2 <- inla.mesh.create(
      loc = loc,
      boundary = inla.mesh.segment(loc2),
      interior = inla.mesh.segment(idx = 1:2),
      quality.spec = list(segm = 0.2, loc = 0.05),
      refine = list(min.angle = 26)
    )
    plot(mesh2)

[Package INLA version 26.02.05 Index]