Lecture 23: Hermite and Bezier Curves

Similar documents
Lecture 20: Bezier Curves & Splines

Q( t) = T C T =! " t 3,t 2,t,1# Q( t) T = C T T T. Announcements. Bezier Curves and Splines. Review: Third Order Curves. Review: Cubic Examples

CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier

Reading. w Foley, Section 11.2 Optional

Sample Exam 1 KEY NAME: 1. CS 557 Sample Exam 1 KEY. These are some sample problems taken from exams in previous years. roughly ten questions.

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

Bernstein polynomials of degree N are defined by

CSE 167: Lecture 11: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Bézier Curves and Splines

CGT 511. Curves. Curves. Curves. What is a curve? 2) A continuous map of a 1D space to an nd space

M2R IVR, October 12th Mathematical tools 1 - Session 2

Arsène Pérard-Gayot (Slides by Piotr Danilewski)

Interpolation and polynomial approximation Interpolation

Lecture 02: 2D Geometry. August 24, 2017

Introduction to Computer Graphics. Modeling (1) April 13, 2017 Kenshi Takayama

Curves. Hakan Bilen University of Edinburgh. Computer Graphics Fall Some slides are courtesy of Steve Marschner and Taku Komura

MA 323 Geometric Modelling Course Notes: Day 07 Parabolic Arcs

Approximation of Circular Arcs by Parametric Polynomials

Curves, Surfaces and Segments, Patches

MAT300/500 Programming Project Spring 2019

The Essentials of CAGD

The Not-Formula Book for C1

Introduction to Curves. Modelling. 3D Models. Points. Lines. Polygons Defined by a sequence of lines Defined by a list of ordered points

Home Page. Title Page. Contents. Bezier Curves. Milind Sohoni sohoni. Page 1 of 27. Go Back. Full Screen. Close.

Keyframing. CS 448D: Character Animation Prof. Vladlen Koltun Stanford University

On-Line Geometric Modeling Notes

x 1. x n i + x 2 j (x 1, x 2, x 3 ) = x 1 j + x 3

Wed Feb The vector spaces 2, 3, n. Announcements: Warm-up Exercise:

6x 2 8x + 5 ) = 12x 8. f (x) ) = d (12x 8) = 12

Chapter 0 of Calculus ++, Differential calculus with several variables

Topic 5.1: Line Element and Scalar Line Integrals

Usually, when we first formulate a problem in mathematics, we use the most familiar

Finish section 3.6 on Determinants and connections to matrix inverses. Use last week's notes. Then if we have time on Tuesday, begin:

Distance in the Plane

Course Notes Math 275 Boise State University. Shari Ultman

SOME PROBLEMS YOU SHOULD BE ABLE TO DO

MAC Calculus II Spring Homework #6 Some Solutions.

(1) Recap of Differential Calculus and Integral Calculus (2) Preview of Calculus in three dimensional space (3) Tools for Calculus 3

Chapter 3A -- Rectangular Coordinate System

Spring /06/2009

Homework 5: Sampling and Geometry

1.1. The analytical denition. Denition. The Bernstein polynomials of degree n are dened analytically:

CONTROL POLYGONS FOR CUBIC CURVES

3D Coordinate Transformations. Tuesday September 8 th 2015

1.3 Distance and Midpoint Formulas

CHAPTER 6 VECTOR CALCULUS. We ve spent a lot of time so far just looking at all the different ways you can graph

Math Practice Final - solutions

Introduction. Chapter Points, Vectors and Coordinate Systems

Lecture 16: Projection and Cameras. October 17, 2017

Test 2 Review Math 1111 College Algebra

Introduction to Computer Graphics (Lecture No 07) Ellipse and Other Curves

Economics 205, Fall 2002: Final Examination, Possible Answers

Integrals. D. DeTurck. January 1, University of Pennsylvania. D. DeTurck Math A: Integrals 1 / 61

MATH The Chain Rule Fall 2016 A vector function of a vector variable is a function F: R n R m. In practice, if x 1, x n is the input,

Section 5.1. Areas and Distances. (1) The Area Problem (2) The Distance Problem (3) Summation Notation

Math6100 Day 8 Notes 6.1, 6.2 & 6.3, Area

Implicit Differentiation

Math 11 Fall 2016 Section 1 Monday, September 19, Definition: A vector parametric equation for the line parallel to vector v = x v, y v, z v

