intervalChanged method
void
intervalChanged(
- int v1,
- int v2,
- int v3
)
override
Implementation
@override
void intervalChanged(int v1, int v2, int v3) {
List<num?> pp = parameterPositions;
int iPrev = v1 - 2;
int iNext = v1 + 1;
num? tPrev = pp[iPrev];
num? 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;
}
}
final halfDt = (v3 - v2) * 0.5, stride = valueSize;
_weightPrev = halfDt / (v2 - tPrev);
_weightNext = halfDt / (tNext - v3);
_offsetPrev = iPrev * stride;
_offsetNext = iNext * stride;
}