Module xaos.ui.plot

Class RamerDouglasPeuckerDataReducer<X extends Number,​Y extends Number>

  • 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
    • Constructor Detail

      • RamerDouglasPeuckerDataReducer

        public RamerDouglasPeuckerDataReducer()
    • 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 given data points to the specified targetPointsCount, if it is smaller than the data size.
        Specified by:
        reduce in interface DataReducer<X extends Number,​Y extends Number>
        Parameters:
        points - List of data points to be reduced.
        targetPointsCount - The desired number of target points, not smaller than DataReducer.MIN_TARGET_POINTS_COUNT.
        Returns:
        A List containing reduced data, or the original data list if its size is greater or equal to targetPointsCount.