Bezier curves do-not use weighting factors, so yes, the w is ignored in the algorithm. The use of the w is actually fairly limited and something I tend to avoid.
Taking the bezier curve, we need to insert a kink in the curve. This isn’t easy to do with a bezier. Ideally we need to convert the bezier curve into a spline.
the bezier curve equation:
QB(t) = (1-t)^3P1 + (1-t)^2tP2 + (1-t)t^2P3 + t^3P4
the cubic b-spline equation : (still not using weights)
QB(t) = (-t^3 + 3t^2 - 3t + 1)P1 + (3t^3 - 6t^2 + 3t)P2 + (-3t^3 + 3t^2)P3 + t^3P4
If you take the code I gave you above, and re-write it slightly to include the b-spline equation above, you’ll get something that looks very odd.
You’ll notice that the curve is very very small and doesn’t touch any end points at all. In order to generate the same curve you get with the bezier, you need to clamp it. This is done by drawing a total of 5 curves :
curve 1 : uses control points : P1 P1 P1 P2
curve 2 : uses control points : P1 P1 P2 P3
curve 3 : uses control points : P1 P2 P3 P4
curve 4 : uses control points : P2 P3 P4 P4
curve 5 : uses control points : P3 P4 P4 P4
using control points a number of times, gives us the ability to pull the curve to the points. You may notice that the curve is of degree 3 (the highest power in the equation) and it requires 3 control points the same to get it to meet the curve. 4 repeated control points will break the curve.
getting the curve to meet at control point 2 requires us to draw yet more curves (experiment cos I cant check this…)
curve 1 : uses control points : P1 P1 P1 P2
curve 2 : uses control points : P1 P1 P2 P2
curve 3 : uses control points : P1 P2 P2 P2
curve 4 : uses control points : P2 P2 P2 P3
curve 5 : uses control points : P2 P2 P3 P4
curve 6 : uses control points : P2 P3 P4 P4
curve 7 : uses control points : P3 P4 P4 P4
this should work, but is fairly messy. This is where knots and the cox-de-boor algorithm comes into play. Rather than repeatedly re-draw curves, we use a knot vector to hold information that relates to which curves require which control points. Inserting extra knots does a similar thing to duplicating control points. For the bezier curve we can say :
4 control points P1-P4
degree = 3
order = degree+1 = 4
knot vector = [0,0,0,0,1,1,1,1]
The knot vector itself is very difficult to explain, but to give you an overview, it essentually is nothing more than a construct for the cox-de-boor algorithm that lists the parametric t values. Looking up some stuff on the cox-de-boor is probably a good idea.
hermite,beziers & cubic splines: http://www.eburg.com/~baxters/curves/
Carl de Boor’s website has tonnes of material and resource lists for b-splines and NURBS - http://www.cs.wisc.edu/~deboor/