Bézier Curves
CPSC 453 – Fall 2018 Sonny Chan
Bzier Curves CPSC 453 Fall 2018 Sonny Chan Todays Outline - - PowerPoint PPT Presentation
Bzier Curves CPSC 453 Fall 2018 Sonny Chan Todays Outline Quadratic Bzier curves de Casteljau formulation Bernstein polynomial form Bzier splines Cubic Bzier curves Drawing Bzier curves freeform shape?
Bézier Curves
CPSC 453 – Fall 2018 Sonny Chan
Today’s Outline
How might we represent a
The Goal:
Create a system that provides an accurate, complete, and indisputable definition of freeform shapes.
Parametric Segment by Linear Interpolation
p(u) = lerp(p0, p1, u) = (1 − u)p0 + up1 p0 p1
Can we use the same machinery for
de Casteljau’s Algorithm (quadratic)
p1
0 = lerp(p0, p1, u)
p1
1 = lerp(p1, p2, u)
p(u) = lerp(p1
0, p1 1, u)
p0 p1 p2
Bernstein Polynomials
0.25 0.5 0.75 1 0.25 0.5 0.75 1
b0,2(u) = (1 − u)2 b1,2(u) = 2u(1 − u) b2,2(u) = u2
Bernstein Form of a Quadratic Bézier
p0 p1 p2 p(u) = (1 − u)2p0 + 2u(1 − u)p1 + u2p2 = b0,2(u)p0 + b1,2(u)p1 + b2,2(u)p2 =
2
X
i=0
bi,2(u)pi
Property #1:
Endpoint Interpolation
p0 p1 p2 p(0) = p0 p(1) = p2
Property #2:
Endpoint Tangents
p0 p1 p2 p0(0) = 2(p1 − p0) p0(1) = 2(p2 − p1)
Property #3:
Convex Hull
p0 p1 p2
Bézier Splines
Splines are just curve segments joined together:
p0 p1 p2 = q0 q1 q2
Is it continuous?
C0 continuity: p(1) = q(0)
Is it smooth?
Is it smooth?
C1 continuity: p0(1) = q0(0)
Is it smooth?
G1 continuity: p0(1) = s q0(0), s ∈ R+
Using a Bézier spline to represent a
Bézier Curves
de Casteljau Construction
u = 1
2
u = 1
4
u = 3
4
0.25 0.5 0.75 1 0.25 0.5 0.75 1
Third Degree Bernstein Polynomials
b0,3(u) = (1 − u)3 b1,3(u) = 3u(1 − u)2 b2,3(u) = 3u2(1 − u) b3,3(u) = u3
Bernstein form of a Cubic Bézier
p(u) = (1 − u)3p0 + 3u(1 − u)2p1 + 3u2(1 − u)p2 + u3p3 = b0,3(u)p0 + b1,3(u)p1 + b2,3(u)p2 + b3,3(u)p3 =
3
X
i=0
bi,3(u)pi p0 p1 p2 p3
Do our properties still apply?
Endpoints Tangents Convex Hull
Property #4:
Curve Subdivision
Drawing Curves
Or how to approximate them with straight line segments.
Two methods for evaluating your curve
p0 p1 p2 p3 p1 p1
1
p1
2
p2 p2
1
p(u) u 1 − u p(u) =
n
X
i=0
bi,n(u)pi bi,n(u) = ✓n i ◆ ui(1 − u)n−i de Casteljau Bernstein Which one do you think is more efficient?
How many line segments do you need?
The key question:
Things to Remember
complete, and indisputable definition of freeform shapes
just like parametric curves! (same considerations apply)