The Bernstein Basis and Bezier Curves
description
Transcript of The Bernstein Basis and Bezier Curves
1
Dr. Scott Schaefer
The Bernstein Basis and Bezier Curves
2/108
Problems with Interpolation
3/108
Problems with Interpolation
4/108
Bezier Curves
Polynomial curves that seek to approximate rather than to interpolate
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
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
7/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
… Degree n: for iin tt
in
)1( ni 0
8/108
Properties of Bernstein Polynomials
iinni tt
in
tB
)1()(
]1,0[0)(1 ttBni
9/108
Properties of Bernstein Polynomials
iinni tt
in
tB
)1()(
]1,0[0)(1 ttBni
0)1(1 t01 t
10/108
Properties of Bernstein Polynomials
iinni tt
in
tB
)1()(
1)(0
n
i
ni tB
]1,0[0)(1 ttBni
11/108
Properties of Bernstein Polynomials
iinni tt
in
tB
)1()(
]1,0[0)(1 ttBni
1)(0
n
i
ni tB
Binomial Theorem: iinn
i
n bain
ba
0
)(
12/108
Properties of Bernstein Polynomials
iinni tt
in
tB
)1()(
]1,0[0)(1 ttBni
1)(0
n
i
ni tB
Binomial Theorem: iinn
i
n bain
ba
0
)(
iinn
i
n
i
ni tt
in
tB
)1()(
00
13/108
Properties of Bernstein Polynomials
iinni tt
in
tB
)1()(
]1,0[0)(1 ttBni
1)(0
n
i
ni tB
Binomial Theorem: iinn
i
n bain
ba
0
)(
nn
i
ni tttB
)1()(0
14/108
Properties of Bernstein Polynomials
iinni tt
in
tB
)1()(
]1,0[0)(1 ttBni
1)(0
n
i
ni tB
Binomial Theorem: iinn
i
n bain
ba
0
)(
1)(0
n
i
ni tB
15/108
Properties of Bernstein Polynomials
iinni tt
in
tB
)1()(
1)(0
n
i
ni tB
]1,0[0)(1 ttBni
)()(max]1,0[ n
ini
nit
BtB
16/108
Properties of Bernstein Polynomials
iinni tt
in
tB
)1()(
1)(0
n
i
ni tB
]1,0[0)(1 ttBni
)()(max]1,0[ n
ini
nit
BtB
0)1)(()1( 11)(
iiniin
ttB ttintti
inn
i
17/108
Properties of Bernstein Polynomials
iinni tt
in
tB
)1()(
1)(0
n
i
ni tB
]1,0[0)(1 ttBni
)()(max]1,0[ n
ini
nit
BtB
0)1)(( 11)(
iin
ttB ttnti
inn
i
18/108
Properties of Bernstein Polynomials
iinni tt
in
tB
)1()(
1)(0
n
i
ni tB
]1,0[0)(1 ttBni
)()(max]1,0[ n
ini
nit
BtB
nit
19/108
More Properties of Bernstein Polynomials )()()1()( 1
11 ttBtBttB n
ini
ni
20/108
More Properties of Bernstein Polynomials
)()()1()( 11
1 ttBtBttB ni
ni
ni
n
i
ni
jn
ji
j tBt0
)(
21/108
More Properties of Bernstein Polynomials
)()()1()( 11
1 ttBtBttB ni
ni
ni
n
i
ni
jn
ji
j tBt0
)(
n
j
jijni t
ij
jn
tB0
)1()(
22/108
More Properties of Bernstein Polynomials
)()()1()( 11
1 ttBtBttB ni
ni
ni
n
i
ni
jn
ji
j tBt0
)(
n
j
jijni t
ij
jn
tB0
)1()(
11)(
1
0 n
dttBni
23/108
Properties of Bernstein Polynomials
]1,0[1)(0 ttBni
24/108
Properties of Bernstein Polynomials
Base case:
]1,0[1)(0 ttBni
1)(01 1 tBn i
25/108
Properties of Bernstein Polynomials
Base case:
]1,0[1)(0 ttBni
1)(01 1 tBn i
101)1(0 tt
26/108
Properties of Bernstein Polynomials
Base case:
Inductive Step: Assume
]1,0[1)(0 ttBni
1)(01 1 tBn i
101)1(0 tt
]1,0[1)(0 1 ttBni
27/108
Properties of Bernstein Polynomials
Base case:
Inductive Step: Assume
]1,0[1)(0 ttBni
1)(01 1 tBn i
101)1(0 tt
]1,0[1)(0 1 ttBni
)()()1()( 11
1 ttBtBttB ni
ni
ni
28/108
Properties of Bernstein Polynomials
Base case:
Inductive Step: Assume
]1,0[1)(0 ttBni
1)(01 1 tBn i
101)1(0 tt
]1,0[1)(0 1 ttBni
)()()1()( 11
1 ttBtBttB ni
ni
ni
1)()()1(0 11
1
ttBtBt ni
ni
29/108
Properties of Bernstein Polynomials
Base case:
Inductive Step: Assume
]1,0[1)(0 ttBni
1)(01 1 tBn i
101)1(0 tt
]1,0[1)(0 1 ttBni
)()()1()( 11
1 ttBtBttB ni
ni
ni
1)()()1(0 11
1
ttBtBt ni
ni
1)(0 tBni
30/108
Bezier Curves
n
ii
iin pttin
tp0
)1()(
31/108
Bezier Curves
n
ii
iin pttin
tp0
)1()(
)1,0()1,1()1(3)0,1()1(3)0,0()1()( 3223 tttttttp
32/108
Bezier Curves
n
ii
iin pttin
tp0
)1()(
))23(,)1(3()( 2tttttp
33/108
Bezier Curve Properties
Interpolate end-points
n
ii
iin pttin
tp0
)1()(
34/108
Bezier Curve Properties
Interpolate end-points
00
0)01()0( ppin
pn
ii
iin
35/108
Bezier Curve Properties
Interpolate end-points
n
n
ii
iin ppin
p
0
1)11()1(
36/108
Bezier Curve Properties
Interpolate end-points
n
n
ii
iin ppin
p
0
1)11()1(
37/108
Bezier Curve Properties
Interpolate end-points Tangent at end-points in direction of first/last
edge
n
ii
iin pttin
tp0
)1()(
38/108
Bezier Curve Properties
Interpolate end-points Tangent at end-points in direction of first/last
edge
n
i
iiniini
n
ii
iin ttinttipin
pttin
tttp
0
11
0
)1)(()1()1()(
39/108
Bezier Curve Properties
Interpolate end-points Tangent at end-points in direction of first/last
edge
n
i
iiniini
n
ii
iin ttinttipin
pttin
tttp
0
11
0
)1)(()1()1()(
1
0
1
1
1 )1)(()1()( n
i
iini
n
i
iini ttinp
in
ttipin
ttp
40/108
Bezier Curve Properties
Interpolate end-points Tangent at end-points in direction of first/last
edge
n
i
iiniini
n
ii
iin ttinttipin
pttin
tttp
0
11
0
)1)(()1()1()(
1
0
1
1
1 )1)(()1()( n
i
iini
n
i
iini ttinp
in
ttipin
ttp
1
0
1
1
11 )()()( n
i
nii
n
i
nii tBpntBpn
ttp
41/108
Bezier Curve Properties
Interpolate end-points Tangent at end-points in direction of first/last
edge
n
i
iiniini
n
ii
iin ttinttipin
pttin
tttp
0
11
0
)1)(()1()1()(
1
0
1
1
1 )1)(()1()( n
i
iini
n
i
iini ttinp
in
ttipin
ttp
1
0
11
1
0
11
0
11 )()()()()( n
i
niii
n
i
nii
n
i
nii tBppntBpntBpn
ttp
1
0
1
1
11 )()()( n
i
nii
n
i
nii tBpntBpn
ttp
42/108
Bezier Curve Properties
Interpolate end-points Tangent at end-points in direction of first/last
edge
n
i
iiniini
n
ii
iin ttinttipin
pttin
tttp
0
11
0
)1)(()1()1()(
1
0
1
1
1 )1)(()1()( n
i
iini
n
i
iini ttinp
in
ttipin
ttp
Another Bezier curve of vectors!!!
1
0
11
1
0
11
0
11 )()()()()( n
i
niii
n
i
nii
n
i
nii tBppntBpntBpn
ttp
1
0
1
1
11 )()()( n
i
nii
n
i
nii tBpntBpn
ttp
43/108
Bezier Curve Properties
Interpolate end-points Tangent at end-points in direction of first/last
edge
)()0(01 ppn
tp
)()1(1
nn ppnt
p
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
45/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
46/108
Matrix Form of Bezier Curves
n
ii
ni ptBtp
0
)()(
47/108
Matrix Form of Bezier Curves
n
ii
ni ptBtp
0
)()(
)(
)()(
0
0
tB
tBpptp
nn
n
n
48/108
Matrix Form of Bezier Curves
n
ii
ni ptBtp
0
)()(
nnnn
n
n
tmm
mmpptp
1)(
0
000
0
ij
jn
m ijij )1(
49/108
Matrix Form of Bezier Curves
n
ii
ni ptBtp
0
)()(
nnnn
n
n
tmm
mmpptp
1)(
0
000
0
10003300
36301331
M
50/108
Matrix Form of Bezier Curves
n
ii
ni ptBtp
0
)()(
nnnn
n
n
tmm
mmpptp
1)(
0
000
0
10003300
36301331
M
Computation in monomial basis is unstable!!!
Most proofs/computations are easier in Bernstein basis!!!
51/108
Change of Basis
111n
0p 1p 2p 3p
111 n
111 n
111n
111 n
111n
221 n
221n
221 n
221n
331 n
331n
Bezier coefficients
52/108
Change of Basis
111n
0p 1p 2p 3p
111 n
111 n
111n
111 n
111n
221 n
221n
221 n
221n
331 n
331n
Coefficients in monomial basis!!!
jjn 1
Bezier coefficients
53/108
Change of Basis
n
ii
ni
n
ii
i ptBat00
)(
54/108
Change of Basis
n
ii
ni
n
ii
i ptBat00
)(
10
000
01
0
11
nnnn
n
nn
n
tmm
mmpp
taa
55/108
Change of Basis
n
ii
ni
n
ii
i ptBat00
)(
nnn
n
nn
mm
mmppaa
0
000
00
56/108
Change of Basis
n
ii
ni
n
ii
i ptBat00
)(
n
nnn
n
n ppmm
mmaa
0
1
0
000
0
57/108
Change of Basis
111n
0a 1a 2a 3a
1 1 1
1 1
1
monomial coefficients
111n
212n
212n 31
3n
111n
58/108
Change of Basis
111n1 1 21
2n 1 31
3n
1 1
1
monomial coefficients
111n
111n
212n
Coefficients in Bezier basis!!!
jnj1
0a 1a 2a 3a
59/108
Degree Elevation
Power basis is trivial: add 0 tn+1
What about Bezier basis?
1
0
1
0
)(ˆ)(n
j
njj
n
i
nii tBptBp
60/108
Degree Elevation
1
0
1
0
)(ˆ)(n
j
njj
n
i
nii tBptBp
n
i
niii
n
i
nii tBptpttBp
00
)())1(()(
61/108
Degree Elevation
1
0
1
0
)(ˆ)(n
j
njj
n
i
nii tBptBp
n
i
niii
n
i
nii tBptpttBp
00
)())1(()(
n
i
nin
ii
n
i
nin
ini tBptBp
0
111
1
0
11
1 )()(
62/108
Degree Elevation
1
0
1
0
)(ˆ)(n
j
njj
n
i
nii tBptBp
n
i
niii
n
i
nii tBptpttBp
00
)())1(()(
n
i
nin
ii
n
i
nin
ini tBptBp
0
111
1
0
11
1 )()(
1
0
111
1
0
11
1 )()(n
i
nin
ii
n
i
nin
ini tBptBp
63/108
Degree Elevation
1
0
1
0
)(ˆ)(n
j
njj
n
i
nii tBptBp
n
i
niii
n
i
nii tBptpttBp
00
)())1(()(
n
i
nin
ii
n
i
nin
ini tBptBp
0
111
1
0
11
1 )()(
1
0
111
1
0
11
1 )()(n
i
nin
ii
n
i
nin
ini tBptBp
1
0
1111 )(1
n
i
nin
iin
ii tBpp
64/108
Degree Elevation
65/108
Degree Elevation
1
66/108
Degree Elevation
41
43
67/108
Degree Elevation
21
21
68/108
Degree Elevation
41
43
69/108
Degree Elevation
1
70/108
Degree Elevation
71/108
Pyramid Algorithms for Bezier Curves Polynomials aren’t pretty Is there an easier way to evaluate the
equation of a Bezier curve?
n
ii
iin pttin
tp0
)1()(
72/108
Pyramid Algorithms forBezier Curves
0p 1p 2p 3p
21)1( ptpt 10)1( ptpt 32)1( ptpt
t1 t1 t1t tt
73/108
Pyramid Algorithms forBezier Curves
0p 1p 2p 3p
22
102 )1(2)1( ptpttpt
t1 t1 t1t tt
t1 t t1 t
32
212 )1(2)1( ptpttpt
74/108
Pyramid Algorithms forBezier Curves
0p 1p 2p 3p
t1 t1 t1t tt
t1 t t1 t
33
22
12
03 )1(3)1(3)1( ptpttpttpt
t1 t
75/108
Pyramid Algorithms forDerivatives of Bezier Curves
0p 1p 2p 3p
1 1 11 11
t1 t t1 t
)(' tp
t1 tTake derivative of any level of pyramid!!!(up to constant multiple)
76/108
Pyramid Algorithms forDerivatives of Bezier Curves
0p 1p 2p 3p
t1 t t1 t
)(' tp
1 1Take derivative of any level of pyramid!!!(up to constant multiple)
t1 t1 t1t tt
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
Given a single Bezier curve, construct two smaller Bezier curves whose union is exactly the original curve
82/108
Subdividing Bezier Curves
0p 1p 2p 3p
t1 t1 t1t tt
t1 t t1 t
t1 tControl points for left curve!!!
83/108
Subdividing Bezier Curves
0p 1p 2p 3p
t1 t1 t1t tt
t1 t t1 t
t1 t Control points for right curve!!!
84/108
Subdividing Bezier Curves
0p 1p 2p 3p
21
21
21
21
21
21
21
21
21
21
21
21
121
021 pp 22
112
1 pp 321
221 pp
241
121
041 ppp 34
122
114
1 ppp
381
283
183
081 pppp
85/108
Variation Diminishing
Intuitively means that the curve “wiggles” no more than its control polygon
86/108
Variation Diminishing
Intuitively means that the curve “wiggles” no more than its control polygon
Lagrange Interpolation
87/108
Variation Diminishing
Intuitively means that the curve “wiggles” no more than its control polygon
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
Bezier Curve
93/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
94/108
Applications: Intersection
Given two Bezier curves, determine if and where they intersect
95/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
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
Applications: Intersection
107/108
Application: Font Rendering
108/108
Application: Font Rendering