@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; }
@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 int newIndex = (index + 1 >= _lookupTable.size()) ? 1 : index + 1; delta = getDelta(newIndex, distance - previous.getLength()) + previous.getDelta();
final int newIndex = (index + 1 >= _lookupTable.size()) ? 1 : index + 1; delta = getDelta(newIndex, distance - previous.getLength()) + previous.getDelta();