inla.simplify.curve {INLA} | R Documentation |
Attempts to simplify a polygonal curve by joining nearly colinear segments.
inla.simplify.curve(loc, idx, eps)
loc |
Coordinate matrix. |
idx |
Index vector into |
eps |
Straightness tolerance. |
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.
An index vector into loc
specifying the simplified polygonal
curve.
Finn Lindgren finn.lindgren@gmail.com
theta <- seq(0, 2 * pi, length = 1000) loc <- cbind(cos(theta), sin(theta)) idx <- inla.simplify.curve(loc = loc, idx = 1:nrow(loc), eps = 0.01) print(c(nrow(loc), length(idx))) plot(loc, type = "l") lines(loc[idx, ], col = "red")