
Smoothening complex polygons - Ramer–Douglas–Peucker algorithm - ideamonk
http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
======
uxguy
Another interesting discussion on it -
[http://stackoverflow.com/questions/1849928/how-to-
intelligen...](http://stackoverflow.com/questions/1849928/how-to-
intelligently-degrade-or-smooth-gis-data-simplifying-polygons)

~~~
blutonium
Not sure that's better than the Wiki article, but the PostGIS mention is
really handy if you're generalizing data for maps or to make paths from GPS
data.

Protip: If you set the epsilon low enough, the PostGIS implementation has a
good chance of repairing invalid geometries, even when ArcInfo can't.

------
nitrogen
I'm sure they exist, so can anyone point to extensions of the concept to
piecewise-Bézier curves (as opposed to piecewise linear).

~~~
cullenking
This isn't directly Bezier related, but you may find some inspiration here.
Talks about piecewise linear, bilinear, double linear, biquadratic, cubic,
bicubic, piecewise cubic and biquintic.

This is a great link and helped me conceptualize and workout bicubic
interpolation. Have fun :)

~~~
avibryant
Wait, where's the link?

~~~
cullenking
Doh! Don't know how that didn't paste in:
<http://www.geocomputation.org/1999/082/gc_082.htm>

------
cullenking
Was happy to see this come across HN. I had bookmarked several notes and a PHP
implementation of this. I am planning on using this to simplify the number of
points defining a particular path on a google map, for a small preview map.
Some of my data is > 1 meg for a long route, so trimming is important.

Check out a live PHP demo:
<http://www.fonant.com/demos/douglas_peucker/algorithm>

------
kungfooey
This would be interesting/useful for smoothing geospatial polygons (eg, KML).

~~~
yannickt
At a previous job I implemented a tool to smooth map areas and at the same
time preserve the topology between the areas (e.g. there would be no gaps
between Texas and Louisiana after the smoothing). I had a lot of fun writing
it.

~~~
albertsun
That sounds very useful. How did you do it? Could you share it?

Did you create an algorithm that would smooth polygons the same way going
clockwise or counter-clockwise so that the shared boundaries would be
simplified the same way? Or did your algorithm take into account the entire
topology?

~~~
yannickt
It was indeed very useful :). Unfortunately I cannot share too much due to NDA
(not that I consider what I did cutting edge...). But I will say that I
couldn't take the entire topology into account due to limitations with the
host SDK (I was working on a plug-in for a _leading_ vector graphics
application).

