Title: | The Ramer-Douglas-Peucker Algorithm |
---|---|
Description: | Pretty fast implementation of the Ramer-Douglas-Peucker algorithm for reducing the number of points on a 2D curve. Urs Ramer (1972), "An iterative procedure for the polygonal approximation of plane curves" <doi:10.1016/S0146-664X(72)80017-0>. David H. Douglas and Thomas K. Peucker (1973), "Algorithms for the Reduction of the Number of Points Required to Represent a Digitized Line or its Caricature" <doi:10.3138/FM57-6770-U75U-7727>. |
Authors: | Robert Dahl Jacobsen [aut, cre] |
Maintainer: | Robert Dahl Jacobsen <[email protected]> |
License: | GPL-3 |
Version: | 0.3.0 |
Built: | 2024-10-08 05:02:25 UTC |
Source: | https://github.com/robertdj/rdp |
RDP
packageImplementation of the Ramer-Douglas-Peucker algorithm.
Maintainer: Robert Dahl Jacobsen [email protected]
Urs Ramer (1972), "An iterative procedure for the polygonal approximation of plane curves". Computer Graphics and Image Processing 1, 244–256. doi:10.1016/S0146-664X(72)80017-0.
David H. Douglas and Thomas K. Peucker (1973), "Algorithms for the Reduction of the Number of Points Required to Represent a Digitized Line or its Caricature". Cartographica 10, 112–122. doi:10.3138/FM57-6770-U75U-7727.
Useful links:
Implements the Ramer-Douglas-Peucker algorithm for reducing the number of points on a curve.
RamerDouglasPeucker(x, y, epsilon, keep_index = FALSE)
RamerDouglasPeucker(x, y, epsilon, keep_index = FALSE)
x |
|
y |
|
epsilon |
|
keep_index |
|
If there are no more than two points it does not make sense to simplify.
In this case the input is returned without further checks of x
and y
.
In particular, the input is not checked for NA
values.
A data.frame
with x
and y
values of the simplified curve.
RDP::RamerDouglasPeucker(x = c(0, 1, 3, 5), y = c(2, 1, 0, 1), epsilon = 0.5) RDP::RamerDouglasPeucker(x = c(0, 1, 3, 5), y = c(2, 1, 0, 1), epsilon = 0.5, keep_index = TRUE)
RDP::RamerDouglasPeucker(x = c(0, 1, 3, 5), y = c(2, 1, 0, 1), epsilon = 0.5) RDP::RamerDouglasPeucker(x = c(0, 1, 3, 5), y = c(2, 1, 0, 1), epsilon = 0.5, keep_index = TRUE)