Hello
I released before another code and I thought about this thing, my idea is to use this to move a "scrolling bar" on those so loved menus. This code gives you the y position of the point of a interpolation polynomial that passes over some certain points you determine in a smooth way.
I think this might show you better what this is:
http://en.wikipedia.org/wiki/Lagrange_polynomial
Here it goes the code that was used for testing (it moves a text through the polynomial that passes over the 3 points, is not very smooth in the example because the waiting time is high. With MoveOverTime() function you could improove a lot the effect):
Credits:
- OMA Rhino for testing this for me.
Thanks for reading and I hope that this will get some use in some of those menus
I released before another code and I thought about this thing, my idea is to use this to move a "scrolling bar" on those so loved menus. This code gives you the y position of the point of a interpolation polynomial that passes over some certain points you determine in a smooth way.
I think this might show you better what this is:
http://en.wikipedia.org/wiki/Lagrange_polynomial
Code:
Interpolate( x, y, point )
{
total = 0;
for( i = 0; i < ( x.size - 1 ); i ++ )
{
p = 1;
for( j = 0; j < x.size; j ++ )
if( j != i )
p = p * ( point - x[j] ) / ( x[i] - x[j] );
p *= y[i];
total += p;
}
return total;
}
Here it goes the code that was used for testing (it moves a text through the polynomial that passes over the 3 points, is not very smooth in the example because the waiting time is high. With MoveOverTime() function you could improove a lot the effect):
Spoiler (Click to View)
- OMA Rhino for testing this for me.
Thanks for reading and I hope that this will get some use in some of those menus