Description Usage Arguments Value Author(s) References Examples
This function takes a path and removes points that impact the shape of the path less than a tolerance value, which is a scaled measure of degree deviation from removing a path. It is based on an algorithm described by Latecki & Lakaemper.
1 2 3 4 5 | SimplifyPath(path,
tolerance = 0.075,
truncate=F,
faster = T,
verbose = F, plot = F)
|
path |
a 2-column matrix of x,y points |
truncate |
Number of digits to round values to. If FALSE (the
default), there is no rounding. If another value, the value is used
as the |
tolerance |
a tolerance threshold; any point that does not impact the shape of the path more than this is removed. For this, smaller values remove fewer points. Depending on the complexity of the path, values from 0.01 to 0.1 may be good starting points. |
faster |
If |
verbose |
if |
plot |
if |
Returns a path with redundant points removed.
Shane T. Mueller and Brandon Perelman
See Mueller et al., (2016).
and
L. J. Latecki and R. Lakaemper. Convexity Rule for Shape
Decomposition Based on Discrete Contour Evolution. Computer Vision
and Image Understanding, vol. 73, pp. 441-454, 1999.
https://sites.google.com/a/mtu.edu/mapping/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | path <- cbind(1:100,exp(-(1:100-50)^2/80))
path2 <- SimplifyPath(path)
## Not run:
plot(path)
plot(path2)
plot(path)
points(SimplifyPath(path,tolerance=.1),type="o",
col="red",cex=1.2,lwd=2)
plot(path)
points(SimplifyPath(path,tolerance=.01,plot=TRUE),type="o",
col="red",cex=1.2,lwd=2)
plot(path)
points(SimplifyPath(path,tolerance=.005,plot=TRUE),type="o",
col="red",cex=1.2,lwd=2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.