Ramer-Douglas-Peucker line simplification: Difference between revisions
Ramer-Douglas-Peucker line simplification (view source)
Revision as of 14:06, 9 July 2020
, 3 years agoC - fixed spelling errors
(Added Rust solution) |
m (C - fixed spelling errors) |
||
Line 39:
// Simplify an array of points using the Ramer–Douglas–Peucker algorithm.
// Returns the number of output points.
size_t
point_t* dest, size_t destlen) {
assert(n >= 2);
Line 53:
}
if (max_dist > epsilon) {
size_t n1 =
if (destlen >= n1 - 1) {
destlen -= n1 - 1;
Line 60:
destlen = 0;
}
size_t n2 =
return n1 + n2 - 1;
}
Line 86:
const size_t len = sizeof(points)/sizeof(points[0]);
point_t out[len];
size_t n =
print_points(out, n);
return 0;
|