You are on page 1of 2

Umm Al-Qura University

Department of Computer Science


14012501-Computer Graphics
Lab 6 Parametric Bezier Curves
Objective: Draw parametric Bezier curves.

Equation of linear Bezier curve

P(t ) =(1 − t ) P0 + tP1


Equation of quadratic Bezier curve

P(t ) =(1 − t )2 P0 + 2t (1 − t ) P1 + t 2 P2
Equation of cubic Bezier curve

P(t ) =(1 − t )3 P0 + 3t (1 − t )2 P1 + 3t 2 (1 − t ) P2 + t 3 P3
Example 1:
A sample program ParametricBezierCurve.java is given to you that draws a linear Bezier curve (parametric
line) as shown below. Compile and run this program.
Exercise 1
Complete the code of quadraticBezier(…) and cubicBezier(…) methods in the example program such that the
program also draws quadratic and cubic Bezier curves as shown below.

Note: In Java following format is used to raise a to the power b

• Math.pow(a, b);
• Example
o Math.pow(2, 4) mean 2 to the power 4, i.e., 24 = 16

You might also like