You are on page 1of 25

Lecture 6: Introduction to Geometry => Bezier Curve

Dr. Mazen Nabil Elagamy


Dr. Noha Ghatwary
 What is geometry ?
1. The study of shapes, sizes, patterns, and positions.
2. The study of spaces where some quantity (lengths, angles, etc.) can be measured.
What’s the best way to encode
geometry on a computer?
 Points aren’t Know directly but satisfy some relationship
 E.g., unit sphere is all points such that x2+y2+z2=1
 More generally, f(x,y,z) = 0
 Bezier curve is discovered by the French engineer Pierre Bézier.
 Bezier curves are used in computer graphics to draw shapes, for CSS animation and in many
other place
 These curves can be generated under the control of other points. Approximate tangents by
using control points are used to generate curve.
 Bezier Curve is parametric curve defined by a set of control points.
 Two points are ends of the curve.
 Other points determine the shape of the curve.
 The simplest Bézier curve is the straight line from the point P0 to P1.
 A quadratic Bezier curve is determined by three control points. A cubic Bezier
curve is determined by four control points.
 If you look closely at these curves, you can • The main value of Bezier curves for
immediately notice: drawing – by moving the points the
curve is changing in intuitively obvious
 Points are not always on curve. That’s perfectly
way.
normal, later we’ll see how the curve is built.
 The curve order equals the number of points
minus one. For two points we have a linear curve
(that’s a straight line), for three points – quadratic
curve (parabolic), for four points – cubic curve.
 A curve is always inside the convex hull of
control points:
 They always pass through the first and last control points.

 They are contained in the convex hull of their defining control points.

 The degree of the polynomial defining the curve segment is one less that the number of defining polygon point. Therefore,
for 4 control points, the degree of the polynomial is 3, i.e. cubic polynomial.

 A Bezier curve generally follows the shape of the defining polygon. The first and last points of the curve are coincident with
the first and last points of the defining polygon.

 The direction of the tangent vector at the end points is same as that of the vector determined by first and last segments.

 The convex hull property for a Bezier curve ensures that the polynomial smoothly follows the control points.

 No straight line intersects a Bezier curve more times than it intersects its control polygon.

 Bezier curves exhibit global control means moving a control point alters the shape of the whole curve.

 The order of the polynomial defining the curve segment is equal to the total number of control points.
1. Computer Graphics-
 Bezier curves are widely used in computer graphics to model smooth curves.
 The curve is completely contained in the convex hull of its control points.
 So, the points can be graphically displayed & used to manipulate the curve intuitively.
2. Animation-
 Bezier curves are used to outline movement in animation applications such as Adobe Flash.
 Users outline the wanted path in Bezier curves.
 The application creates the needed frames for the object to move along the path.
 For 3D animation, Bezier curves are often used to define 3D paths as well as 2D curves.
3. Fonts-
 True type fonts use composite Bezier curves composed of quadratic bezier curves.
 Modern imaging systems like postscript, asymptote etc. use composite bezier curves composed of
cubic Bezier curves for drawing curved shapes.
 Bézier curve is a curve expressed in the Bernstein basis:
 The Bezier curve can be represented mathematically as:
𝑃 𝑡 = σ𝑛𝑖=0 𝑃𝑖 𝑏𝑖,𝑛 𝑡 where 0≤ t ≤1

 Where, t is any parameter where 0 <= t <= 1 (i.e. influence of the curve point depends on t)
 P(t) = Any point lying on the bezier curve
 i = ith control point of the bezier curve
 n = polynomial degree of the curve
 𝑏𝑖,𝑛 𝑡 = Bernstein basis polynomials (Blending function) =>

and the binomial coefficient is =>

 The parametric equation for a cubic bezier curve


P(t) = P0(1-t)3 + P1(3t)(1-t)2 + P2(3t2)(1-t) + P3t3
 Cubic: of course, are just one example of Bezier splines:

Linear: P(t) = (1-t)P0 + tP1


Quadratic: P(t) = (1-t)2P0 + 2t(1-t)P1 + t2P2
Cubic: P(t) = (1-t)3P0 + 3t(1-t)2P1 + 3t2(1-t)P2 + t3P3
...

General:
“n choose v” = n! / i!(n-i)!
n
n
P (t )    (1  t ) t Pi , 0  t  1
n i i

i 0  i 
 Given a Bezier curve with 4 control points-
 P0[1 0] , P1[3 3] , P2[6 3] , P3[8 1]
 Determine any 5 points lying on the curve. Also, draw a rough sketch of the curve.
