You are on page 1of 108

The Bernstein Basis

and Bezier Curves

Dr. Scott Schaefer

1
Problems with Interpolation

2/108
Problems with Interpolation

3/108
Bezier Curves
 Polynomial curves that seek to approximate
rather than to interpolate

4/108
Bernstein Polynomials
 Degree 1: (1-t), t
 Degree 2: (1-t)2, 2(1-t)t, t2
 Degree 3: (1-t)3, 3(1-t)2t, 3(1-t)t2, t3

5/108
Bernstein Polynomials
 Degree 1: (1-t), t
 Degree 2: (1-t)2, 2(1-t)t, t2
 Degree 3: (1-t)3, 3(1-t)2t, 3(1-t)t2, t3
 Degree 4: (1-t)4, 4(1-t)3t, 6(1-t)2t2, 4(1-t)t3,t4

6/108
Bernstein Polynomials
 Degree 1: (1-t), t
 Degree 2: (1-t)2, 2(1-t)t, t2
 Degree 3: (1-t)3, 3(1-t)2t, 3(1-t)t2, t3
 Degree 4: (1-t)4, 4(1-t)3t, 6(1-t)2t2, 4(1-t)t3,t4
 Degree 5: (1-t)5, 5(1-t)4t, 10(1-t)3t2, 10(1-t)2t3
,5(1-t)t4,t5
…
n n i i
 Degree n:    (1  t ) t for 0  i  n
  i

7/108
Properties of Bernstein Polynomials
n
B (t )   (1  t ) n i t i
i
n

i

 1  Bi (t )  0
n
t  [0,1]

8/108
Properties of Bernstein Polynomials
n
B (t )   (1  t ) n i t i
i
n

i

 1  Bi (t )  0
n
t  [0,1] 1 t  0
1  (1  t )  0

9/108
Properties of Bernstein Polynomials
n
B (t )   (1  t ) n i t i
i
n

i

 1  Bi (t )  0
n
t  [0,1]
n
  i (t )  1
n
B
i 0

10/108
Properties of Bernstein Polynomials
n
B (t )   (1  t ) n i t i
i
n

i

 1  Bi (t )  0
n
t  [0,1]
n
  i (t )  1
n
B
i 0
 n  n i i
n
Binomial Theorem: (a  b)    a b
n

i 0  i 

11/108
Properties of Bernstein Polynomials
n
B (t )   (1  t ) n i t i
i
n

i

 1  Bi (t )  0
n
t  [0,1]
n
  i (t )  1
n
B
i 0
 n  n i i
n
Binomial Theorem: (a  b)    a b
n

i 0  i 
n n
n

i 0
Bi
n
(t )   
i
i 0  
(1  t ) n i i
t

12/108
Properties of Bernstein Polynomials
n
B (t )   (1  t ) n i t i
i
n

i

 1  Bi (t )  0
n
t  [0,1]
n
  i (t )  1
n
B
i 0
 n  n i i
n
Binomial Theorem: (a  b)    a b
n

i 0  i 

 i (t )  (1  t )  t 
n n
B
i 0

13/108
Properties of Bernstein Polynomials
n
B (t )   (1  t ) n i t i
i
n

i

 1  Bi (t )  0
n
t  [0,1]
n
  i (t )  1
n
B
i 0
 n  n i i
n
Binomial Theorem: (a  b)    a b
n

i 0  i 

 i (t )  1
B n

i 0

14/108
Properties of Bernstein Polynomials
n
B (t )   (1  t ) n i t i
i
n

i

 1  Bi (t )  0
n
t  [0,1]
n
  i (t )  1
n
B
i 0

 max Bi
n
(t )  B n i
i (n)
t[ 0,1]

15/108
Properties of Bernstein Polynomials
n
B (t )   (1  t ) n i t i
i
n

i

 1  Bi (t )  0
n
t  [0,1]
n
  i (t )  1
n
B
i 0

 max Bi
n
(t )  B n i
i (n)
t[ 0,1]

 n
Bin ( t )
t  
   i(1  t ) n i t i 1  (n  i)(1  t ) ni 1 t i  0
i

16/108
Properties of Bernstein Polynomials
n
B (t )   (1  t ) n i t i
i
n

i

 1  Bi (t )  0
n
t  [0,1]
n
  i (t )  1
n
B
i 0

 max Bi
n
(t )  B n i
i (n)
t[ 0,1]

Bin ( t )  n
t   (i  nt )(1  t ) n i 1 t i 1  0
i

17/108
Properties of Bernstein Polynomials
n
B (t )   (1  t ) n i t i
i
n

i

 1  Bi (t )  0
