I'm creating a function to make basis functions for bezier parametric curves. I realise that bezier curves go through the first and control points but none of the others. So far my function does output the correct first point but when it gets to the last point the result as always zero.

I use the formula Bi(t)=C(k, i)t(power of i)(1-t)(power of k-i)

C being the coefficiant and k and i being the row and element index values for pascals triangle.

Im using the parametric range[0, 1] and as you can see when you input 1 the result would always have to be 0 and therefore my last sample point wouldnt = the last control point.

Its a long winded explanation but I must be working something out wrong or maybe I'm doing it right and i just dont know it.

Any help??