Coder Social home page Coder Social logo

bobld / ramerdouglaspeuckernetv2 Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 4.0 124 KB

An algorithm that decimates a curve composed of line segments to a similar curve with fewer points.

License: MIT License

C# 100.00%
ramer-douglas-peucker douglas-peucker polyline-simplification iterative-end-point-fit downsampling non-parametric rdp-algorithm rdp chart plot

ramerdouglaspeuckernetv2's Introduction

Ramer-Douglas-Peucker algorithm

Description

An algorithm that decimates a curve composed of line segments to a similar curve with fewer points. The purpose of the algorithm is, given a curve composed of line segments (which is also called a Polyline in some contexts), to find a similar curve with fewer points. The algorithm defines 'dissimilar' based on the maximum distance between the original curve and the simplified curve (i.e., the Hausdorff distance between the curves). The simplified curve consists of a subset of the points that defined the original curve.source wiki

The pseudo-code is available on the wikipedia page. In this implementation, we use the perpendicular distance.

In order to make the algorithm faster, we consider the squared distance (and epsilon) so that we avoid using the absolute value and square root functions in the distance computation. We also split the computation of the distance so that we put in the 'for loop' only what is needed (the denominator is only computed once).

Perpendicular distance formula:

perpendicular distance from wiki

Non-parametric version

See A novel framework for making dominant point detection methods non-parametric by Prasad, Leung, Quek, and Cho.

From the paper:

3.1.2. Non-parametric adaptation of RDP

In the above method, at each step in the recursion, if the length of the line segment that is fit most recently on the curve (or sub-curve) is s and the slope of the line segment is m, then using Eq.(4), we compute dmax and use it in Eq.(7) as dtol=dmax. The pseudocodes of the original and the modified methods are given in Fig. 3 and the changes are highlighted for the ease of comparison. As a consequence of theproposed modification, the original method does not require any control parameter and adaptively computes the suitable value of dtol automatically.

Results

Original

original

Reduced to 15,157 points (e=0.5)

15157points

Reduced to 11,342 points (non-parametric)

11342points

Reduced to 1,385 points (e=10)

1385points

ramerdouglaspeuckernetv2's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.