Last Update: 17 May 2012
A Bezier cubic curve is defined by four points in the cartesian coordinate system: Pn(Pnx , Pny) with n=0,1,2,3 . The curve is expressed by the point P(x,y) defined by the following parametric relation:
P = t3(P3-3P2+3P1-P0) +3t 2(P2-2P1+P0) +3t (P1-P0) + P0 , where t is a parameter in the interval of 0 ≤ t ≤ 1 .
A cubic polynomial function is given in general by the relation y=a0+a1x+a2x2+a3x3 , where the indexed a's are real constants. If the variable x is limited in an interval x0 ≤ x ≤ x0+χ with χ>0 , then the polynomial function is equivalent to a special case of the cubic Bezier curves.
In order to express the polynomial by a Bezier curve, one have to apply the following restriction: the x component of P should be linear to t . Only that way the y component of P becomes a cubic polynomial of x . This linear expression should be consistent with the intervals of x and t , therefore t=(x−x0)/χ with its inverse x=x0+χt . This implies the following relations:
P3x-3P2x+3P1x-P0x = 0
P2x-2P1x+P0x = 0
3(P1x-P0x) = χ
P0x = x0
The solution of these relations is: P0x=x0 , P1x=x1=x0+(χ/3) , P2x=x2=x0+(2χ/3) and P3x=x3=x0+χ .
The corresponding t values are t0=0 , t1=1/3 , t2=2/3 and t3=1 .
The corresponding y coordinates on the curve are: yn =y(xn) with n=0,1,2,3 .
By definition P0y=y0 and P3y=y3 .
For convenience, the expression of P is rewritten in a different form:
P = t3P3 + 3t2(1-t)P2 + 3t(1-t)2P1 + (1-t)3P0 .
In the case of t=t1=1/3 one obtains:
y1 = (1/3)3y3 + 3(1/3)2(2/3)P2y + 3(1/3)(2/3)2P1y + (2/3)3y0 .
In the case of t=t2=2/3 one obtains: y2 = (2/3)3y3 + 3(2/3)2(1/3)P2y + 3(2/3)(1/3)2P1y + (1/3)3y0 .
Both represent two linear equations with two unknowns P1y and P2y .
The solution is:
P1y=( -5y0 +18y1 -9y2 +2y3 ) / 6 and
P2y=( 2y0 -9y1 +18y2 -5y3 ) / 6 .