Cubic Splines; Bézier Curves

Smooth Path Generation Based on Bézier Curves for Autonomous Vehicles

2tdt 1 y = t2 + C y = which implies C = 1 and the solution is y = 1

Solutions for the Practice Final - Math 23B, 2016

Table of contents. Jakayla Robbins & Beth Kelly (UK) Precalculus Notes Fall / 53

King Fahd University of Petroleum and Minerals Prep-Year Math Program Math (001) - Term 181 Recitation (1.1)

Introduction to Fourier Analysis Part 2. CS 510 Lecture #7 January 31, 2018

VANDERBILT UNIVERSITY. MATH 2300 MULTIVARIABLE CALCULUS Practice Test 1 Solutions

First-Order Differential Equations

Mathematics 1 Lecture Notes Chapter 1 Algebra Review

Math 122 Fall Handout 15: Review Problems for the Cumulative Final Exam

mathematical objects can be described via equations, functions, graphs, parameterization in R, R, and R.

Lagrange Interpolation and Neville s Algorithm. Ron Goldman Department of Computer Science Rice University

Absolute Value Equations and Inequalities. Use the distance definition of absolute value.

Next, we ll use all of the tools we ve covered in our study of trigonometry to solve some equations.

The Distance Formula. The Midpoint Formula

Math 142 (Summer 2018) Business Calculus 5.8 Notes

Lösning: Tenta Numerical Analysis för D, L. FMN011,

and likewise fdy = and we have fdx = f((x, g(x))) 1 dx. (0.1)

CP Algebra 2. Unit 3B: Polynomials. Name: Period:

G-code and PH curves in CNC Manufacturing

Visualizing Bezier s curves: some applications of Dynamic System Geogebra

Main topics for the First Midterm Exam

Recognise the Equation of a Circle. Solve Problems about Circles Centred at O. Co-Ordinate Geometry of the Circle - Outcomes

MA 323 Geometric Modelling Course Notes: Day 20 Curvature and G 2 Bezier splines

We say that the function f obtains a maximum value provided that there. We say that the function f obtains a minimum value provided that there

Math 1270 Honors ODE I Fall, 2008 Class notes # 14. x 0 = F (x; y) y 0 = G (x; y) u 0 = au + bv = cu + dv

Graphs of polynomials. Sue Gordon and Jackie Nicholas

9.5. Polynomial and Rational Inequalities. Objectives. Solve quadratic inequalities. Solve polynomial inequalities of degree 3 or greater.

Introduction to Linear Algebra

Integer-Valued Polynomials

2 The De Casteljau algorithm revisited

Math 234. What you should know on day one. August 28, You should be able to use general principles like. x = cos t, y = sin t, 0 t π.

CLASS-XII ( ) Units No. of Periods Marks. I. Relations and Functions II. Algebra III. Calculus 80 44

n=0 ( 1)n /(n + 1) converges, but not

MTH4100 Calculus I. Week 6 (Thomas Calculus Sections 3.5 to 4.2) Rainer Klages. School of Mathematical Sciences Queen Mary, University of London

Distance and Velocity

8.7 MacLaurin Polynomials

Lecture 20: Lagrange Interpolation and Neville s Algorithm. for I will pass through thee, saith the LORD. Amos 5:17

R1: Sets A set is a collection of objects sets are written using set brackets each object in onset is called an element or member

Math 266: Ordinary Differential Equations

1.1 Radical Expressions: Rationalizing Denominators

Transcription:

Lecture 23: Hermite and Bezier Curves November 16, 2017 11/16/17 CSU CS410 Fall 2017, Ross Beveridge & Bruce Draper 1

Representing Curved Objects So far we ve seen Polygonal objects (triangles) and Spheres Now, polynomial curves Hermite curves Bezier curves B-Splines NURBS Bivariate polynomial surface patches 11/16/17 Bruce Draper & J. Ross Beveridge 2

Beyond linear approximation Instead of approximating everything by zillions of lines and planes, it is possible to approximate shapes using higher-order curves. Advantages: More compact Reduces artifacts Use of sphere in ray tracer is an example of an implicit curve. 11/16/17 Bruce Draper & J. Ross Beveridge 3

