public void handleStep(StepInterpolator interpolator, boolean isLast) throws DerivativeException { ++nbSteps; for (int a = 1; a < 100; ++a) { double prev = interpolator.getPreviousTime(); double curr = interpolator.getCurrentTime(); double interp = ((100 - a) * prev + a * curr) / 100; interpolator.setInterpolatedTime(interp); double[] interpolatedY = interpolator.getInterpolatedState(); double[] theoreticalY = pb.computeTheoreticalState(interpolator.getInterpolatedTime()); double dx = interpolatedY[0] - theoreticalY[0]; double dy = interpolatedY[1] - theoreticalY[1]; double error = dx * dx + dy * dy; if (error > maxError) { maxError = error; } } if (isLast) { assertTrue(maxError < 2.7e-6); assertTrue(nbSteps < 80); } }
public void handleStep(StepInterpolator interpolator, boolean isLast) { double step = Math.abs(interpolator.getCurrentTime() - interpolator.getPreviousTime()); if (firstTime) { minStep = Math.abs(step); maxStep = minStep; firstTime = false; } else { if (step < minStep) { minStep = step; } if (step > maxStep) { maxStep = step; } } if (isLast) { assertTrue(minStep < 8.2e-3); assertTrue(maxStep > 1.7); } }