list sincInter( list input, integer output_size )
{
list output = [];
integer i;
integer j;
float o;
float x;
integer input_size = ( input != [] );
for( i=0; i < output_size; i++)
{
x = (i * (float)input_size) / (float)output_size ;
o = 0.0;
for( j = 0; j < input_size; j++)
{
if( j == x )
{
o += llList2Float( input, j );
}
else
{
o += llSin(PI*(j-x)) / (PI*(j-x)) * llList2Float( input, j );
}
}
output = ( output = [] ) + output + [ o ];
}
return output;
}
default
{
state_entry()
{
llSay(0, llDumpList2String( sincInter( [ 10.0, 12.0, 7.0, 20.0, 1.0 ], 15 ), ", " ));
}
}
This was actually originally written for audio, until I saw the output, didn't remember it would continue the interpolation past the end point. Depends on application how best to handle this so I'll leave for now.
Just feed it a list of all the Y co-ordinates and tell it how many points you want back.. Repeat for X & Z. The example above returns:
10.000000, 14.066406, 14.891788, 12.000001, 7.546314, 5.080103, 7.000000, 12.593926, 18.276554, 20.000000, 16.096838, 8.427813, 1.000000, -2.837224, -2.482324
can tell it's been over 4 years since I last looked at this code.. thought it was wrong for a moment. changing it to return 50 values give the following:
9.999999, 11.438580, 12.720934, 13.776106, 14.543041, 14.975723, 15.047495, 14.754171, 14.115611, 13.175619, 12.000000, 10.672933, 9.291783, 7.960750, 6.783717, 5.856901, 5.261747, 5.058687, 5.282206, 5.937647, 6.999999, 8.414840, 10.101395, 11.957488, 13.866149, 15.703287,17.346024, 18.680962, 19.611866, 20.066200, 20.000000, 19.400751, 18.288107, 16.712337, 14.750699, 12.501999, 10.079706, 7.604214, 5.194819, 2.961893, 1.000000, -0.617761, -1.843641, -2.657225, -3.065370, -3.100237, -2.815531, -2.281387, -1.578294, -0.790595
So the interpolation can go above the actual values to shape the curve.
Not entirely sure of best way to approach equidistant points. I'll have a think and get back to you.
Had a think, no simple solution I can think of. Knowing the application will make things easier to think through. If you are thinking of rezzing markers then perhaps constraining them to be a set distance from each other is best approach. Assuming this lookup table generation approach will work for you