n
t  [0,1]
n
  i (t )  1
n
B
i 0

 max Bi
n
(t )  B n i
i (n)
t[ 0,1]

t i
n

18/108
More Properties of
Bernstein Polynomials
n 1 n 1
 i
B n
(t )  (1  t ) Bi (t )  tBi 1 (t )

19/108
More Properties of
Bernstein Polynomials
n 1 n 1
 i
B n
(t )  (1  t ) Bi (t )  tBi 1 (t )

n  i  
 
 t j
   j
  j  n B n
i (t )
i 0
  

20/108
More Properties of
Bernstein Polynomials
n 1 n 1
 i
B n
(t )  (1  t ) Bi (t )  tBi 1 (t )

n   i  
 
 t j
   j
  j  n B n
i (t )
i 0
  
j i  n  j  j
n
 Bi (t )   (1)   t
n

j 0  j  i 

21/108
More Properties of
Bernstein Polynomials
n 1 n 1
 i
B n
(t )  (1  t ) Bi (t )  tBi 1 (t )

  i  
n
 
 t j
   j
  j  n B n
i (t )
i 0
  
j i  n  j  j
n
 Bi (t )   (1)   t
n

j 0  j  i 
1
1
  B (t )dt 
n

n 1
i
0

22/108
Properties of Bernstein Polynomials
0  Bin (t )  1 t  [0,1]

23/108
Properties of Bernstein Polynomials
0  Bin (t )  1 t  [0,1]

 Base case: n  1 0  Bi1 (t )  1

24/108
Properties of Bernstein Polynomials
0  Bin (t )  1 t  [0,1]

 Base case: n  1 0  Bi (t )  1
1

0  (1  t )  1 0  t 1

25/108
Properties of Bernstein Polynomials
0  Bin (t )  1 t  [0,1]

 Base case: n  1 0  Bi (t )  1
1

0  (1  t )  1 0  t 1

 Inductive Step: Assume 0  Bin1 (t )  1 t  [0,1]

26/108
Properties of Bernstein Polynomials
0  Bin (t )  1 t  [0,1]

 Base case: n  1 0  Bi (t )  1
1

0  (1  t )  1 0  t 1

 Inductive Step: Assume 0  Bin1 (t )  1 t  [0,1]


Bin (t )  (1  t ) Bin 1 (t )  tBin11 (t )

27/108
Properties of Bernstein Polynomials
0  Bin (t )  1 t  [0,1]

 Base case: n  1 0  Bi (t )  1
1

0  (1  t )  1 0  t 1

 Inductive Step: Assume 0  Bin1 (t )  1 t  [0,1]


Bin (t )  (1  t ) Bin 1 (t )  tBin11 (t )
0  (1  t ) Bin 1 (t )  tBin11 (t )  1

28/108
Properties of Bernstein Polynomials
0  Bin (t )  1 t  [0,1]

 Base case: n  1 0  Bi (t )  1
1

0  (1  t )  1 0  t 1

 Inductive Step: Assume 0  Bin1 (t )  1 t  [0,1]


Bin (t )  (1  t ) Bin 1 (t )  tBin11 (t )
0  (1  t ) Bin 1 (t )  tBin11 (t )  1

0  Bin (t )  1

29/108
Bezier Curves
n
n
p(t )    (1  t ) ni t i pi
i 0  i 

30/108
Bezier Curves
n
n
p(t )    (1  t ) ni t i pi
i 0  i 

p(t )  (1  t )3 (0,0)  3(1  t ) 2 t (1,0)  3(1  t )t 2 (1,1)  t 3 (0,1)

31/108
Bezier Curves
n
n
p(t )    (1  t ) ni t i pi
i 0  i 

p(t )  (3(1  t )t , (3  2t )t 2 )

32/108
Bezier Curve Properties
 Interpolate end-points
n
n
p(t )    (1  t ) ni t i pi
i 0  i 

33/108
Bezier Curve Properties
 Interpolate end-points
n
 n
p(0)    (1  0) n i 0i pi  p0
i 0  i 

34/108
Bezier Curve Properties
 Interpolate end-points
n
n
p(1)    (1  1) n i 1i pi  pn
i 0  i 

35/108
Bezier Curve Properties
 Interpolate end-points
n
n
p(1)    (1  1) n i 1i pi  pn
i 0  i 

36/108
Bezier Curve Properties
 Interpolate end-points
 Tangent at end-points in direction of first/last
edge
n
n
p(t )    (1  t ) ni t i pi
i 0  i 

37/108
Bezier Curve Properties
 Interpolate end-points
 Tangent at end-points in direction of first/last
edge
p(t )  n  n  n
 
