public class Interpolation
extends java.lang.Object
The setValues() method specifies the reference values as a double array. setIndexes() specifies the indexes of those values as an int array. These two arrays must have the same length, and the indexes must be increasing and non-negative; otherwise an exception will be thrown. The values are periodic if a positive period is set by setPeriod(). In this case, the period must be greater than the largest index, and values within the index range 0 to (period-1) are repeated indefinitely. If the period is zero, the values are not periodic, and the values outside the range of the indexes are considered to be 0.0. The interpolation order is set by setOrder().
The default reference values are {1.0, 0.0} and the indexes are {0, 1}. The default period is 2 and the order is 0.
red (cxh) |
Yellow (yuhong) |
Constructor and Description |
---|
Interpolation()
Construct an instance of Interpolation using the default parameters.
|
Modifier and Type | Method and Description |
---|---|
int[] |
getIndexes()
Return the reference indexes.
|
int |
getOrder()
Return the interpolation order.
|
int |
getPeriod()
Return the value repetition period.
|
double[] |
getValues()
Return the reference values.
|
double |
interpolate(int index)
Return the interpolation result for the specified index.
|
void |
setIndexes(int[] indexes)
Set the reference indexes.
|
void |
setOrder(int order)
Set the interpolation order.
|
void |
setPeriod(int period)
Set the value repetition period.
|
void |
setValues(double[] values)
Set the reference values.
|
public Interpolation()
public int[] getIndexes()
setIndexes(int[])
public int getOrder()
setOrder(int)
public int getPeriod()
setPeriod(int)
public double[] getValues()
setValues(double[])
public double interpolate(int index)
index
- The point of interpolation. Can be negativejava.lang.IllegalStateException
- If the index and value arrays
do not have the same length, or the period is not 0 and not
greater than the largest index.public void setIndexes(int[] indexes)
indexes
- An int array.java.lang.IllegalArgumentException
- If the argument array is
not increasing and non-negative.getIndexes()
public void setOrder(int order)
order
- An int.java.lang.IllegalArgumentException
- If the order is not 0, 1, or 3.getOrder()
public void setPeriod(int period)
period
- An int.java.lang.IllegalArgumentException
- If the period is negative.getPeriod()
public void setValues(double[] values)
values
- A double array.getValues()