Skip to content

An implementation of the Douglas-Peucker algorithm, modified so that the simplified polygon contains the original.

License

Notifications You must be signed in to change notification settings

prakol16/rdp-expansion-only

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Expansion only RDP

An implementation of the Douglas-Peucker algorithm, modified so that the simplified polygon contains the original.

Usage:

rdp_closed(np.array([[0, 0], [-0.1, 1], [0, 2], [4, -1], [0, 0]]), 0.2)
--> [[-0.1  ,  0.025],
     [-0.1  ,  2.075],
     [ 4.   , -1.   ],
     [-0.1  ,  0.025]]

Notice that usually the new points will not be a subset of the old points, unlike in the original RDP algorithm. However, all the old points will lie on the boundary or interior of the new polygon, and the new polygon will generally be simpler.

Examples:

A crescent whose boundary was originally made of two circles, one centered at the origin with radius 1 and the other centered at x=0.75 with radius r=1.25, when simplified with epsilon=0.1, looks like:

crescent

With epsilon=0.05:

crescent

Notice how the polygon expands to fit the crescent.

About

An implementation of the Douglas-Peucker algorithm, modified so that the simplified polygon contains the original.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages