## Friday, 7 March 2014

### Computer Graphics Notes - Lab 22 - Bezier Curves

Bezier curve is an approach for the construction of the curve. A Bezier curve is determined by a defining polygon. Bezier curves have a number of properties that make them highly useful and convenient for curve and surface design. They are also easy to implement. Bezier curves are widely used in various CAD systems and in general graphics packages.

APPROACH FOR CONSTRUCTING BEZIER CURVE

In this approach the Bezier curve can be constructed simply by taking midpoints. In midpoint approach midpoints of the lines connecting four control points (A, B, C, D) are determined (AB, BC, CD). Line segments connect these midpoints and their midpoints ABC and BCD are determined. Finally these two midpoints are connected and its midpoint ABCD is determined.

The point ABCD on the Bezier curve divides the original curve into two sections. This makes the points A, AB, ABC and ABCD are the control points of the first section and the points ABCD, BCD, CD and D are the control points for the second section. By considering two sections separately we can get two more sections for each separate section i.e. the original Bezier curve gets divided into for different curves. This process can be repeated to split the curve into smaller sections so short that they can be replaced by straight lines or even until the sections are not bigger than individual pixels.

ALGORITHM
1.     Get four control points say A (xA, yA), B (xb, yB), C (xc, yc) and D (xd, yD).
2.     Divide the curve represented by points A, B, C and D in two sections
xAB = (xA + xb) / 2
yAB = (yA + yb)/2
xBC = (xB + xC) / 2
yBC = (yB + yC) / 2
xCD =( xC + xD) / 2
yCD = (yC + yD) / 2
xABC = (xAB + xBC) / 2
yABC = (yAB + yBC) / 2
xBCD = (xBC + xCD) / 2
yBCD = (yBC + yCD) / 2
xABCD = (xABC + xBCD) / 2
yABCD = (yABC + yBCD) / 2

3.     Repeat the step 2 for section A, AB, ABC and ABCD and section ABCD, BCD, CD and D.
4.     Repeat step 3 until we have sections so short that straight lines can replace them.
5.     Replace small sections by straight lines.
6.     Stop.

MATHEMATICAL APPROACH FOR BEZIER CURVE

The equation for the Bezier Curve is given as
P(u) = (1 - u)3 P1 + 3 u (1 - u)2 P2 + 3 u2 (1 - u) P3 + u3 P4 for 0 ≤ u ≤ 1
PROPERTIES OF BEZIER CURVE
1.     The basic functions are real.
2.     Beizer curve always passes through the first and last control points i.e. curve has the same end points as the guiding polygon.
3.     The degree of the polynomial defining the curve segment is one less than the number of defining polygon point. Therefore, for 4 control points, the degree of the polynomial is three, i.e. cubic polynomial.
4.     The curve generally follows the shape of the defining polygon.
5.     The direction of the tangent vector at the end points is the same as that of the vector determined by first and last segments. Same vector is determined by both and point and first & last segment.
6.     The curve lies entirely within the convex hull formed by four control points.
7.     The convex hull property for a Bezier curve ensures that the polynomial smoothly follows the control points.
8.     The curve exhibits the variation diminishing property. This means that the curve does not oscillate about any straight line more often than the defining polygon.
9.     The curve is invariant under an affined transformation.
EXAMPLE
Construct the Bezier curve of order 3 and with polygon vertices A (1, 1), B (2, 3), C (4, 3) and D (6, 4).