The Pen Metaphore Think of putting a pen to paper Pen position described by time t Seeing the action of drawing is the key, so this static drawing only partly captures the point of this slide. 11/16/17 Bruce Draper & J. Ross Beveridge 4

Design Criteria Local control of shape Smoothness and continuity Ability to evaluate derivatives Stability Ease of rendering 11/16/17 Bruce Draper & J. Ross Beveridge 5

Review Forms - Explicit Explicit representation: y = f(x) Drawbacks: y = ax 3 + bx 2 + cx + d Multiple values of y for a single x impossible. Not rotationally invariant. 11/16/17 Bruce Draper & J. Ross Beveridge 6

Review Forms - Implicit Implicit representation: f(x, y, z) = 0 x 2 a + y2 2 b + z2 2 c 1= 0 2 Advantages: On curve & relative distance to curve tests. Drawbacks: Enumerating points on the curve is hard. Extra constraints needed half a circle? Difficult to express and test tangents. 11/16/17 Bruce Draper & J. Ross Beveridge 7

Parametric Representations We will represent 3D curves using a parametric representation, introducing a new variable t: Q( t) = x( t) y( t) z( t) Note that x, y and z are dependent on t alone, making it clear that there is only one free variable. Think of t as time associated with movement along the curve. 11/16/17 Bruce Draper & J. Ross Beveridge 8

Third Order Curves Third-order functions are the standard: Why 3? x t ( ) = a x t 3 + b x t 2 + c x t + d x y t ( ) = a y t 3 + b y t 2 + c y t + d y z t ( ) = a z t 3 + b z t 2 + c z t + d z Lower-order curves cannot be smoothly joined. Higher-order curves introduce wiggles. Without loss of generality: 0 <= t <= 1. 11/16/17 Bruce Draper & J. Ross Beveridge 9

Cubic Examples 11/16/17 Bruce Draper & J. Ross Beveridge 10

Notation T =! " t 3,t 2,t,1# $ Q( t) = T C! # # C = # # # "# a x a y a z b x b y b z c x c y c z d x d y d z $ & & & & & %& Alternatively: Q( t) T = C T T T 11/16/17 Bruce Draper & J. Ross Beveridge 11

Tangents to Cubic Curves The derivative of Q(t) is its tangent: d dt d d d Q(t) = [ x(t), y(t), z(t)] dt dt dt d dt Q(t) x = 3a x t 2 + 2b x t + c x d dt Q(t) = [3t2, 2t, 1, 0] C The same matrix as on previous slide Again the time metaphor is useful, the tangent indicates instantaneous direction and speed. 11/16/17 Bruce Draper & J. Ross Beveridge 12

Hermite Curves We want curves that fit together smoothly. To accomplish this, we would like to specify a curve by providing: The endpoints The 1 st derivatives at the endpoints The result is called a Hermite Curve. 11/16/17 Bruce Draper & J. Ross Beveridge 13

Hermite Curves (cont.) Since Q(t) = TC, we factor C into two matrices: G (a 3x4 geometry matrix) M (a 4x4 basis matrix) such that C = G M. This step is a big deal. It makes thinking about curve geometry tractable. Note: G will hold our geometric constraints (endpoints and derivatives), while M will be constant across all Hermite curves. 11/16/17 Bruce Draper & J. Ross Beveridge 14

Let us concentrate on the x component: P(t) x = a x t 3 + b x t 2 + c x t + d x Remember that its derivative is: d P(t) x = 3a x t 2 + 2b x t + c dt x Therefore P(0) x P(1) x d/dt P(0) x d/dt P(1) x = 0 0 0 1 1 1 1 1 0 0 1 0 3 2 1 0 a x b x c x d x 11/16/17 Bruce Draper & J. Ross Beveridge 15

Therefore: a x b x c x d x = And taking the inverse: a x b x c x d x = 0 0 0 1 1 1 1 1 0 0 1 0 3 2 1 0 2-2 1 1-3 3-2 -1 0 0 1 0 1 0 0 0-1 P(0) x P(1) x d/dt P(0) x d/dt P(1) x P(0) x P(1) x d/dt P(0) x d/dt P(1) x 11/16/17 Bruce Draper & J. Ross Beveridge 16

The Hermite Matrix OK, that was the x dimension. How about the others? They are, of course, the same: a x a y a z b x b y b z c x c y c z d x d y d z = 2 2 1 1 3 3 2 1 0 0 1 0 1 0 0 0 M P( 0) P( 1) dp( 0) dt dp( 1) dt 11/16/17 Bruce Draper & J. Ross Beveridge 17

