Class RamanDouglasPeukerDataReducer
- java.lang.Object
-
- de.gsi.chart.renderer.datareduction.RamanDouglasPeukerDataReducer
-
- All Implemented Interfaces:
RendererDataReducer
public class RamanDouglasPeukerDataReducer extends java.lang.Object implements RendererDataReducer
Filters data using Ramer-Douglas-Peucker algorithm with specified tolerance N.B. numberical complexity: average O(n log (n)) -> worst-case O(n^2)- Author:
- Rzeźnik
- See Also:
- Ramer-Douglas-Peucker algorithm
-
-
Constructor Summary
Constructors Constructor Description RamanDouglasPeukerDataReducer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[][]filter(double[][] data)doublegetEpsilon()protected double[][]ramerDouglasPeuckerFunction(double[][] points, int startIndex, int endIndex)intreducePoints(double[] xValues, double[] yValues, double[] xPointErrorsPos, double[] xPointErrorsNeg, double[] yPointErrorsPos, double[] yPointErrorsNeg, java.lang.String[] styles, boolean[] pointSelected, int indexMin, int indexMax)Internal function to the ErrorDataSetRenderer arrays are cached copies and operations are assumed to be performed in-place (<-> for performance reasons/minimisation of memory allocation)voidsetEpsilon(double epsilon)
-
-
-
Method Detail
-
setEpsilon
public void setEpsilon(double epsilon)
- Parameters:
epsilon- maximum distance of a point in data between original curve and simplified curve
-
getEpsilon
public double getEpsilon()
- Returns:
epsilon
-
filter
public double[][] filter(double[][] data)
-
ramerDouglasPeuckerFunction
protected double[][] ramerDouglasPeuckerFunction(double[][] points, int startIndex, int endIndex)
-
reducePoints
public int reducePoints(double[] xValues, double[] yValues, double[] xPointErrorsPos, double[] xPointErrorsNeg, double[] yPointErrorsPos, double[] yPointErrorsNeg, java.lang.String[] styles, boolean[] pointSelected, int indexMin, int indexMax)Description copied from interface:RendererDataReducerInternal function to the ErrorDataSetRenderer arrays are cached copies and operations are assumed to be performed in-place (<-> for performance reasons/minimisation of memory allocation)- Specified by:
reducePointsin interfaceRendererDataReducer- Parameters:
xValues- array of x coordinatesyValues- array of y coordinatesxPointErrorsPos- array of coordinates containing x+expxPointErrorsNeg- array of coordinates containing x-exnyPointErrorsPos- array of coordinates containing x+eypyPointErrorsNeg- array of coordinates containing x+eynstyles- point stylespointSelected- array containing the points that have been specially selected by the userindexMin- minimum index of those array that shall be consideredindexMax- maximum index of those array that shall be considered- Returns:
- effective number of points that remain after the reduction
-
-