n
   (1  t ) t pi     pi i(1  t ) n i t i 1  (n  i )(1  t ) n i 1 t i
n i i

t t i 0  i  i 0  i 

38/108
Bezier Curve Properties
 Interpolate end-points
 Tangent at end-points in direction of first/last
edge
p(t )  n  n  n
 
n
   (1  t ) t pi     pi i(1  t ) n i t i 1  (n  i )(1  t ) n i 1 t i
n i i

t t i 0  i  i 0  i 

p(t ) n  n   
   
n 1 n
    pi i(1  t ) t     pi (n  i )(1  t ) n i 1 t i
n i i 1

t i 1  i  i 0  i 

39/108
Bezier Curve Properties
 Interpolate end-points
 Tangent at end-points in direction of first/last
edge
p(t )  n  n  n
 
n
   (1  t ) t pi     pi i(1  t ) n i t i 1  (n  i )(1  t ) n i 1 t i
n i i

t t i 0  i  i 0  i 

p(t ) n  n   
   
n 1 n
    pi i(1  t ) t     pi (n  i )(1  t ) n i 1 t i
n i i 1

t i 1  i  i 0  i 

p (t ) n n1
  n pi Bin11 (t )   n pi Bin1 (t )
t i1 i0

40/108
Bezier Curve Properties
 Interpolate end-points
 Tangent at end-points in direction of first/last
edge
p(t )  n  n  n
 
n
   (1  t ) t pi     pi i(1  t ) n i t i 1  (n  i )(1  t ) n i 1 t i
n i i

t t i 0  i  i 0  i 

p(t ) n  n   
   
n 1 n
    pi i(1  t ) t     pi (n  i )(1  t ) n i 1 t i
n i i 1

t i 1  i  i 0  i 

p (t ) n n1
  n pi Bin11 (t )   n pi Bin1 (t )
t i1 i0

p(t ) n1 n1 n1


  n pi1 Bin1 (t )   n pi Bin1 (t )   n( pi1  pi ) Bin1 (t )
t i0 i0 i0 41/108
Bezier Curve Properties
 Interpolate end-points
 Tangent at end-points in direction of first/last
edge
p(t )  n  n  n
 
n
   (1  t ) t pi     pi i(1  t ) n i t i 1  (n  i )(1  t ) n i 1 t i
n i i

t t i 0  i  i 0  i 

p(t ) n  n   
   
n 1 n
    pi i(1  t ) t     pi (n  i )(1  t ) n i 1 t i
n i i 1

t i 1  i  i 0  i 

p (t ) n n1 Another Bezier curve of vectors!!!


  n pi Bi1 (t )   n pi Bi (t )
n1 n1

t i1 i0

p(t ) n1 n1 n1


  n pi1 Bin1 (t )   n pi Bin1 (t )   n( pi1  pi ) Bin1 (t )
t i0 i0 i0 42/108
Bezier Curve Properties
 Interpolate end-points
 Tangent at end-points in direction of first/last
edge
p (0)
 n( p1  p0 )
t
p (1)
 n( pn  pn 1 )
t

43/108
Bezier Curve Properties
 Interpolate end-points
 Tangent at end-points in direction of first/last
edge
 Curve lies within the convex hull of the
control points

44/108
Bezier Curve Properties
 Interpolate end-points
 Tangent at end-points in direction of first/last
edge
 Curve lies within the convex hull of the
control points Bezier Lagrange

45/108
Matrix Form of Bezier Curves
n
p (t )   Bin (t ) pi
i 0

46/108
Matrix Form of Bezier Curves
n
p (t )   Bin (t ) pi
i 0

 B0n (t ) 
 
p (t )   p0  pn   
 B n (t ) 
 n 

47/108
Matrix Form of Bezier Curves
n
p (t )   Bin (t ) pi
i 0

 m00  m0 n  1 
  
p(t )   p0  pn       
m   t n 
 n0 mnn  

 n  j 
j i
mij  (1)   
 j  i 

48/108
Matrix Form of Bezier Curves
n
p (t )   Bin (t ) pi
i 0

 m00  m0 n  1 
  
p(t )   p0  pn       
m   t n 
 n0 mnn  
 1  3 3 1
 
0 3  6 3 
M 
0 0 3  3
 
0 0 
 0 1 

49/108
Matrix Form of Bezier Curves
n
p (t )   Bin (t ) pi
i 0

 m00  m0 n  1 
  
p(t )   p0  pn       
m   t n 
 n0 mnn  
Computation in monomial
basis is unstable!!! 1  3 3 1
 
0 3  6 3 
M  
Most proofs/computations  0 0 3  3

