I'm sorry @alexandros but I'm having difficulty understanding your question. Are you asking about the case where the index is in between n - 3 and n - 2?
more precisely this part: "how can it be the same?" What is the "it"? the polynomial?
If yes, then I'll try to clarify that part:
Having the same polynomial at 2 different indices does not mean that the output is the same, just that the 2 indices are between the same 2 points of the array. for instance if you read between n - 3 and n - 2 you use the same polynomial as if you read right at n - 3, but the result is not the same because when you read you read at a different place in the same polynomial: the input to the polynomial function is different and therefore the output is different. (if f(x) is the polynomial function, then changing x changes f(x), f(x) is usually not constant).
findex
is basically the value from the signal inlet of tabread4~, index
is the integer part of it. So when you do frac = findex - index
then frac
stores the fractional part of the index, and this fractional part is used to offset from the second point in the polynomial. When frac is 1, the offset goes all the way to the 3rd point. This happens only when index
is equal or above n - 2. (since index
is an integer, the test index > maxindex
in the code is the same thing as index >= (maxindex + 1)
where maxindex + 1
is equal to n - 2).
whenever tabread4 reads a point in an array it always fits a polynomial it uses to interpolate using 4 of the points of the array. Wherever the index is, tabread4 puts 2 points of the polynomial to the left of the index and 2 points to the right of the index. Normally when the index crosses the next point in the array, the polynomial moves 1 point to the right also. However when it tries to read at or past n - 2, it just stays at n - 2 instead because the polynomial can't move any more: it is already using the last point of the array as the last (4th) point of the polynomial, and n - 2 is the third point and so the polynomial can still be evaluated right at the n-2 point but not at higher indices.
At the Index 1 the same thing happens but on the other side of the array: if (index < 1) index = 1, frac = 0;
However, handling 1 itself is not necessary in this case because if findex
were exactly 1 then index would already be 1 and frac would already be 0 because findex - index
would be 0
Did I rope your question in all that?