COSObjectable
PDFunctionType0
, PDFunctionType2
, PDFunctionType3
, PDFunctionType4
public abstract class PDFunction extends java.lang.Object implements COSObjectable
Constructor | Description |
---|---|
PDFunction(COSBase function) |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
protected float[] |
clipToRange(float[] inputValues) |
Clip the given input values to the ranges.
|
protected float |
clipToRange(float x,
float rangeMin,
float rangeMax) |
Clip the given input value to the given range.
|
static PDFunction |
create(COSBase function) |
Create the correct PD Model function based on the COS base function.
|
abstract float[] |
eval(float[] input) |
Evaluates the function at the given input.
|
COSArray |
eval(COSArray input) |
Evaluates the function at the given input.
|
COSBase |
getCOSObject() |
Returns the COSObject.
|
COSDictionary |
getDictionary() |
Returns the stream.
|
PDRange |
getDomainForInput(int n) |
This will get the range for a certain input parameter.
|
abstract int |
getFunctionType() |
Returns the function type.
|
int |
getNumberOfInputParameters() |
This will get the number of input parameters that
have a domain specified.
|
int |
getNumberOfOutputParameters() |
This will get the number of output parameters that
have a range specified.
|
protected PDStream |
getPDStream() |
Returns the underlying PDStream.
|
PDRange |
getRangeForOutput(int n) |
This will get the range for a certain output parameters.
|
protected COSArray |
getRangeValues() |
Returns all ranges for the output values as COSArray .
|
protected float |
interpolate(float x,
float xRangeMin,
float xRangeMax,
float yRangeMin,
float yRangeMax) |
For a given value of x, interpolate calculates the y value
on the line defined by the two points (xRangeMin , xRangeMax )
and (yRangeMin , yRangeMax ).
|
void |
setDomainValues(COSArray domainValues) |
This will set the domain values.
|
void |
setRangeValues(COSArray rangeValues) |
This will set the range values.
|
public PDFunction(COSBase function)
function
- The function stream.public abstract int getFunctionType()
public COSBase getCOSObject()
getCOSObject
in interface COSObjectable
public COSDictionary getDictionary()
protected PDStream getPDStream()
public static PDFunction create(COSBase function) throws java.io.IOException
function
- The COS function dictionary.java.io.IOException
- If we are unable to create the PDFunction object.public int getNumberOfOutputParameters()
public PDRange getRangeForOutput(int n)
n
- The output parameter number to get the range for.public void setRangeValues(COSArray rangeValues)
rangeValues
- The new range values.public int getNumberOfInputParameters()
public PDRange getDomainForInput(int n)
n
- The parameter number to get the domain for.public void setDomainValues(COSArray domainValues)
domainValues
- The new domain values.public COSArray eval(COSArray input) throws java.io.IOException
input
- The COSArray of input values for the function.
In many cases will be an array of a single value, but not always.java.io.IOException
- an IOExcpetion is thrown if something went wrong processing the function.public abstract float[] eval(float[] input) throws java.io.IOException
input
- The array of input values for the function.
In many cases will be an array of a single value, but not always.java.io.IOException
- an IOExcpetion is thrown if something went wrong processing the function.protected COSArray getRangeValues()
protected float[] clipToRange(float[] inputValues)
inputValues
- the input valuesprotected float clipToRange(float x, float rangeMin, float rangeMax)
x
- the input valuerangeMin
- the min value of the rangerangeMax
- the max value of the rangeprotected float interpolate(float x, float xRangeMin, float xRangeMax, float yRangeMin, float yRangeMax)
x
- the to be interpolated value.xRangeMin
- the min value of the x rangexRangeMax
- the max value of the x rangeyRangeMin
- the min value of the y rangeyRangeMax
- the max value of the y range