public void updateTrace(int dx) { for (int i = 0; i < getNumFns(); i += 1) { traceLoc += dx; if (traceLoc > graph.getXMax()) traceLoc = (int) graph.getXMax(); else if (traceLoc < graph.getXMin()) traceLoc = (int) graph.getXMin(); } }
public void plotFns(float[][] fnPts, int nFns) { for (int i = 0; i < nFns; i += 1) { if (!graphCalcs[i].empty()) { /* Log.v ("plotFns",Float.toString(graph.getXMax())+" "+ Float.toString(graph.getYMax())+" "+Float.toString(graph.getXLeft ())+ " "+Float.toString(graph.getXRight ())+" "+ Float.toString(graph.getYBot ())+" "+Float.toString(graph.getYTop ())); */ graphCalcs[i].graphFn( fnPts[i], graph.getXLeft(), graph.getXRight(), graph.getYBot(), graph.getYTop(), graph.getXMin(), graph.getXMax(), graph.getYMin(), graph.getYMax(), graph.getXUnitLen()); /* for (int j=0;j<N_FN_PTS*4;j+=4) { Log.v ("plotFns", Float.toString(fnPts[i][j])+","+Float.toString(fnPts[i][j+1])+ " "+ Float.toString(fnPts[i][j+2])+","+Float.toString(fnPts[i][j+3])); } */ } else { clearArr(fnPts[i]); } } }
public void calcZeros(ArrayAdapter<String> zerosArr, int nFns) { int n; String title; for (int i = 0; i < nFns; i += 1) { if (!graphCalcs[i].empty()) { title = "Fn" + Integer.toString(i + 1) + "(x):"; n = graphCalcs[i].calcZeros( zeros[i], graph.getXLeft(), graph.getXRight(), graph.getYBot(), graph.getYTop(), graph.getXMin(), graph.getXMax(), graph.getYMin(), graph.getYMax(), graph.getXUnitLen()); // Log.v ("calcZeros",Integer.toString(n)); if (n == 0) title += " None"; zerosArr.add(title); // Convert x values of zeros to strings for (int k = 0; k < n; k += 1) { float num = zeros[i][k]; if ((num > -0.001 && num < 0) || (num < 0.001 && num > 0)) num = 0; String numStr = ComplexNumber.roundStr(num, 3); zerosArr.add(" x = " + numStr); } } } }
public void initTrace() { for (int i = 0; i < getNumFns(); i += 1) { traceLoc = (int) ((graph.getXMin() + graph.getXMax()) / 2); } }