37
Bézier Curves CPSC 453 – Fall 2018 Sonny Chan

Bézier Curves - pages.cpsc.ucalgary.ca

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Bézier Curves

CPSC 453 – Fall 2018Sonny 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

How might we represent a

freeform shape? 𝄞

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

defining curves?

de Casteljau’s Algorithm (quadratic)

p10 = lerp(p0,p1, u)

p11 = lerp(p1,p2, u)

p(u) = lerp(p10,p

11, u)

p0

p1

p2

Bernstein Polynomials

0 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

=2X

i=0

bi,2(u)pi

Property #1:

endpoint interpolation

Endpoint Interpolation

p0

p1

p2

p(0) = p0

p(1) = p2

Property #2:

endpoint tangents

Endpoint Tangents

p0

p1

p2

p0(0) = 2(p1 � p0)

p0(1) = 2(p2 � p1)

Property #3:

convex hull

Convex Hull

p0

p1

p2

Bézier Splines of the 2nd degree

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) = sq0(0), s 2 R+

Using a Bézier spline to represent a

freeform shape

Bézier Curves of the 3rd degree

de Casteljau Construction

u = 12

u = 14 u = 3

4

0 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

=3X

i=0

bi,3(u)pi

p0

p1

p2

p3

Do our properties still apply?

Endpoints

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

p0 p1 p2 p3

p10 p1

1 p12

p20 p2

1

p(u)

u1� u

p(u) =nX

i=0

bi,n(u)pi

bi,n(u) =

✓ni

◆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

• 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)