Class FunctionType2

java.lang.Object
org.loboevolution.pdfview.function.PDFFunction
org.loboevolution.pdfview.function.FunctionType2

public class FunctionType2 extends PDFFunction
A type 2 function is an exponential interpolation function, which maps from one input value to n output values using a simple exponential formula.
  • Constructor Details

    • FunctionType2

      public FunctionType2()
      Creates a new instance of FunctionType2
  • Method Details

    • parse

      protected void parse(PDFObject obj) throws IOException
      Read the function information from a PDF Object

      Read the zeros, ones and exponent

      Specified by:
      parse in class PDFFunction
      Parameters:
      obj - a PDFObject object.
      Throws:
      IOException - if any.
    • doFunction

      protected void doFunction(float[] inputs, int inputOffset, float[] outputs, int outputOffset)
      Subclasses must implement this method to perform the actual function on the given set of data. Note that the inputs are guaranteed to be clipped to the domain, while the outputs will be automatically clipped to the range after being returned from this function.

      Calculate the function value for the input. For each output (j), the function value is: C0(j) + x^N * (C1(j) - C0(j))

      Specified by:
      doFunction in class PDFFunction
      Parameters:
      inputs - an array of
      invalid reference
      float
      objects.
      inputOffset - the offset into the inputs array to read from
      outputs - guaranteed to be at least as big as getNumOutputs(), but not yet clipped to domain
      outputOffset - the offset into the output array to write to
    • getNumOutputs

      public int getNumOutputs()
      Get the number of outputs, n, returned by this function
      Overrides:
      getNumOutputs in class PDFFunction
      Returns:
      the number of output values this function will return
    • getC0

      public float getC0(int index)
      Get the values at zero
      Parameters:
      index - a Integer object.
      Returns:
      a float.
    • getC1

      public float getC1(int index)
      Get the values at one
      Parameters:
      index - a Integer object.
      Returns:
      a float.