Bezier Curves: CS 319 Advanced Topics in Computer Graphics John C. Hart
Bezier Curves: CS 319 Advanced Topics in Computer Graphics John C. Hart
Bezier Curves: CS 319 Advanced Topics in Computer Graphics John C. Hart
CS 319
Advanced Topics in Computer Graphics
John C. Hart
Bezier Curves
p
0
= x
0
,y
0
p
1
= x
1
,y
1
p
2
= x
2
,y
2
p
3
= x
3
,y
3
p(t) = (1-t)
3
p
0
+ 3(1-t)
2
tp
1
+ 3(1-t)t
2
p
2
+ t
3
p
3
x(t) = (1-t)
3
x
0
+ 3(1-t)
2
tx
1
+ 3(1-t)t
2
x
2
+ t
3
x
3
y(t) = (1-t)
3
y
0
+ 3(1-t)
2
ty
1
+ 3(1-t)t
2
y
2
+ t
3
y
3
coordinate
system
dependent!
p(t) = S
i=0..3
B
i
(t) p
i
B
i
(t) = (
3
i
) t
i
(1-t)
3-i
Any Degree
Bezier curves not necessarily cubic
Can be formulated for any degree
Desired degree = desired curve wiggles + 1 =
control points 1
Examples:
Degree 2 (quadratic): 3 CPs, 1 wiggle
Degree 3 (cubic): 4 CPs, 2 wiggles
Degree 4 (quartic): 5 CPs, 3 wiggles
Questions:
How can we add more control points to a
given Bezier curve?
How can we subdivide a Bezier curve into
two Bezier curve pieces?
Bernstein Polynomials
Defined for any degree
B
i
n
(t) = (
n
i
) t
i
(1-t)
n-i
n choose i
(
n
i
) = n!/(i!(n i)!) = (
n
i
- 1
) + (
n
i
-
-
1
1
)
Partition of unity
Sum to one for any t in [0,1]
S
i=0..n
B
i
n
(t) = 1
Higher degrees lerps of lower degrees
B
i
n
(t) = (
n
i
) t
i
(1-t)
n-i
= (
n
i
- 1
) t
i
(1-t)
n-i
+ (
n
i
-
-
1
1
) t
i
(1-t)
n-i
= (1-t)B
i
n-1
(t) + tB
i
n
-
-
1
1
(t)
B
0
3
(t)
B
1
3
(t) B
2
3
(t)
B
3
3
(t)
0 1/3 2/3 1
0
1
a
b
c
d
p(t)=aB
0
3
(t)+bB
1
3
(t)+cB
2
3
(t)+dB
3
3
(t
)
(1 2 3 i) (1 2 3 n-i)
( )=
n
i
1 2 3 n-2 n-1 n n!
i! (n-i)!
(1 2 3 i) (1 2 3 n-i)
( )=
n
i
1 2 3 n-2 n-1 n
(1 2 3 i)
( )=
n
i
1 2 3 i
(1 2 3 n-i)
n-2 n-1 n i+1
( )=
n
i
i+1 n-2 n-1
1 2 3 n-i
-i + i
1 2 3 n-i
i+1 n-2 n-1 n
-1
( )=
n
i
( ) +
n-1
i
( )
n-1
i-1
Building Bernsteins
B
i
n
(t) = (1-t)B
i
n-1
(t) + tB
i
n
-
-
1
1
(t)
= +
=
B
0
2
(t) = (1-t) B
0
1
(t)
=
B
1
2
(t) = (1-t) B
1
1
(t) + t B
0
1
(t)
B
2
2
(t) = t B
1
1
(t)
Bezier Properties
Affine invariance
Barycentric combination
Control points form convex hull
Bernstein basis in [0,1]
Endpoint interpolation
B
0
n
(0) = 1; B
n
n
(1) = 1
Symmetry
B
i
n
(t) = B
n
n
- i
(1 t)
Derivatives
B
i
n
(t) = n(B
i
n
-
-
1
1
(t) B
i
n-1
(t))
p
0
p
1
p
3
p
2
B
0
3
(t)
B
1
3
(t) B
2
3
(t)
B
3
3
(t)
de Casteljau
Algorithm
Cascading lerps
p
01
= (1-t) p
0
+ t p
1
p
12
= (1-t) p
1
+ t p
2
p
23
= (1-t) p
2
+ t p
3
p
012
= (1-t) p
01
+ t p
12
p
123
= (1-t) p
12
+ t p
23
p
0123
= (1-t) p
012
+ t p
123
Subdivides curve at p
0123
p
0
p
01
p
012
p
0123
p
0123
p
123
p
23
p
3
Repeated subdivision converges to
curve
coordinate
free!
p
0
p
1
p
3
p
2
p
01
p
12
p
23
p
012
p
123
p
0123
t
1-t
Degree Elevation
Used to add more control
over a curve
Start with
S p
i
(
n
i
) t
i
(1-t)
n-i
= S q
i
(
n
i
+ 1
) t
i
(1-t)
n+1-i
Now figure out the q
i
(t+(1-t)) S p
i
(
n
i
) t
i
(1-t)
n-i
= S p
i
(
n
i
) (t
i
(1-t)
n+1-i
+ t
i+1
(1-t)
n-i
)
Compare coefficients
q
i
(
n
i
+ 1
) = p
i
(
n
i
) + p
i-1
(
n
i-1
)
q
i
= (i/(n+1))p
i-1
+ (n+1-i/(n+1))p
i
Repeated elevation converges to curve
p
0
=q
0
p
1
p
3
=q
4
p
2
q
1
q
2
q
3
3/4
1/4
1/4
3/4
1/2
1/2
Blossoms
Defines a polar form f() for a
polynomial F(t)
Number of blossom parameters =
degree of polynomial (n)
Symmetric
f(t
1
,t
2
,t
3
) = f(t
2
,t
1
,t
3
) = f(t
3
,t
2
,t
1
)
Multiaffine
f(,S a
i
t
i
,) = S a
i
f(, t
i
,)
Evaluation by diagonalization
F(t) = f(t,t,,t)
F
(q)
(t) = n!/(n-q)! f(t,t,,t,1,,1)
q
Bezier Blossoming
f(0,0,0)
f(0,0,t)
f(0,0,1)
f(0,t,1)
f(0,1,1)
f(t,1,1)
f(1,1,1)
f(t,t,1)
f(0,t,t)
f(t,t,t)
p(t) = f(t,t,t)
p(t) = f(t,t,t) = (1-t) f(t,t,0) + t f(t,t,1)
= (1-t)[(1-t) f(t,0,0) + t f(t,0,1)] + t [(1-t) f(t,0,1) + t f(t,1,1)]
= (1-t)
2
f(t,0,0) + 2 (1-t) t f(t,0,1) + t
2
f(t,1,1)
= (1-t)
3
f(0,0,0) + 3 (1-t)
2
t f(0,0,1) + 3 (1-t) t
2
f(0,1,1) + t
3
f(1,1,1)
Systolic Array
f(0,0,0) f(0,0,1) f(0,1,1) f(1,1,1)
f(0,0,t) f(0,t,1) f(t,1,1)
f(0,t,t) f(t,t,1)
f(t,t,t)
(1-t) t (1-t) t (1-t) t
(1-t) t (1-t) t
(1-t) t