Skip to content

A java implementation of Ramer–Douglas–Peucker algorithm for reducing number of points in data series.

License

Notifications You must be signed in to change notification settings

andyczerwonka/series-reducer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

series-reducer

A java implementation of Ramer–Douglas–Peucker algorithm for reducing number of points in data series.

How it works?###

The algorithm removes points from the series while maintaining the shape of the curve. See an example below:

example 1

How to use it?###

All you need to do is to invoke SeriesReducer.reduce(points, epsilon) where points is an ordered list of points and epsilon defines a margin within which points can be removed.

Data presented on the example charts were produced by the following code snippet:

List<Point> points = new ArrayList<Point>();
for (double x = 0; x < 4; x += 0.05) {
    points.add(new MyPoint(x, Math.cos(x*x - 1)));
}
List<Point> reduced = SeriesReducer.reduce(points, 0.01);

About

A java implementation of Ramer–Douglas–Peucker algorithm for reducing number of points in data series.

Resources

License

Stars

Watchers

Forks

Packages

No packages published