-
- public static void main(String[] args) {
- LinearInterpolator interpolator = new LinearInterpolator(
- new double[] {1, 1.5, 2, 4, 5},
- new double[] {0, 1, 0, 2, 2}
- );
-
- for (double x=0; x < 6; x+=0.1) {
- System.out.printf("%.1f: %.2f\n", x, interpolator.getValue(x));
- }
-
- // Should be the same
-
- ArrayList<Double> time = new ArrayList<Double>( Arrays.asList( new Double[] {1.0, 1.5, 2.0, 4.0, 5.0} ));
- ArrayList<Double> y = new ArrayList<Double>( Arrays.asList( new Double[] {0.0, 1.0, 0.0, 2.0, 2.0} ));
-
- LinearInterpolator interpolator2 = new LinearInterpolator(time,y);
- for (double x=0; x < 6; x+=0.1) {
- System.out.printf("%.1f: %.2f\n", x, interpolator2.getValue(x));
- }
- }