The Essentials of CAGD Chapter 3: Cubic B ezier Curves Gerald - - PowerPoint PPT Presentation

the essentials of cagd
SMART_READER_LITE
LIVE PREVIEW

The Essentials of CAGD Chapter 3: Cubic B ezier Curves Gerald - - PowerPoint PPT Presentation

The Essentials of CAGD Chapter 3: Cubic B ezier Curves Gerald Farin & Dianne Hansford CRC Press, Taylor & Francis Group, An A K Peters Book www.farinhansford.com/books/essentials-cagd 2000 c Farin & Hansford The Essentials


slide-1
SLIDE 1

The Essentials of CAGD

Chapter 3: Cubic B´ ezier Curves Gerald Farin & Dianne Hansford

CRC Press, Taylor & Francis Group, An A K Peters Book www.farinhansford.com/books/essentials-cagd

c 2000

Farin & Hansford The Essentials of CAGD 1 / 29

slide-2
SLIDE 2

Outline

1

Introduction to Cubic B´ ezier Curves

2

Parametric Curves

3

Cubic B´ ezier Curves

4

Derivatives

5

The de Casteljau Algorithm

6

Subdivision

7

Exploring the Properties of B´ ezier Curves

8

The Matrix Form and Monomials

Farin & Hansford The Essentials of CAGD 2 / 29

slide-3
SLIDE 3

Introduction to Cubic B´ ezier Curves

Cubic B´ ezier curves – CAD/CAM – Graphic Design – Computer Graphics – Figure generated in PostScript Basic principles of B´ ezier curves easily explored via cubics

Farin & Hansford The Essentials of CAGD 3 / 29

slide-4
SLIDE 4

Parametric Curves

Curve from calculus: function y = 2x − 2x2 Graph of the function x y

  • =
  • x

2x − 2x2

  • Parametric curve

x y

  • =

f (t) g(t)

  • f and g can be any kind of function

Domain is the real line Try this: Parametric line thru 2 points

Farin & Hansford The Essentials of CAGD 4 / 29

slide-5
SLIDE 5

Parametric Curves

Graph of a function x y

  • =
  • x

2x − 2x2

  • as a parametric curve:

x(t) = x y

  • =
  • t

2t − 2t2

  • Rotate 90 degrees

x(t) = −2t + 2t2 t

  • Horizontal tangents do not

characterize extreme points for parametric curves

Farin & Hansford The Essentials of CAGD 5 / 29

slide-6
SLIDE 6

Parametric Curves

Parametric curves defined in 3D: x(t) =   x y z   =   f (t) g(t) h(t)   Simple example: a helix x(t) =   cos(t) sin(t) t  

Farin & Hansford The Essentials of CAGD 6 / 29

slide-7
SLIDE 7

Cubic B´ ezier Curves

Focus of this book: B´ ezier curves – The most important type of polynomial curve – Named after Pierre B´ ezier – Defined for any polynomial degree – First focus on cubic case n = 3

Farin & Hansford The Essentials of CAGD 7 / 29

slide-8
SLIDE 8

Cubic B´ ezier Curves

x(t) =

  • −(1 − t)3 + t3

3(1 − t)2t − 3(1 − t)t2

  • Shape?

Rewrite as a combination of points x(t) = (1 − t)3 −1

  • + 3(1 − t)2t

1

  • + 3(1 − t)t2

−1

  • + t3

1

  • Farin & Hansford

The Essentials of CAGD 8 / 29

slide-9
SLIDE 9

Cubic B´ ezier Curves

Cubic B´ ezier curve x(t) = (1 − t)3b0 + 3(1 − t)2tb1 + 3(1 − t)t2b2 + t3b3 B´ ezier control points bi form the B´ ezier polygon Cubic Bernstein polynomials B3

i

x(t) = B3

0(t)b0 + B3 1(t)b1 + B3 2(t)b2 + B3 3(t)b3

More on the Bernstein polynomials in the next chapter

Farin & Hansford The Essentials of CAGD 9 / 29

slide-10
SLIDE 10

Cubic B´ ezier Curves

Properties:

1

Endpoint interpolation

2

Symmetry

3

Invariance under affine maps

4

Convex hull property

5

Linear precision

Farin & Hansford The Essentials of CAGD 10 / 29

slide-11
SLIDE 11

Cubic B´ ezier Curves

Convex hull property t ∈ [−1, 2] Extrapolation: t outside [0, 1] – No convex hull property – Unpredictable behavior

Farin & Hansford The Essentials of CAGD 11 / 29

slide-12
SLIDE 12

Derivatives

Tangent vector dx(t) dt = −3(1 − t)2b0 + [3(1 − t)2 − 6(1 − t)t]b1 + [6(1 − t)t − 3t2]b2 + 3t2b3 = 3[b1 − b0](1 − t)2 + 6[b2 − b1](1 − t)t + 3[b3 − b2]t2 = 3∆b0(1 − t)2 + 6∆b1(1 − t)t + 3∆b2t2 forward difference ∆bi ˙ x(t) ≡ dx(t)/dt

Farin & Hansford The Essentials of CAGD 12 / 29

slide-13
SLIDE 13

Derivatives

Example ˙ x(t) = 3 1 1

  • (1 − t)2

+ 6 −2

  • (1 − t)t

+ 3 1 1

  • t2

˙ x(0.5) = 1.5 −1.5

  • Farin & Hansford

The Essentials of CAGD 13 / 29

slide-14
SLIDE 14

Derivatives

