Class PDFunctionType0.Rinterpol

java.lang.Object
org.apache.pdfbox.pdmodel.common.function.PDFunctionType0.Rinterpol
Enclosing class:
PDFunctionType0

private class PDFunctionType0.Rinterpol extends 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).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final float[]
     
    private final int[]
     
    private final int[]
     
    private final int
     
    private final int
     
  • Constructor Summary

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

    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[][]
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 coordinates
      inputPrev - coordinate of the "ceil" point
      inputNext - 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 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.