0 0 
are easier in Bernstein  0 1 
basis!!!
50/108
Change of Basis

 n 313 n 13
3

 n 1
2
2 n 1 2
2
 n 1
2
2 n 1 2
2

 n 111
n 11
1
 n 111 n 11
1
 n 111 n 11
1

p0 p1 p2 p3

Bezier coefficients
51/108
Change of Basis
Coefficients in
monomial basis!!!
 n 313 n 13
3

n 1 j
j
 n 1
2
2 n 1 2
2
 n 1
2
2 n 1 2
2

 n 111
n 11
1
 n 111 n 11
1
 n 111 n 11
1

p0 p1 p2 p3

Bezier coefficients
52/108
Change of Basis
n n

 i  i (t ) pi
t i

i 0
a  B
i 0
n

53/108
Change of Basis
n n

 i  i (t ) pi
t i

i 0
a  B n

i 0

 1   m00  m0 n  1 
    
a0  a n      p0  p n       
 t n1  m   t n 1 
   n0 mnn  

54/108
Change of Basis
n n

 i  i (t ) pi
t i

i 0
a  B n

i 0

 m00  m0 n 
 
a0  a n    p0  p n     
m  
 n0 mnn 

55/108
Change of Basis
n n

 i  i (t ) pi
t i

i 0
a  B
i 0
n

1
 m00  m0 n 
 
a0  a n        p0  p n 
m  
 n0 mnn 

56/108
Change of Basis

1
1 n 11

1 2
1 n 11 1 n 1 2

1 2 3
1 n 11 1 n 1 2 1 n 13

a0 a1 a2 a3

monomial coefficients
57/108
Change of Basis
Coefficients in Bezier
basis!!!
1
1 n 11

j
n 1 j
1 2
1 n 11 1 n 1 2

1 2 3
1 n 11 1 n 1 2 1 n 13

a0 a1 a2 a3

monomial coefficients
58/108
Degree Elevation
 Power basis is trivial: add 0 tn+1
 What about Bezier basis?
n n 1

 i i
p B
i 0
n
(t )   j j (t )
ˆ
p
j 0
B n 1

59/108
Degree Elevation
n n 1

 i i
p B
i 0
n
(t )   j j (t )
ˆ
p B
j 0
n 1

n n

 i i
p B
i 0
n
(t )   ((1
i 0
 t ) pi  t pi ) B n
i (t )

60/108
Degree Elevation
n n 1

 i i
p B
i 0
n
(t )   j j (t )
ˆ
p B n 1

j 0

n n

 i i
p B
i 0
n
(t )   ((1
i 0
 t ) pi  t pi ) B n
i (t )

n n
  pi n 1i
n 1 Bin 1 (t )   pi i 1
n 1 Bin11 (t )
i 0 i 0

61/108
Degree Elevation
n n 1

 i i
p B
i 0
n
(t )   j j (t )
ˆ
p B n 1

j 0

n n

 i i
p B
i 0
n
(t )   ((1
i 0
 t ) pi  t pi ) B n
i (t )

n n
  pi n 1i
n 1 Bin 1 (t )   pi i 1
n 1 Bin11 (t )
i 0 i 0

n 1 n 1
  pi n 1i
n 1 Bin 1 (t )   pi 1 n i 1 Bin 1 (t )
i 0 i 0

62/108
Degree Elevation
n n 1

 i i
p B
i 0
n
(t )   j j (t )
ˆ
p B n 1

j 0

n n

 i i
p B
i 0
n
(t )   ((1
i 0
 t ) pi  t pi ) B n
i (t )

n n
  pi n 1i
n 1 Bin 1 (t )   pi i 1
n 1 Bin11 (t )
i 0 i 0

n 1 n 1
  pi n 1i
n 1 Bin 1 (t )   pi 1 n i 1 Bin 1 (t )
i 0 i 0
n 1
   pi 1  n i 1   pi 1 n i 1 Bin 1 (t )
i 0
63/108
Degree Elevation

64/108
Degree Elevation

65/108
Degree Elevation

3
4

1
4

66/108
Degree Elevation

1 1
2 2

67/108
Degree Elevation

3
4

1
4

68/108
Degree Elevation

69/108
Degree Elevation

70/108
Pyramid Algorithms for
Bezier Curves
 Polynomials aren’t pretty
 Is there an easier way to evaluate the
equation of a Bezier curve?
n
n
p(t )    (1  t ) ni t i pi
i 0  i 

71/108
Pyramid Algorithms for
Bezier Curves

(1  t ) p0  t p1 (1  t ) p1  t p2 (1  t ) p2  t p3

1 t t 1 t t 1 t t

p0 p1 p2 p3

