Thursday 4 August 2011

Bezier's Curve


The parametric expression of a cubic Bezier[Artificial Intelligence]

Now, the de Casteljau algorithm by itself is not very useful in drawing a cubic Bezier curve, since this would require the computation of a large number of the points on the curve for obtain a certain precision. Nevertheless, for further practical exploitation of the Bezier curves, the parametric expression of the coordinates of points on a cubic Bezier curve is necessary.
Let's start by note that the point D that divides the EF segment in a t/(1-t) ratio has the coordinates given by the expressions:
Dx = (1-t)•Ex+tFx and Dy = (1-t)•Ey+tFy   (1)
Since the expressions for the x and y coordinates are similar, in the followings the non-indexed notation will be used as a shortcut for expressions (1) above:
D = (1-t)•E + tF   (1')
With this notation:
  • after the step 1, the A, B and C coordinates will be:
    A = (1-t)•P1 + tC1
    B = (1-t)•C1 + tC2
    C = (1-t)•C2 + tP2
  • after step 2, the M and N coordinates will be:
    M = (1-t)•A + tB = (1-t)2P1 + 2•(1-t) •tC1 + t2C2
    N = (1-t)•B + tC = (1-t)2C1 + 2•(1-t) •tC2 + t2P2
  • after step 3, the coordinates of the P point will be:
    P = (1-t)•M + tN = (1-t)3P1 +
        + 3•(1-t)2•tC1 + 3•(1-t)•t2C2 + t3P2
The expression:
P = (1-t)3P1 + 3•(1-t)2tC1 + 3•(1-t)•t2C2 + t3P2    (3)
  with t taking values in the [0, 1] interval
is called the parametric expression of a cubic Bezier curve.
For example, applying the expression (3) for a 0.5 parameter value, results in:
midc = (P1 + 3•C1 + 3•C2 + P2)/8    (4)
for the location of the middle point of a Bezier curve.

[Note] The Coordinate A may be calculated for both Ax, Ay.
            (P1x,P1y) - Starting Point.
            (P2x,P2y) - Ending Point.
            (Cx,Cy) - Common Intermediate Points.

No comments:

Post a Comment