Rational Cubic Bezier Curve

Click and drag control points to change curve. Modify weights in boxes below the curve.

For more information, check out the post on my blog: Bezier Curves.
Your browser doesn't seem to support the necesary html5 features ):
W1: W2:
W3: W4:

Rational cubic bezier curves have 4 control points, a weight per control point (4 total), and total up the values of the 4 functions below to get the final point at time t.
  1. A * W1 * (1-t)^3
  2. B * W2 * 3t(1-t)^2
  3. C * W3 * 3t^2(1-t)
  4. D * W4 * t^3
They then divide that by the total of these 4 functions.
  1. W1 * (1-t)^3
  2. W2 * 3t(1-t)^2
  3. W3 * 3t^2(1-t)
  4. W4 * t^3
Parameters:
t - "Time", this value goes from 0 to 1 to generate each point on the curve
A - The first control point, also the starting point of the curve.
B - The second control point.
C - The third control point.
D - The fourth control point, also the ending point of the curve.
W1 - The weighting of control point A.
W2 - The weighting of control point B.
W3 - The weighting of control point C.
W4 - The weighting of control point D.

In other words, if you have 4 control points A,B,C and D, 4 weights W1, W2, W3, W4 and a time t:
CurvePoint = (A*W1*(1-t)^2 + B*W2*2t(1-t) + C*W3*t^2) / (W1*(1-t)^2 + W2*2t(1-t) + W3*t^2)..

Note that this bezier curve is 2 dimensional because A,B,C,D are 2 dimensional, but you could use these same equations in any dimenion!