package net.sf.openrocket.util;
import java.util.Iterator;
+import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;
addPoints(x,y);
}
+ public LinearInterpolator(List<Double> x, List<Double> y) {
+ addPoints(x,y);
+ }
/**
* Add the point to the linear interpolation.
}
}
+ public void addPoints(List<Double> x, List<Double> y){
+ if (x.size() != y.size()) {
+ throw new IllegalArgumentException("Array lengths do not match, x="+x.size() +
+ " y="+y.size());
+ }
+ for (int i=0; i < x.size(); i++) {
+ sortMap.put( (Double) x.toArray()[i], (Double) y.toArray()[i]);
+ }
+ }
public double getValue(double x) {