Punchline Q( t) = x( t) y( t) z( t) = T C = T M H " $ $ $ $ $ $ # $ ( ) ( ) P 0 P 1 d P 0 dt ( ) d P 1 dt ( ) % ' ' ' ' ' ' &' Since M H and T are known, you can write down a cubic polynomial curve by inspection ending at points P(0) and P(1) with tangents d/dt P(0) and d/dt P(1). 11/16/17 Bruce Draper & J. Ross Beveridge 18

Expand the Math Look Inside Recall Parametric Equation: Q(t) = T M H G Where Fully Expanded (note transpose) T 11/16/17 Bruce Draper & J. Ross Beveridge 19

If you Prefer There are two equivalent setups The difference is solely transposition 11/16/17 Bruce Draper & J. Ross Beveridge 20

Examples G = 100 100 0 200 200 0 10 10 0 10 10 0 G = 100 100 0 200 200 0 0 200 0 200 0 0 11/16/17 Bruce Draper & J. Ross Beveridge 21

More Examples G = 100 100 0 200 200 0 0 1000 0 1000 0 0 G = 100 100 0 200 200 0 100 2000 0-500 -200 0 11/16/17 Bruce Draper & J. Ross Beveridge 22

Hermite Blending Functions Conceptual Realignment Curves are weighted averages of points/vectors. Blending functions specify the weighting. é x1 ù é x2 ù édx1ù Q = y1 ( 2 t 3-3 t 2 + 1) + y2 (- 2 t 3 + 3 t 2 ) + dy1 ( t 3-2 t 2 + t) + ê ú ê ú ê ú ë z1 û ë z2 û ëdz1û édx2ù dy2 ê ú ëdz2û ( t 3 - t 2 ) Bh 1 = 2 t 3-3 t 2 + 1 Bh 2 = - 2 t 3 + 3 t 2 Bh 3 = t 3-2 t 2 + t Bh 4 = t 3 - t 2 11/16/17 Bruce Draper & J. Ross Beveridge 23

From Hermite to Bezier What s wrong with Hermite curves? Nothing, unless you are using a point-and-click interface Bezier curves are like Hermite curves, except that the user specifies four points (p 1, p 2, p 3, p 4 ). The curve goes through p 1 & p 4. Points p 2 & p 3 specify the tangents at the endpoints. 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 24

More Precisely... d R 1 = P 1 = 3(P 2 - P 1 ) dt d R 4 = P 4 = 3(P 4 - P 3 ) dt Tangents at start and end are now defined by intermediate points. Q: Why 3? Why not R 1 =(P 2 -P 1 )? A: Think of 4 evenly spaced points in a line 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 25

Hermite Bezier The Hermite geometry matrix is related to the Bezier geometry matrix by: G H = P1 P4 R1 R4 = 1 0 0 0 0 0 0 1-3 3 0 0 0 0-3 3 P1 P2 P3 P4 = M HB G B 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 26

Hermite Bezier For Hermite curves, Q(t) = T M H G H, where G H = [P 1, P 4, R 1, R 4 ] T, T = [t 3, t 2, t, 1] and M H = 2-2 1 1-3 3-2 -1 0 0 1 0 1 0 0 0 So, Q(t) =T M H M HB G B 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 27

The Bezier Basis Matrix Q(t) =T(M H M HB )G B M B = M H M HB = -1 3-3 1 3-6 3 0-3 3 0 0 1 0 0 0 Q(t) = TM B G B See page 364 to connect with description in our textbook. 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 28

The Bezier Blending Functions Q(t) = P 1 (-t 3 + 3t 2-3t + 1) + P 2 (3t 3-6t 2 + 3t) + P 3 (-3t 3 + 3t 2 ) + P 4 (t 3 ) 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 29

Add them up. ( -t 3 + 3t 2-3t + 1) + ( 3t 3-6t 2 + 3t) + (-3t 3 + 3t 2 ) + ( t 3 ) 0t 3 +0t 2 +0t+1 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 30

Stay within the Convex Hull If you graph the four Bezier blending functions for t=0 to t=1, you find that they are always positive and always sum to one. Therefore, the Bezier curve stays within the convex hull defined by P 1, P 2, P 3 & P 4. 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 31

