Module xaos.ui.plot
Package eu.ess.xaos.ui.plot.data
Class RamerDouglasPeuckerDataReducer<X extends Number,Y extends Number>
- java.lang.Object
-
- eu.ess.xaos.ui.plot.data.RamerDouglasPeuckerDataReducer<X,Y>
-
- Type Parameters:
X
- Type of X values.Y
- Type of Y values.
- All Implemented Interfaces:
DataReducer<X,Y>
public final class RamerDouglasPeuckerDataReducer<X extends Number,Y extends Number> extends Object implements DataReducer<X,Y>
DataReducer
implementation based on a modified version of Ramer-Douglas-Peucker algorithm.Compared to the original algorithm that removes points that don't introduce error bigger than given epsilon, this implementation takes as argument the desired number of points, removing from the curve the points in the order of error size introduced i.e. points whose removal introduces smallest error are removed first. The algorithm stops once the curve has the desired number of points.
- Author:
- Grzegorz Kruk (original author)., claudio.rosati@esss.se
-
-
Field Summary
-
Fields inherited from interface eu.ess.xaos.ui.plot.data.DataReducer
DEFAULT_POINTS_COUNT, MIN_TARGET_POINTS_COUNT
-
-
Constructor Summary
Constructors Constructor Description RamerDouglasPeuckerDataReducer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<XYChart.Data<X,Y>>
reduce(List<XYChart.Data<X,Y>> points, int targetPointsCount)
Reduces the number of the givendata
points to the specifiedtargetPointsCount
, if it is smaller than the data size.
-
-
-
Method Detail
-
reduce
public List<XYChart.Data<X,Y>> reduce(List<XYChart.Data<X,Y>> points, int targetPointsCount)
Description copied from interface:DataReducer
Reduces the number of the givendata
points to the specifiedtargetPointsCount
, if it is smaller than the data size.- Specified by:
reduce
in interfaceDataReducer<X extends Number,Y extends Number>
- Parameters:
points
-List
of data points to be reduced.targetPointsCount
- The desired number of target points, not smaller thanDataReducer.MIN_TARGET_POINTS_COUNT
.- Returns:
- A
List
containing reduced data, or the originaldata
list if its size is greater or equal totargetPointsCount
.
-
-