inla.simplify.curve {INLA} | R Documentation

## Recursive curve simplification.

### Description

since `⁠23.08.18⁠`. Use `fmesher::fm_simplify_helper()` instead.

Attempts to simplify a polygonal curve by joining nearly colinear segments.

Uses a variation of the binary splitting Ramer-Douglas-Peucker algorithm, with a width `eps` ellipse instead of a rectangle, motivated by prediction ellipse for Brownian bridge.

### Usage

    inla.simplify.curve(loc, idx, eps)

### Arguments

`loc` | Coordinate matrix.
`idx` | Index vector into `loc` specifying a polygonal curve.
`eps` | Straightness tolerance.

### Value

An index vector into `loc` specifying the simplified polygonal curve.

### Author(s)

Finn Lindgren finn.lindgren@gmail.com

### Examples

    theta <- seq(0, 2 * pi, length.out = 1000)
    loc <- cbind(cos(theta), sin(theta))
    idx <- inla.simplify.curve(loc = loc, idx = seq_len(nrow(loc)), eps = 0.01)
    print(c(nrow(loc), length(idx)))
    plot(loc, type = "l")
    lines(loc[idx, ], col = "red")

[Package INLA version 26.08.22 Index]