Package org.geotools.process.vector
Class BilinearInterpolator
- Object
-
- BilinearInterpolator
-
public class BilinearInterpolator extends Object
Interpolates a grid to a grid of different dimensions using bilinear interpolation.NO_DATA cell values are supported in the source grid. There are two ways of handling the boundary between NO_DATA cells and data cells:
- Truncate - If any source cell is NO_DATA, the dest value is NO_DATA. This is simple and fast, but does make the data boundaries look a bit ragged.
- Smooth - If only one source cell is NO_DATA, the value is interpolated using the 3 valid values, across one-half of the interpolated cells. This smoothes off the boundary. If 2 or more source cells are NO_DATA, then Truncation is used.
Reference: http://en.wikipedia.org/wiki/Bilinear_interpolation.
- Author:
- Martin Davis - OpenGeo
-
-
Constructor Summary
Constructors Constructor Description BilinearInterpolator(float[][] src)
Creates a new interpolator on a given source grid.BilinearInterpolator(float[][] src, float noDataValue)
Creates a new interpolator on a given source grid.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float[][]
interpolate(int width, int height, boolean smoothBoundary)
Interpolates the source grid to a new grid of different dimensions.
-
-
-
Constructor Detail
-
BilinearInterpolator
public BilinearInterpolator(float[][] src)
Creates a new interpolator on a given source grid.- Parameters:
src
- the source grid
-
BilinearInterpolator
public BilinearInterpolator(float[][] src, float noDataValue)
Creates a new interpolator on a given source grid.- Parameters:
src
- the source gridnoDataValue
- the NO_DATA value (if none use Float.NaN)
-
-
Method Detail
-
interpolate
public float[][] interpolate(int width, int height, boolean smoothBoundary)
Interpolates the source grid to a new grid of different dimensions.- Parameters:
width
- the width of the destination gridheight
- the height of the destination gridsmoothBoundary
- true if boundary smoothing should be performed- Returns:
- the interpolated grid
-
-