fm_simplify | R Documentation |
Simplifies polygonal curve segments by joining nearly co-linear segments.
Uses a variation of the binary splitting Ramer-Douglas-Peucker algorithm,
with an ellipse of half-width eps
ellipse instead of a rectangle, motivated by
prediction ellipse for Brownian bridge.
fm_simplify(x, eps = NULL, eps_rel = NULL, ...)
x |
An |
eps |
Absolute straightness tolerance. Default |
eps_rel |
Relative straightness tolerance. Default |
... |
Currently unused. |
Variation of Ramer-Douglas-Peucker. Uses width epsilon ellipse instead of rectangle, motivated by prediction ellipse for Brownian bridge.
The simplified fm_segm()
object.
Finn Lindgren finn.lindgren@gmail.com
Ramer, Urs (1972). "An iterative procedure for the polygonal approximation of plane curves". Computer Graphics and Image Processing. 1 (3): 244–256. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/S0146-664X(72)80017-0")}
Douglas, David; Peucker, Thomas (1973). "Algorithms for the reduction of the number of points required to represent a digitized line or its caricature". The Canadian Cartographer. 10 (2): 112–122. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3138/FM57-6770-U75U-7727")}
Other object creation and conversion:
fm_as_fm()
,
fm_as_lattice_2d()
,
fm_as_mesh_1d()
,
fm_as_mesh_2d()
,
fm_as_segm()
,
fm_as_sfc()
,
fm_as_tensor()
,
fm_lattice_2d()
,
fm_mesh_1d()
,
fm_mesh_2d()
,
fm_segm()
,
fm_tensor()
theta <- seq(0, 2 * pi, length.out = 1000)
(segm <- fm_segm(cbind(cos(theta), sin(theta)),
idx = seq_along(theta)
))
(segm1 <- fm_simplify(segm, eps_rel = 0.1))
(segm2 <- fm_simplify(segm, eps_rel = 0.2))
plot(segm)
lines(segm1, col = 2)
lines(segm2, col = 3)
(segm <- fm_segm(cbind(theta, sin(theta * 4)),
idx = seq_along(theta)
))
(segm1 <- fm_simplify(segm, eps_rel = 0.1))
(segm2 <- fm_simplify(segm, eps_rel = 0.2))
plot(segm)
lines(segm1, col = 2)
lines(segm2, col = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.