72/108
Pyramid Algorithms for
Bezier Curves

(1  t ) 2 p0  2(1  t )t p1  t 2 p2 (1  t ) 2 p1  2(1  t )t p2  t 2 p3

1 t t 1 t t

1 t t 1 t t 1 t t

p0 p1 p2 p3

73/108
Pyramid Algorithms for
Bezier Curves
(1  t )3 p0  3(1  t ) 2 t p1  3(1  t )t 2 p2  t 3 p3

1 t t

1 t t 1 t t

1 t t 1 t t 1 t t

p0 p1 p2 p3

74/108
Pyramid Algorithms for
Derivatives of Bezier Curves
p ' (t )

1 t t
Take derivative of any
level of pyramid!!!
1 t t 1 t t (up to constant multiple)

1 1 1 1 1 1

p0 p1 p2 p3

75/108
Pyramid Algorithms for
Derivatives of Bezier Curves
p ' (t )

1 1
Take derivative of any
level of pyramid!!!
1 t t 1 t t (up to constant multiple)

1 t t 1 t t 1 t t

p0 p1 p2 p3

76/108
Subdividing Bezier Curves
 Given a single Bezier curve, construct two
smaller Bezier curves whose union is exactly
the original curve

77/108
Subdividing Bezier Curves
 Given a single Bezier curve, construct two
smaller Bezier curves whose union is exactly
the original curve

78/108
Subdividing Bezier Curves
 Given a single Bezier curve, construct two
smaller Bezier curves whose union is exactly
the original curve

79/108
Subdividing Bezier Curves
 Given a single Bezier curve, construct two
smaller Bezier curves whose union is exactly
the original curve

80/108
Subdividing Bezier Curves
 Given a single Bezier curve, construct two
smaller Bezier curves whose union is exactly
the original curve

81/108
Subdividing Bezier Curves

Control points for 1 t t


left curve!!!

1 t t 1 t t

1 t t 1 t t 1 t t

p0 p1 p2 p3

82/108
Subdividing Bezier Curves

1 t t Control points for


right curve!!!

1 t t 1 t t

1 t t 1 t t 1 t t

p0 p1 p2 p3

83/108
Subdividing Bezier Curves
1
8 p0  3 8 p1  3 8 p2  18 p3
1 1
2 2

1
4 p0  1 2 p1  1 4 p2 1
4 p1  1 2 p2  1 4 p3

1 1 1 1
2 2 2 2

1
2 p0  1 2 p1 1
2 p1  12 p2 1
2 p2  1 2 p3

1 1 1 1 1 1
2 2 2 2 2 2

p0 p1 p2 p3

84/108
Variation Diminishing
 Intuitively means that the curve “wiggles” no
more than its control polygon

85/108
Variation Diminishing
 Intuitively means that the curve “wiggles” no
more than its control polygon

Lagrange Interpolation
86/108
Variation Diminishing
 Intuitively means that the curve “wiggles” no
more than its control polygon

Bezier Curve
87/108
Variation Diminishing
 For any line, the number of intersections with
the control polygon is greater than or equal to
the number of intersections with the curve

Bezier Curve
88/108
Variation Diminishing
 For any line, the number of intersections with
the control polygon is greater than or equal to
the number of intersections with the curve

Bezier Curve
89/108
Variation Diminishing
 For any line, the number of intersections with
the control polygon is greater than or equal to
the number of intersections with the curve

Bezier Curve
90/108
Variation Diminishing
 For any line, the number of intersections with
the control polygon is greater than or equal to
the number of intersections with the curve

Bezier Curve
91/108
Variation Diminishing
 For any line, the number of intersections with
the control polygon is greater than or equal to
the number of intersections with the curve

Bezier Curve
92/108
Variation Diminishing
 For any line, the number of intersections with
the control polygon is greater than or equal to
the number of intersections with the curve

Lagrange Interpolation
93/108
Applications: Intersection
 Given two Bezier curves, determine if and
where they intersect

94/108
Applications: Intersection
 Check if convex hulls intersect
 If not, return no intersection
 If both convex hulls can be approximated
with a straight line, intersect lines and return
intersection
 Otherwise subdivide and recur on subdivided
pieces

95/108
Applications: Intersection

96/108
Applications: Intersection

97/108
Applications: Intersection

98/108
Applications: Intersection

99/108
Applications: Intersection

100/108
Applications: Intersection

101/108
Applications: Intersection

102/108
Applications: Intersection

103/108
Applications: Intersection

104/108
Applications: Intersection

105/108
Applications: Intersection

106/108
Application: Font Rendering

107/108
Application: Font Rendering

108/108

You might also like