intervalChanged method
dynamic
intervalChanged(
- dynamic v1,
- dynamic v2,
- dynamic v3
)
override
Implementation
@override
intervalChanged(v1, v2, v3) {
var pp = parameterPositions;
var iPrev = v1 - 2, iNext = v1 + 1, tPrev = pp[iPrev], tNext = pp[iNext];
if (tPrev == null) {
switch (getSettings().endingStart) {
case ZeroSlopeEnding:
// f'(t0) = 0
iPrev = v1;
tPrev = 2 * v2 - v3;
break;
case WrapAroundEnding:
// use the other end of the curve
iPrev = pp.length - 2;
tPrev = v2 + pp[iPrev] - pp[iPrev + 1];
break;
default: // ZeroCurvatureEnding
// f''(t0) = 0 a.k.a. Natural Spline
iPrev = v1;
tPrev = v3;
}
}
if (tNext == null) {
switch (getSettings().endingEnd) {
case ZeroSlopeEnding:
// f'(tN) = 0
iNext = v1;
tNext = 2 * v3 - v2;
break;
case WrapAroundEnding:
// use the other end of the curve
iNext = 1;
tNext = v3 + pp[1] - pp[0];
break;
default: // ZeroCurvatureEnding
// f''(tN) = 0, a.k.a. Natural Spline
iNext = v1 - 1;
tNext = v2;
}
}
var halfDt = (v3 - v2) * 0.5, stride = valueSize;
_weightPrev = halfDt / (v2 - tPrev);
_weightNext = halfDt / (tNext - v3);
_offsetPrev = iPrev * stride;
_offsetNext = iNext * stride;
}