/** * Generates arc lengths which are required if you wish to have {@link #setConstantSpeed(boolean) constant speed} * interpolation. * * @param step * 'See Also:' method for more info. * @param reverse * <code>true</code> to also generate a reverse look up table. This is only required if you plan to use * the {@link ComplexSpatialController.RepeatType#CYCLE} repeat type. * @see ArcLengthTable#generate(int, boolean) */ public void generateArcLengths(final int step, final boolean reverse) { _arcLengths = new ArcLengthTable(getCurve()); _arcLengths.generate(step, false); if (reverse) { _arcLengthsReverse = new ArcLengthTable(getCurve()); _arcLengthsReverse.generate(step, true); } }
@Override protected int incrementIndex() { assert (null != _arcLengths) : "You need to call generateArcLengths() to create the required arc length tables!"; _distance -= _arcLengths.getLength(getIndex()); return super.incrementIndex(); }
final double tStep = InterpolationController.DELTA_MAX / step; for (int i = loopStart; continueLoop(i, reverse); i = updateCounter(i, reverse)) { final int startIndex = i; double t = 0f;
@Override protected double incrementDelta(final double by) { double delta; /* * If constant speed we need to also check we aren't clamped at max index before we call lookup in the arc * length table because there would be no point */ if (isConstantSpeed()) { _distance += by; if (isCycleForward()) { assert (null != _arcLengths) : "You need to call generateArcLengths(x, false) to create the required arc length table!"; delta = _arcLengths.getDelta(getIndex(), _distance); } else { assert (null != _arcLengthsReverse) : "You need to call generateArcLengths(x, true) to create the required reverse arc length table!"; delta = _arcLengthsReverse.getDelta(getIndex(), _distance); } setDelta(delta); } else { delta = super.incrementDelta(by); } return delta; }
final double tStep = InterpolationController.DELTA_MAX / step; for (int i = loopStart; continueLoop(i, reverse); i = updateCounter(i, reverse)) { final int startIndex = i; double t = 0f;
@Override protected double incrementDelta(final double by) { double delta; /* * If constant speed we need to also check we aren't clamped at max index before we call lookup in the arc * length table because there would be no point */ if (isConstantSpeed()) { _distance += by; if (isCycleForward()) { assert (null != _arcLengths) : "You need to call generateArcLengths(x, false) to create the required arc length table!"; delta = _arcLengths.getDelta(getIndex(), _distance); } else { assert (null != _arcLengthsReverse) : "You need to call generateArcLengths(x, true) to create the required reverse arc length table!"; delta = _arcLengthsReverse.getDelta(getIndex(), _distance); } setDelta(delta); } else { delta = super.incrementDelta(by); } return delta; }
/** * Generates arc lengths which are required if you wish to have {@link #setConstantSpeed(boolean) constant speed} * interpolation. * * @param step * 'See Also:' method for more info. * @param reverse * <code>true</code> to also generate a reverse look up table. This is only required if you plan to use * the {@link ComplexSpatialController.RepeatType#CYCLE} repeat type. * @see ArcLengthTable#generate(int, boolean) */ public void generateArcLengths(final int step, final boolean reverse) { _arcLengths = new ArcLengthTable(getCurve()); _arcLengths.generate(step, false); if (reverse) { _arcLengthsReverse = new ArcLengthTable(getCurve()); _arcLengthsReverse.generate(step, true); } }
@Override protected int decrementIndex() { assert (null != _arcLengthsReverse) : "You need to call generateArcLengths() to create the required arc length tables!"; _distance -= _arcLengthsReverse.getLength(getIndex()); return super.decrementIndex(); }
final int newIndex = (index + 1 >= _lookupTable.size()) ? 1 : index + 1; delta = getDelta(newIndex, distance - previous.getLength()) + previous.getDelta();
@Override protected int incrementIndex() { assert (null != _arcLengths) : "You need to call generateArcLengths() to create the required arc length tables!"; _distance -= _arcLengths.getLength(getIndex()); return super.incrementIndex(); }
final int newIndex = (index + 1 >= _lookupTable.size()) ? 1 : index + 1; delta = getDelta(newIndex, distance - previous.getLength()) + previous.getDelta();
@Override protected int decrementIndex() { assert (null != _arcLengthsReverse) : "You need to call generateArcLengths() to create the required arc length tables!"; _distance -= _arcLengthsReverse.getLength(getIndex()); return super.decrementIndex(); }