Examples 1. 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 32

Examples 2. 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 33

Example 3D 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 34

Bezier Curves are Common You have probably already used them. For example, in PowerPoint Build a shape Then select edit points Notice the control wings Enhancements Ways to introduce constraints Smooth Point Straight Point Corner Point 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 35

Stepping Back What should you be learning? Should you memorize M H and M B? No! That s what reference books are for. You should know what G H and G B are. You should know how to derive M H from the parametric form of the cubic equations. You should know how to derive M B from M H. If you understand these concepts, you can look up or rederive the matrices as necessary. 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 36

de Casteljau Curves Now for something completely different. There is another way to motivate curves. P 2 P 3 P 1 Lets say that I have four control points P 4 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 37

To find the midpoint of the curve corresponding to those control points: t=0.5 P 2 P 3 t=0.5 t=0.5 P 1 Connect the point between P 1 and P 2 where t = 0.5 with the point between P 3 & P 2 where t = 0.5; Do the same with the P 2 -P 3 & P 3 -P 4 lines P 4 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 38

Now, connect these two lines at their t = 0.5 points P 2 t=0.5 P 3 t=0.5 t=0.5 t=0.5 P 1 The t = 0.5 point on the resulting segment is P 4 the midpoint (t = 0.5 point) of some type of curve which is made up of weighted averages of the control points (we ll soon see what kind of curve) 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 39

We can extend this idea to any t value. To compute the t = 0.25 point, connect the 0.25 points of the original lines... P 2 t=0.25 P 3 t=0.25 t=0.25 P 1 P 4 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 40

Now, connect these lines at their t = 0.25 locations, and find the point where t = 0.25 of the resulting line P 2 t=0.25 P 3 t=0.25 t=0.25 P 1 In this way, you can compute the 3rd-order curve for any value of t P 4 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 41

Algebraic Definition The equations of the three original lines are: A 1 ( t ) = ( 1 t) P 1 + t P 2 A 2 ( t ) = ( 1 t) P 2 + t P 3 A 3 ( t ) = ( 1 t) P 3 + t P 4 The equations of the next two joining lines are: B 1 ( t ) = ( 1 t) A 1 + t A 2 B 2 ( t ) = ( 1 t) A 2 + t A 3 Finally, the line between the two joining lines is: C 1 ( t ) = ( 1 t) B 1 + t B 2 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 42

Begin Substitutions Substitute equations for A 1 and A 2 into B 1 B 1 ( t ) = ( 1 - t ) ( ( 1 - t ) P 1 + t P 2 ) + t ( ( 1 - t ) P 2 + t P 3 ) = = P 1-2 t P 1 + t 2 P 1 + 2 t P 2-2 t 2 P 2 + t 2 P 3 ( t 2 + 1-2 t ) P 1 + ( - 2 t 2 + 2 t ) P 2 + t 2 P 3 Factoring the result B 1 ( t ) = ( t - 1 ) 2 P 1-2 t ( t - 1 ) P 2 + t 2 P 3 Likewise, substitute A 2 and A 3 into B 2 B 2 ( t ) = ( t 1 ) 2 P 2 2 t ( t 1 ) P 3 + t 2 P 4 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 43

Resulting Third Order Curve Substitute equations for B 1 and B 2 into C 1 C 1 ( t ) = ( 1 - t ) ( ( t - 1 ) 2 P 1-2 t ( t - 1 ) P 2 + t 2 P 3 ) + t ( ( t - 1 ) 2 P 2-2 t ( t - 1 ) P 3 + t 2 P 4 ) = ( - 3 t - t 3 + 3 t 2 + 1 ) P 1 3 2 + ( 3 t - 6 t + 3 t ) P 2 + ( - 3 t 3 + 3 t 2 ) P 3 + t 3 P 4 And After Factoring C 1 ( t ) = ( 1 - t ) 3 P 1 + 3 t ( t - 1 ) 2 P 2-3 t 2 ( t - 1 ) P 3 + t 3 P 4 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 44

Bezier = de Casteljau But those last four functions are exactly the Bezier blending functions! The recursive line intersection algorithm can therefore be used to gain intuition about the behavior of Bezier functions Not something completely different afterall. 11/16/17 CSU CS410 Bruce Draper & J. Ross Beveridge 45