Cubic Bezier 4point Interpolation Part III
Once the cubic Bezier curve is parameterized, i.e. B(t1) = V1 and B(t2) = V2, how do we solve for the x and ycoordinates of P1 and P2? This problem can be addressed more easily by examining B(t) in power form (hopefully your browser supports superscript tags),
B(t) = c0 + c1*t + c2*t^{2} + c3*t^{3},
where c0 = P0, c1 = 3P1 – 3P0, c2 = 3P2 – 6P1 + 3P0, and c3 = P3 – 3P2 + 3P1 – P0 (in vector form).
Set B(t1) = V1 and move all terms not containing P1 and P2 to the righthand side of the equation. Let P1x represent the xcoordinate of P1, V1y represent the ycomponent of V1, and so forth. Write the equation for just the xcoordinates of V1 and V2, i.e. Bx(t1) = V1x and Bx(t2) = V2x. This yields the 2×2 system of equations
a11*P1x + a12*P2x = b1
a21*P1x+ a22*P2x = b2
where
a11 = 3t1^{3} – 6t1^{2} + 3t1
a12 = 3t1^{3} + 3t1^{2}
a21 = 3t2^{3} – 6t2^{2} + 3t2
a22 = 3t2^{3} + 3t2^{2}
b1 = t1^{3}P3x + P0x*(t1^{3} – 3t1^{2} + 3t1 – 1) + V1x
b2 = t2^{3}P3x + P0x*(t2^{3} – 3t2^{2} + 3t2 – 1) + V2x
Many browsers appear to not support subscripting, so forgive the notation. t1^{3} refers to the quantity, t1 cubed, not t times 1 cubed 🙂
Solving this 2×2 system yields the xcoordinates of P1 and P2. The same coefficients (with different righthand side) can be used to resolve for the ycoordinates of P1 and P2. This is a bit different than what might be expected as we are first solving for xcoordinates of two vectors, then solving again for the ycoordinates.
It’s possible to write a full set of four equations in four unknowns and use a general LU factorization method to solve for the entire coordinate set at once. It is more efficient to solve a 2×2 system twice, only changing the righthand side values.
An efficient solution method will be discussed tomorrow.

September 10, 2008 at 5:45 amCubic Bezier 4point Interpolation Part IV « The Algorithmist