@Override public void setConstantSpeed(final boolean constantSpeed) { super.setConstantSpeed(constantSpeed); if (isConstantSpeed() && null == _arcLengths) { LOGGER .warning("Constant speed was set to true, you will need to call generateArcLengths() to avoid errors during update."); } }
@Override public void setConstantSpeed(final boolean constantSpeed) { super.setConstantSpeed(constantSpeed); if (isConstantSpeed() && null == _arcLengths) { LOGGER .warning("Constant speed was set to true, you will need to call generateArcLengths() to avoid errors during update."); } }
/** * Setting a new curve will automatically update the control points. * * @param curve * The new curve to follow, can not be <code>null</code>. * @see #getCurve() */ public void setCurve(final Curve curve) { if (null == curve) { throw new IllegalArgumentException("curve can not be null!"); } _curve = curve; setControls(_curve.getControlPoints()); if (isConstantSpeed()) { LOGGER .warning("Constant speed is set to true, you will need to call generateArcLengths() to avoid errors during update."); } }
/** * Setting a new curve will automatically update the control points. * * @param curve * The new curve to follow, can not be <code>null</code>. * @see #getCurve() */ public void setCurve(final Curve curve) { if (null == curve) { throw new IllegalArgumentException("curve can not be null!"); } _curve = curve; setControls(_curve.getControlPoints()); if (isConstantSpeed()) { LOGGER .warning("Constant speed is set to true, you will need to call generateArcLengths() to avoid errors during update."); } }
@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; }