我有一个函数,我用它来计算我的线性函数的点数。我想返回所有值的列表。但是我在某个地方出现了错误,并且在我的列表中只保存了一个点。你能告诉我有什么问题吗?为什么在最后一张表中只保存一分?这是代码:
private List<PointF> forumlaOfFunctionCharts(Number[] points){
List<PointF> listOfPoints = new ArrayList<PointF>();
PointF xy = new PointF();
float a = 0, b = 0, y = 0, y1 = 0, y2 = 0;
for(int i = 0; i<points.length-1; i++){
y1 = points[i].intValue();
y2 = points[i+1].intValue();
a = (y1-y2)/(i-(i+1));
b = y1 - (a*i);
Log.v("daneTabela", ""+a+", "+b);
for(float j = i; j<=i+1; j=j+0.1f){
y = a * j + b;
xy.set(j, y);
listOfPoints.add(xy);
Log.v("daneTa", ""+xy.x+", "+xy.y);
}
}
return listOfPoints;
}