Bézier Curves CPSC 453 – Fall 2018 Sonny Chan
Today’s Outline • Quadratic Bézier curves • de Casteljau formulation • Bernstein polynomial form • Bézier splines • Cubic Bézier curves • Drawing Bézier curves
freeform shape? 𝄟 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 1 p ( u ) = lerp( p 0 , p 1 , u ) = (1 − u ) p 0 + u p 1 p 0
Can we use the same machinery for defining curves?
de Casteljau’s Algorithm (quadratic) p 1 p 1 0 = lerp( p 0 , p 1 , u ) p 1 1 = lerp( p 1 , p 2 , u ) p 2 p ( u ) = lerp( p 1 0 , p 1 1 , u ) p 0
Bernstein Polynomials 1 b 0 , 2 ( u ) = (1 − u ) 2 0.75 b 1 , 2 ( u ) = 2 u (1 − u ) 0.5 b 2 , 2 ( u ) = u 2 0.25 0 0.25 0.5 0.75 1
Bernstein Form of a Quadratic Bézier p ( u ) = (1 − u ) 2 p 0 + 2 u (1 − u ) p 1 + u 2 p 2 = b 0 , 2 ( u ) p 0 + b 1 , 2 ( u ) p 1 + b 2 , 2 ( u ) p 2 p 1 2 X = b i, 2 ( u ) p i i =0 p 0 p 2
Property #1: endpoint interpolation
p 1 Endpoint Interpolation p 2 p (1) = p 2 p (0) = p 0 p 0
Property #2: endpoint tangents
p 1 p 2 Endpoint Tangents p 0 (1) = 2( p 2 − p 1 ) p 0 (0) = 2( p 1 − p 0 ) p 0
Property #3: convex hull
p 1 Convex Hull p 2 p 0
Bézier Splines of the 2nd degree
Splines are just curve segments joined together: q 1 p 1 p 2 = q 0 q 2 p 0
Is it continuous? C 0 continuity: p (1) = q (0)
Is it smooth?
C 1 continuity: Is it smooth? p 0 (1) = q 0 (0)
G 1 continuity: Is it smooth? p 0 (1) = s q 0 (0) , s ∈ R +
Using a Bézier spline to represent a freeform shape
Bézier Curves of the 3rd degree
de Casteljau Construction u = 1 2 u = 1 u = 3 4 4
Third Degree Bernstein Polynomials 1 b 0 , 3 ( u ) = (1 − u ) 3 0.75 b 1 , 3 ( u ) = 3 u (1 − u ) 2 0.5 b 2 , 3 ( u ) = 3 u 2 (1 − u ) 0.25 b 3 , 3 ( u ) = u 3 0 0.25 0.5 0.75 1
Bernstein form of a Cubic Bézier p ( u ) = (1 − u ) 3 p 0 + 3 u (1 − u ) 2 p 1 + 3 u 2 (1 − u ) p 2 + u 3 p 3 = b 0 , 3 ( u ) p 0 + b 1 , 3 ( u ) p 1 + b 2 , 3 ( u ) p 2 + b 3 , 3 ( u ) p 3 3 X = b i, 3 ( u ) p i p 1 p 3 i =0 p 0 p 2
✓ Endpoints ✓ Do our properties still apply? Tangents ✓ Convex Hull
Property #4: curve subdivision
Curve Subdivision
Drawing Curves Or how to approximate them with straight line segments.
Two methods for evaluating your curve p 0 p 1 p 2 p 3 p 1 p 1 p 1 Bernstein 0 1 2 1 − u u p 2 p 2 n 0 1 X p ( u ) = b i,n ( u ) p i p ( u ) i =0 ✓ n ◆ u i (1 − u ) n − i b i,n ( u ) = de Casteljau i Which one do you think is more efficient?
The key question: How many line segments do you need?
Things to Remember • Bézier curves and splines can provide an accurate, complete, and indisputable definition of freeform shapes defined by de Casteljau construction or Bernstein polynomials - quadratic (3 points), cubic (4 points), or higher order - • Splines are just curve segments joined together can have various degrees of parametric/geometric continuity - • Draw splines by approximating them with line segments, just like parametric curves! (same considerations apply)
Recommend
More recommend