- The parametric equation for a cubic Bezier curve is-
P(t) = P0(1-t)3 + P1(3t)(1-t)2 + P2(3t2)(1-t) + P3t3
 Substituting the control points P0, P1, P2 and P3, we get:
P(t) = [1 0](1-t)3 + [3 3]3t(1-t)2 + [6 3]3t2(1-t) + [8 1]t3
 To get 5 points lying on the curve, assume any 5 values of t lying in the range 0 <= t <= 1.
 Let 5 values of t are 0, 0.2, 0.5, 0.7, 1
 At t are 0, 0.2, 0.5, 0.7, 1 Substitute in P(t) = [1 0](1-t)3 + [3 3]3t(1-t)2 + [6 3]3t2(1-t) + [8 1]t3

 For t = 0:
 P(0) = [1 0](1-0)3 + [3 3]3(0)(1-t)2 + [6 3]3(0)2(1-0) + [8 1](0)3
 P(0) = [1 0] + 0 + 0 + 0
 P(0) = [1 0]

 For t = 0.2:
 P(0.2) = [1 0](1-0.2)3 + [3 3]3(0.2)(1-0.2)2 + [6 3]3(0.2)2(1-0.2) + [8 1](0.2)3
 P(0.2) = [1 0](0.8)3 + [3 3]3(0.2)(0.8)2 + [6 3]3(0.2)2(0.8) + [8 1](0.2)3
 P(0.2) = [1 0] x 0.512 + [3 3] * 3 * 0.2 * 0.64 + [6 3] 3 0.04 0.8 + [8 1] * 0.008
 P(0.2) = [1 0] x 0.512 + [3 3] * 0.384 + [6 3] * 0.096 + [8 1] * 0.008
 P(0.2) = [0.512 0] + [1.152 1.152] + [0.576 0.288] + [0.064 0.008]
 P(0.2) = [2.304 1.448]
 At t are 0, 0.2, 0.5, 0.7, 1 Substitute in P(t) = [1 0](1-t)3 + [3 3]3t(1-t)2 + [6 3]3t2(1-t) + [8 1]t3

 For t = 0.5:

P(0.5) = [1 0](1-0.5)3 + [3 3]3(0.5)(1-0.5)2 + [6 3]3(0.5)2(1-0.5) + [8 1](0.5)3


P(0.5) = [1 0](0.5)3 + [3 3]3(0.5)(0.5)2 + [6 3]3(0.5)2(0.5) + [8 1](0.5)3
P(0.5) = [1 0] x 0.125 + [3 3] x 3 x 0.5 x 0.25 + [6 3] x 3 x 0.25 x 0.5 + [8 1] x 0.125
P(0.5) = [1 0] x 0.125 + [3 3] x 0.375 + [6 3] x 0.375 + [8 1] x 0.125
P(0.5) = [0.125 0] + [1.125 1.125] + [2.25 1.125] + [1 0.125]
 For t = 0.7:
P(0.5) = [4.5 2.375]
P(t) = [1 0](1-t)3 + [3 3]3t(1-t)2 + [6 3]3t2(1-t) + [8 1]t3
P(0.7) = [1 0](1-0.7)3 + [3 3]3(0.7)(1-0.7)2 + [6 3]3(0.7)2(1-0.7) + [8 1](0.7)3
P(0.7) = [1 0](0.3)3 + [3 3]3(0.7)(0.3)2 + [6 3]3(0.7)2(0.3) + [8 1](0.7)3
 For t = 1:
P(0.7) = [1 0] x 0.027 + [3 3] x 3 x 0.7 x 0.09 + [6 3] x 3 x 0.49 x 0.3 + [8 1] x 0.343
P(1) = [1 0](1-1)3 + [3 3]3(1)(1-1)2 + [6 3]3(1)2(1-1) + [8 1](1)3
P(0.7) = [1 0] x 0.027 + [3 3] x 0.189 + [6 3] x 0.441 + [8 1] x 0.343
P(1) = [1 0] x 0 + [3 3] x 3 x 1 x 0 + [6 3] x 3 x 1 x 0 + [8 1] x 1
P(0.7) = [0.027 0] + [0.567 0.567] + [2.646 1.323] + [2.744 0.343]
P(1) = 0 + 0 + 0 + [8 1]
P(0.7) = [5.984 2.233]
P(1)=[8 1]
 Sketch Curve Using P(0)=[1,0], P(0.2)=[2.304 1.448] , P(0.5)=[4.5 2.375] , P(0.7)=[5.984 2.233]
, P(1)=[8,1]

You might also like