Lecture 3: B Ezier Curves: Luca Castelli Aleardi
Lecture 3: B Ezier Curves: Luca Castelli Aleardi
Lecture 3: B Ezier Curves: Luca Castelli Aleardi
t
t
de Casteljau algorithm: properties of B ezier curves
Def
(afnely invariant)
b
0
b
1
b
2
b
1
0
(t)
b
1
1
(t)
b
2
0
(t)
t 0 1
ratio(b
0
, b
1
0
, b
1
) = ratio(b
1
, b
1
1
, b
2
) = ratio(b
1
0
, b
2
0
, b
1
1
) =
t
(1t)
ratio(a, b, c) :=
dist(a,b)
dist(b,c)
b
2
(t) := b
2
0
(t) = (1 t)
2
b
0
+ 2t(1 t)b
1
+ t
2
b
2
b
1
0
(t) = (1 t)b
0
+ tb
1
b
1
1
(t) = (1 t)b
1
+ tb
2
Bernstein polynomials and B ezier curves
Part II
Bernstein polynomials: basis functions of B ezier curves
B
n
i
(t) :=
n
i
t
i
(1 t)
ni
n!
i!(ni)!
0
{
n
i
:=
0 i n
otherwise
cubic case: n = 3
B
3
0
B
3
1
B
3
2
B
3
3
Bernstein polynomials: properties
B
n
i
(t) :=
n
i
t
i
(1 t)
ni
n!
i!(ni)!
0
{
n
i
:=
0 i n
otherwise
n
i=0
B
n
i
(t) = 1 (partition of unity)
proof:
cubic case: n = 3
B
3
0
B
3
1
B
3
2
B
3
3
use binomial theorem
1
n
= [t + (1 t)]
n
=
n
i=0
n
i
t
i
(1 t)
ni
=
n
i=0
B
n
i
(t)
Bernstein polynomials: properties
B
n
i
(t) :=
n
i
t
i
(1 t)
ni
n!
i!(ni)!
0
{
n
i
:=
0 i n
otherwise
cubic case: n = 3
B
3
0
B
3
1
B
3
2
B
3
3
(recursive denition)
proof:
B
n
i
(t) := (1 t)B
n1
i
(t) + tB
n1
i1
(t)
B
0
0
= 1
{
B
0
i
(t) = 0 i / {0, . . . , n}
B
n
i
(t)
=
n1
i
t
i
(1 t)
ni
+
n1
i1
t
i
(1 t)
ni
=
n
i
t
i
(1 t)
ni
(1 t)B
n1
i
(t)
= +
tB
n1
i1
(t)
Bernstein form of B ezier curves
b
r
i
(t) =
r
j=0
b
i+j
B
r
j
(t)
r {0, . . . n}
b
0
b
1
b
2
b
1
0
(t)
b
1
1
(t)
b
3
0
(t)
t 0 1
b
3
cubic case: n = 3
b
1
2
(t)
i {0, . . . n r}
(intermediate points)
b
n
(t) := b
n
0
(t) =
n
i=0
b
i
B
n
i
(t)
(B ezier curve)
Bernstein form of B ezier curves
b
r
i
(t) =
r
j=0
b
i+j
B
r
j
(t)
r {0, . . . n}
b
0
b
1
b
2
b
1
0
(t)
b
1
1
(t)
b
3
0
(t)
t 0 1
b
3
cubic case: n = 3
b
1
2
(t)
i {0, . . . n r}
(intermediate points)
b
n
(t) := b
n
0
(t) =
n
i=0
b
i
B
n
i
(t)
(B ezier curve)
proof: (by induction)
b
r
i
(t) = (1 t)b
r1
i
(t) + tb
r1
i+1
(t) (denition)
= (1 t)
i+r1
j=i
b
j
B
r1
ji
(t) + t
i+r
j=i+1
b
j
B
r1
ji1
(t)
= (1 t)
i+r
j=i
b
j
B
r1
ji
(t) + t
i+r
j=i+1
b
j
B
r1
ji1
(t)
B
0
i
(t) = 0
=
i+r
j=i
[(1 t)b
j
B
r1
ji
(t) + tb
j
B
r1
ji1
(t)]
=
i+r
j=i
b
j
[(1 t)B
r1
ji
(t) + tB
r1
ji1
(t)]
use B
n
i
(t) := (1 t)B
n1
i
(t) + tB
n1
i1
(t) to conclude the proof
Bernstein form of B ezier curves
b
r
i
(t) =
r
j=0
b
i+j
B
r
j
(t)
r {0, . . . n}
b
0
b
1
b
2
b
1
0
(t)
b
1
1
(t)
b
3
0
(t)
t 0 1
b
3
cubic case: n = 3
b
1
2
(t)
i {0, . . . n r}
(intermediate points)
(B ezier curve)
proof: (by induction)
b
r
i
(t) = (1 t)b
r1
i
(t) + tb
r1
i+1
(t) (denition)
= (1 t)
i+r1
j=i
b
j
B
r1
ji
(t) + t
i+r
j=i+1
b
j
B
r1
ji1
(t)
= (1 t)
i+r
j=i
b
j
B
r1
ji
(t) + t
i+r
j=i+1
b
j
B
r1
ji1
(t)
B
0
i
(t) = 0
=
i+r
j=i
[(1 t)b
j
B
r1
ji
(t) + tb
j
B
r1
ji1
(t)]
=
i+r
j=i
b
j
[(1 t)B
r1
ji
(t) + tB
r1
ji1
(t)]
use B
n
i
(t) := (1 t)B
n1
i
(t) + tB
n1
i1
(t) to conclude the proof
b
n
(t) ==
nr
i=0
b
r
i
(t)B
nr
i
(t)
Interlude: barycentric coordinates and convex hulls
(
i
are barycentric coordinates)
(convex hull of a set of points) (set of all convex combinations of points)
the convex hull is also the smallest convex set containing points of S
(intersection of all convex sets containing S)
Interlude: barycentric coordinates and convex hulls
Properties of B ezier curves: afne invariance
b
0
b
1
b
2
b
1
0
(t)
b
1
1
(t)
b
3
0
(t)
b
3
b
1
2
(t)
b
n
(t) :=
n
i=0
i
(t)b
i
(barycentric combination)
n
i=0
B
n
i
(t) = 1
i=0
i
= 1
i
(t) := B
n
i
(t) {
recall
(
i
are barycentric coordinates)
Properties of B ezier curves: afne invariance
b
0
b
1
b
2
b
1
0
(t)
b
1
1
(t)
b
3
0
(t)
b
3
b
1
2
(t)
b
n
(t) :=
n
i=0
i
(t)b
i
(barycentric combination)
n
i=0
B
n
i
(t) = 1
i=0
i
= 1
i
(t) := B
n
i
(t) {
recall
barycentric coordinates are afnely invariant
p = ub
0
+ vb
1
+ wb
2
p
(p)
(p) = u(b
0
) + v(b
1
) + w(b
2
)
Properties of B ezier curves: convex hull property
b
n
(t) :=
n
i=0
i
(t)b
i
(barycentric combination)
n
i=0
B
n
i
(t) = 1
i=0
i
= 1
i
(t) := B
n
i
(t)
{
recall
i
0
B
n
i
(t) 0, for t [0, 1]
b
0
b
1
b
2
b
n
(t)
b
3
Properties of B ezier curves:
b
n
(t) :=
n
i=0
B
n
i
(t)b
i
b
0
b
1
b
2
b
n
(t)
b
3
endpoint interpolation
symmetry
b
n
(0) = b
0
b
n
(1) = b
n
B
n
i
(0) =
{
1 for i = 1
0 otherwise
B
n
i
(1) =
{
1 for i = n
0 otherwise
n
i=0
B
n
i
(t)b
i
=
n
i=0
B
n
i
(1 t)b
ni
B
n
i
(t) = B
n
ni
(1 t)
Properties of B ezier curves: pseudo-local control
B
n
i
(t) :=
n
i
t
i
(1 t)
ni
b
2
Properties of B ezier curves: pseudo-local control
B
n
i
(t) :=
n
i
t
i
(1 t)
ni
b
2
Properties of B ezier curves: pseudo-local control
B
n
i
(t) :=
n
i
t
i
(1 t)
ni
b
2
Properties of B ezier curves: pseudo-local control
B
n
i
(t) :=
n
i
t
i
(1 t)
ni
b
2
Properties of B ezier curves: pseudo-local control
B
n
i
(t) :=
n
i
t
i
(1 t)
ni
b
2
Properties of B ezier curves: pseudo-local control
B
n
i
(t) :=
n
i
t
i
(1 t)
ni
b
2
Properties of B ezier curves: pseudo-local control
B
n
i
(t) :=
n
i
t
i
(1 t)
ni
b
2
Properties of B ezier curves: pseudo-local control
B
n
i
(t) :=
n
i
t
i
(1 t)
ni
b
2
B
n
i
has only one maximum, at t =
i
n
the local change of control point
b
i
affects the whole curve
moving point b
i
, the curve
does change mostly around
value t = i/n
Efcient linear time implementation
B
n
i
(t) :=
n
i
t
i
(1 t)
ni
b
n
(t) := b
n
0
(t) =
n
i=0
b
i
B
n
i
(t)
rewrite the expression of b
n
in a nested form
b
n
(t) = {[
3
0
sb
0
+
3
1
tb
1
]s +
3
2
t
2
b
2
}s +
3
3
t
3
b
3
recall Horners scheme for polynomial evaluation
c
0
+ c
1
t + c
2
t
2
+ c
3
t
3
= c
0
+ t[c
1
+ t(c
2
+ tc
3
)]
use the following recursion for
computing binomial coefcients
n
i
=
ni+1
i
n
i1
n
i=0
b
i
B
n
i
(t)
p
0
p
n
q
0
q
n
p
n
(t) :=
n
i=0
p
i
B
n
i
(t)
q
n
(t) :=
n
i=0
q
i
B
n
i
(t)
B ezier curves subdivision
for rendering and curve
intersection
input problem: b
0
, b
1
, . . . , b
n
E
3
c [0, 1]
b
0
b
n
b
n
(t) :=
n
i=0
b
i
B
n
i
(t)
p
0
p
n
q
0
q
n
p
n
(t) :=
n
i=0
p
i
B
n
i
(t)
q
n
(t) :=
n
i=0
q
i
B
n
i
(t)
p
n
(1) = q
n
(0) = b
n
(c)
goal: compute p
0
, . . . , p
n
and q
0
, . . . q
n
E
3
such that
b
n
(t) = p
n
(t) q
n
(t)
B ezier curves subdivision
for rendering and curve
intersection
input problem: b
0
, b
1
, . . . , b
n
E
3
c [0, 1]
b
0
b
n
b
n
(c)
b
0
b
1
b
2
b
3
b
1
0
b
1
1
b
1
2
b
2
0
b
2
1
b
n
0
1
t
t
b
4
b
5
b
6
b
1
3
b
1
4
b
1
5
b
2
3
b
2
4
b
3
0
. . .
. . .
. . .
b
2
2
1
t
1
t
b
1
0
b
1
5
b
2
0
b
2
4
B ezier curves subdivision
(for rendering)
input problem: b
0
, b
1
, . . . , b
n
E
3
Idea: perform recursive subdivision
Claim: control polygons converge to B ezier
curves under recursive subdivision
B ezier curves subdivision
(line intersection)
input problem: b
0
, b
1
, . . . , b
n
E
2
Idea: perform recursive subdivision
combined with convex hulls computation
a line l
Properties of B ezier curves: drawbacks
you cannot achieve local control
higher accuracy requires large nomber of
points, which increases the degre of the curve
circles cannot be represented using (piecewise)
B ezier curves
they are not projectively invariant
Rational B ezier curves
Part III
Rational B ezier curves: denition
A(planar) rational B ezier curve x(t) is the projection on the plane z = 1 of
a B ezier curve b(t) E
3
Def
Rational B ezier curves: denition
A(planar) rational B ezier curve x(t) is a the projection on the plane z = 1
of a B ezier curve b(t) E
3
General expression
x(t) :=
w
0
b
0
B
n
0
(t)+...w
n
b
n
B
n
n
(t)
w
0
B
n
0
(t)+...+w
n
B
n
n
(t)
x(t), b
i
E
2
w
i
R are the weights
Rational B ezier curves: construction
A(planar) rational B ezier curve has the form:
x(t) :=
w
0
b
0
B
n
0
(t)+...w
n
b
n
B
n
n
(t)
w
0
B
n
0
(t)+...+w
n
B
n
n
(t) x(t), b
i
E
2
w
i
R are the weights
proof (quadratic case):
write a conic curve c(t) E
2
with homogeneous coordinates
[c(t) 1] E
3
[w(t)c(t) w(t)] E
3
belongs to a 3D parabola (quadratic curve of t)
w(t) = w
0
B
2
0
(t) + w
1
B
2
1
(t) + w
n
B
2
2
(t)
w(t)
c(t)
1
c(t)
i
w
i
B
2
i
(t)
=
i
w
i
B
2
i
(t)
w
0
= 1, w
1
= 2, w
2
= 1
Rational B ezier curves: construction
A(planar) rational B ezier curve has the form:
x(t) :=
w
0
b
0
B
n
0
(t)+...w
n
b
n
B
n
n
(t)
w
0
B
n
0
(t)+...+w
n
B
n
n
(t) x(t), b
i
E
2
w
i
R are the weights
proof (quadratic case):
2
i=0
p
i
w
i
c(t)
i
w
i
B
2
i
(t)
=
i
w
i
B
2
i
(t)
B
2
i
(t)
p
i
E
2
2
i=0
p
i
B
2
i
(t) = c(t)
i
w
i
B
2
i
(t)
c(t) :=
w
0
p
0
B
2
0
(t)+w
1
p
1
B
2
1
(t)+w
2
p
2
B
2
2
(t)
w
0
B
2
0
(t)+...+w
2
B
2
2
(t)
where p
i
= w
i
b
i
w
0
= 1, w
1
= 2, w
2
= 1
de Casteljau algorithm for the rational case
x(t) :=
w
0
b
0
B
n
0
(t)+...w
n
b
n
B
n
n
(t)
w
0
B
n
0
(t)+...+w
n
B
n
n
(t) x(t), b
i
E
2
w
0
= 1, w
1
= 2, w
2
= 1
weights w
i
can be recursively computed by
intermediate points have the following explicit form:
Geometric interpretation of weights
x(t) :=
w
0
b
0
B
n
0
(t)+...w
n
b
n
B
n
n
(t)
w
0
B
n
0
(t)+...+w
n
B
n
n
(t)
x(t), b
i
E
2
b
1
b
0
b
2
b
3
q
0
q
1
q
2
q
i
are the weight points, describing ratios between two consecutive points
Geometric interpretation of weights
x(t) :=
w
0
b
0
B
n
0
(t)+...w
n
b
n
B
n
n
(t)
w
0
B
n
0
(t)+...+w
n
B
n
n
(t)
x(t), b
i
E
2
b
1
b
0
b
2
b
3
q
0
q
1
q
2
all cross ratios have the same value (for xed t)
at each level points q
r
i
are dened by the ratio of consecutive points
Def
Property
cr(b
r
i
, q
r
i
, b
r+1
i
, b
r
i+1
) =
1t
t
Ratio and cross ratio
all cross ratios have the same value (for xed t)
Def
Property
cr(b
r
i
, q
r
i
, b
r+1
i
, b
r
i+1
) =
1t
t
(projectively invariant)
(afnely invariant)