Once the cubic Bezier curve is parameterized, i.e. B(t1) = V1 and B(t2) = V2, how do we solve for the x- and y-coordinates 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*t2 + c3*t3,
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 right-hand side of the equation. Let P1x represent the x-coordinate of P1, V1y represent the y-component of V1, and so forth. Write the equation for just the x-coordinates 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 = 3t13 – 6t12 + 3t1
a12 = -3t13 + 3t12
a21 = 3t23 – 6t22 + 3t2
a22 = -3t23 + 3t22
b1 = -t13P3x + P0x*(t13 – 3t12 + 3t1 – 1) + V1x
b2 = -t23P3x + P0x*(t23 – 3t22 + 3t2 – 1) + V2x
Many browsers appear to not support subscripting, so forgive the notation. t13 refers to the quantity, t1 cubed, not t times 1 cubed 🙂
Solving this 2×2 system yields the x-coordinates of P1 and P2. The same coefficients (with different right-hand side) can be used to resolve for the y-coordinates of P1 and P2. This is a bit different than what might be expected as we are first solving for x-coordinates of two vectors, then solving again for the y-coordinates.
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 right-hand side values.
An efficient solution method will be discussed tomorrow.
One thought on “Cubic Bezier 4-point Interpolation Part III”
Comments are closed.