Class PDFunctionType0.Rinterpol
java.lang.Object
org.apache.pdfbox.pdmodel.common.function.PDFunctionType0.Rinterpol
- Enclosing class:
- PDFunctionType0
Inner class do to an interpolation in the Nth dimension by comparing the
content size of N-1 dimensional objects. This is done with the help of
recursive calls. To understand the algorithm without recursion, here is a
bilinear
interpolation and here's a trilinear
interpolation (external links).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final float[]
private final int[]
private final int[]
private final int
private final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate int
calcSampleIndex
(int[] vector) calculate array index (structure described in p.171 PDF spec 1.7) in multiple dimensions.private int[][]
Get all sample values of this function.private float[]
rinterpol
(int[] coord, int step) Do a linear interpolation if the two coordinates can be known, or call itself recursively twice.(package private) float[]
Calculate the interpolation.
-
Field Details
-
in
private final float[] in -
inPrev
private final int[] inPrev -
inNext
private final int[] inNext -
numberOfInputValues
private final int numberOfInputValues -
numberOfOutputValues
private final int numberOfOutputValues
-
-
Constructor Details
-
Rinterpol
Rinterpol(float[] input, int[] inputPrev, int[] inputNext) Constructor.- Parameters:
input
- the input coordinatesinputPrev
- coordinate of the "ceil" pointinputNext
- coordinate of the "floor" point
-
-
Method Details
-
rinterpolate
float[] rinterpolate()Calculate the interpolation.- Returns:
- interpolated result sample
-
rinterpol
private float[] rinterpol(int[] coord, int step) Do a linear interpolation if the two coordinates can be known, or call itself recursively twice.- Parameters:
coord
- coord partially set coordinate (not set from step upwards); gets fully filled in the last call ("leaf"), where it is used to get the correct samplestep
- between 0 (first call) and dimension - 1- Returns:
- interpolated result sample
-
calcSampleIndex
private int calcSampleIndex(int[] vector) calculate array index (structure described in p.171 PDF spec 1.7) in multiple dimensions.- Parameters:
vector
- with coordinates- Returns:
- index in flat array
-
getSamples
private int[][] getSamples()Get all sample values of this function.- Returns:
- an array with all samples.
-