public class LinearInterpolator extends Object
Constructor and Description |
---|
LinearInterpolator(Point2D[] points) |
Modifier and Type | Method and Description |
---|---|
static LinearInterpolator |
createFromArrays(double[] x,
double[] y)
Arrays should be arranged so that x[k] corresponds to y[k] for all k.
|
double |
evaluate(double x)
Returns the interpolated y value for the given x value.
|
static LinearInterpolator |
parseLinearInterpolator(String function)
Creates a
LinearInterpolator from a String
describing the points. |
public LinearInterpolator(Point2D[] points)
points
- the points used in the interpolation. They do NOT have to
be in increasing values of x but must have distinct x
values.public double evaluate(double x)
public static LinearInterpolator createFromArrays(double[] x, double[] y) throws IllegalArgumentException
IllegalArgumentException
public static LinearInterpolator parseLinearInterpolator(String function) throws IllegalArgumentException
LinearInterpolator
from a String
describing the points.function
- a string in the format of "x1,y1;x2,y2;x3,y3;...".IllegalArgumentException
Copyright © 2013 Metron, Inc.. All rights reserved.