˙ x(t) = 3∆b0(1 − t)2 + 6∆b1(1 − t)t + 3∆b2t2 – Derivative of a cubic curve is a quadratic curve – Evaluating “derivative curve” produces vectors At the curve’s endpoints: ˙ x(0) = 3∆b0 ˙ x(1) = 3∆b2 ⇒ control polygon is tangent to the curve at the endpoints Chapter 4: higher order derivatives

Farin & Hansford The Essentials of CAGD 14 / 29

slide-15
SLIDE 15

The de Casteljau Algorithm

Recursive algorithm that constructs the point x(t) on a B´ ezier curve Most important algorithm of all of CAGD Many practical and theoretical ramifications 1959 Paul de Faget de Casteljau

Farin & Hansford The Essentials of CAGD 15 / 29

slide-16
SLIDE 16

The de Casteljau Algorithm

Given: b0, . . . , b3 and t Find: x(t) b1

0 = (1 − t)b0 + tb1

b1

1 = (1 − t)b1 + tb2

b1

2 = (1 − t)b2 + tb3

b2

0 = (1 − t)b1 0 + tb1 1

b2

1 = (1 − t)b1 1 + tb1 2

x(t) = b3

0 = (1 − t)b2 0 + tb2 1

What operation is repeated?

Farin & Hansford The Essentials of CAGD 16 / 29

slide-17
SLIDE 17

The de Casteljau Algorithm

Schematic tool b0 b1 b1 b2 b1

1

b2 b3 b1

2

b2

1

b3 Implementation: 1D array data structure sufficient

Farin & Hansford The Essentials of CAGD 17 / 29

slide-18
SLIDE 18

The de Casteljau Algorithm

Example x(t) = (1 − t)3 −1

  • + 3(1 − t)2t

1

  • + 3(1 − t)t2

−1

  • + t3

1

  • Evaluate at t = 0.5 using the triangular schematic tool

Make a sketch!

Farin & Hansford The Essentials of CAGD 18 / 29

slide-19
SLIDE 19

The de Casteljau Algorithm

Just for fun: All intermediate points of many evaluations

Farin & Hansford The Essentials of CAGD 19 / 29

slide-20
SLIDE 20

The de Casteljau Algorithm

Derivatives b2

0b2 1 is tangent to the curve

˙ x(t) = 3[b2

1 − b2 0]

Derivative as byproduct of point evaluation Great value computationally

Farin & Hansford The Essentials of CAGD 20 / 29

slide-21
SLIDE 21

Subdivision

Curve over [0, t] b0, b1

0, b2 0, b3

Curve over [t, 1] b3

0, b2 1, b1 2, b3

Find these control points:

b0 b1 b1 b2 b1

1

b2 b3 b1

2

b2

1

b3

Subdivide at t = 0.5 Are the two curve arcs equal length?

Farin & Hansford The Essentials of CAGD 21 / 29

slide-22
SLIDE 22

Subdivision

Repeated subdivision Polygon converges to curve Convergence is fast Application?

Farin & Hansford The Essentials of CAGD 22 / 29

slide-23
SLIDE 23

Subdivision

Application: curve / line intersection True/False of minmax box / line intersection fast How is convex hull property used? Try outlining the intersection algorithm

Farin & Hansford The Essentials of CAGD 23 / 29

slide-24
SLIDE 24

Exploring the Properties of B´ ezier Curves

Self-intersection

Farin & Hansford The Essentials of CAGD 24 / 29

slide-25
SLIDE 25

Exploring the Properties of B´ ezier Curves

Two inflection points Cubic functions cannot have two inflection points ⇒ Parametric curves more flexible

Farin & Hansford The Essentials of CAGD 25 / 29

slide-26
SLIDE 26

Exploring the Properties of B´ ezier Curves

Cusp: point where the first derivative vector vanishes See for yourself! Run the de Casteljau algorithm for t = 0.5

Farin & Hansford The Essentials of CAGD 26 / 29

slide-27
SLIDE 27

The Matrix Form and Monomials

Cubic B´ ezier curve: b(t) = B3

0(t)b0 + B3 1(t)b1 + B3 2(t)b2 + B3 3(t)b3

Rewrite in matrix form: b(t) =

  • b0

b1 b2 b3

   B3

0(t)

B3

1(t)

B3

2(t)

B3

3(t)

    =

  • b0

b1 b2 b3

   1 −3 3 −1 3 −6 3 3 −3 1         1 t t2 t3    

Farin & Hansford The Essentials of CAGD 27 / 29

slide-28
SLIDE 28

The Matrix Form and Monomials

Monomial polynomials: 1, t, t2, t3 Reformulate a B´ ezier curve b(t) = b0 + 3t(b1 − b0) + 3t2(b2 − 2b1 + b0) + t3(b3 − 3b2 + 3b1 − b0) = a0 + a1t + a2t2 + a3t3 What is the geometric interpretation

  • f the ai?

Farin & Hansford The Essentials of CAGD 28 / 29

slide-29
SLIDE 29

The Matrix Form and Monomials

The monomial coefficients ai are defined as

  • a0

a1 a2 a3

  • =
  • b0

b1 b2 b3

   1 −3 3 −1 3 −6 3 3 −3 1     Inverse process:

  • b0

b1 b2 b3

  • =
  • a0

a1 a2 a3

   1 −3 3 −1 3 −6 3 3 −3 1    

−1

Square matrix above is nonsingular ⇒ Any cubic curve can be written in B´ ezier or monomial form How do we know that the matrix is nonsingular?

Farin & Hansford The Essentials of CAGD 29 / 29