Class PDFunctionType0.Rinterpol

  • Enclosing class:
    PDFunctionType0

    private class PDFunctionType0.Rinterpol
    extends java.lang.Object
    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).
    • Constructor Summary

      Constructors 
      Constructor Description
      Rinterpol​(float[] input, int[] inputPrev, int[] inputNext)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private int calcSampleIndex​(int[] vector)
      calculate array index (structure described in p.171 PDF spec 1.7) in multiple dimensions.
      private int[][] getSamples()
      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[] rinterpolate()
      Calculate the interpolation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

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

      • Rinterpol

        Rinterpol​(float[] input,
                  int[] inputPrev,
                  int[] inputNext)
        Constructor.
        Parameters:
        input - the input coordinates
        inputPrev - coordinate of the "ceil" point
        inputNext - coordinate of the "floor" point
    • Method Detail

      • 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 sample
        step - 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.