blend function for 3 or more values
in
Programming Questions
•
5 months ago
hi, i found this blend function that works with 2 values.
you
need to give to the function 2 numbers and then the blending value ( from 0 to 1)
void blend (int a, int b, float frac )
{
resp = a + ( frac * ( b - a));
}
blend( 0, 10, 0.5); // will give 5 as result
How can i expand this function in order to work with 3 values or more instead of 2 values?
I need to adapt this function to have 3 or more values, Can anybody help me?
For example if a have 3 vlaues
blend( 0, 10, 20, 0.5); //------ > this should give 10 as result
any idea?
1