Interpolating curves.

Slides:



Advertisements
Similar presentations
Curves Jim Van Verth Essential Math for Games Animation Problem: want to replay stored set of transformations  Generated by.
Advertisements

College of Computer and Information Science, Northeastern UniversityApril 12, CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2007 Lecture.
Lecture Notes #11 Curves and Surfaces II
© University of Wisconsin, CS559 Spring 2004
COMPUTER GRAPHICS CS 482 – FALL 2014 OCTOBER 8, 2014 SPLINES CUBIC CURVES HERMITE CURVES BÉZIER CURVES B-SPLINES BICUBIC SURFACES SUBDIVISION SURFACES.
Lecture 10 Curves and Surfaces I
CS 445/645 Fall 2001 Hermite and Bézier Splines. Specifying Curves Control Points –A set of points that influence the curve’s shape Knots –Control points.
© University of Wisconsin, CS559 Spring 2004
CS 445 / 645 Introduction to Computer Graphics Lecture 22 Hermite Splines Lecture 22 Hermite Splines.
Dr. S.M. Malaek Assistant: M. Younesi
Slide 127 October 1999CS Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to in Hearn & Baker Splines can be 2D.
Lecture 29 of 42 Bezier Curves and Splines Wednesday, 02 April 2008
Splines II – Interpolating Curves
Curves Chiew-Lan Tai.
Curves Chiew-Lan Tai. Curves 2 Reading Required Hearn & Baker, 8-8 – 8-10, 8-12 Foley, 11.2.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 12: Spline Curves (review) Ravi Ramamoorthi Most material.
Curves Mortenson Chapter 2-5 and Angel Chapter 9
Bezier and Spline Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Modelling: Curves Week 11, Wed Mar 23
Computer Graphics (Fall 2005) COMS 4160, Lecture 7: Curves 2
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Curves Week 13, Mon 24 Nov 2003.
Bezier and Spline Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
COEN Computer Graphics I
1 Representing Curves and Surfaces. 2 Introduction We need smooth curves and surfaces in many applications: –model real world objects –computer-aided.
Curve Surfaces June 4, Examples of Curve Surfaces Spheres The body of a car Almost everything in nature.
Splines III – Bézier Curves
Curve Modeling Bézier Curves
Bresenham’s Algorithm. Line Drawing Reference: Edward Angel’s book: –6 th Ed. Sections 6.8 and 6.9 Assuming: –Clipped (to fall within the window) –2D.
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
A D V A N C E D C O M P U T E R G R A P H I C S CMSC 635 January 15, 2013 Spline curves 1/23 Curves and Surfaces.
Interactive Graphics Lecture 9: Slide 1 Interactive Graphics Lecture 9: Introduction to Spline Curves.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric surfaces.
Chapter VI Parametric Curves and Surfaces
June D Object Representation Shmuel Wimer Bar Ilan Univ., School of Engineering.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric Curves.
Graphics Graphics Korea University cgvr.korea.ac.kr Parametric Curves 고려대학교 컴퓨터 그래픽스 연구실.
CS 445/645 Fall 2001 Splines/Film/Animation. Final Exam Thursday, December 13 th from 7 – 10 p.m. –Room Olsson 011 You may use one sheet of notes (8.5.
Splines IV – B-spline Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
Parametric Surfaces Define points on the surface in terms of two parameters Simplest case: bilinear interpolation s t s x(s,t)x(s,t) P 0,0 P 1,0 P 1,1.
Computer Graphics Representing Curves and Surfaces.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
04/18/02(c) 2002 University of Wisconsin Last Time Hermite Curves Bezier Curves.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Parametric Curves & Surfaces Greg Humphreys University of Virginia CS 445, Spring.
Parametric Curves CS 318 Interactive Computer Graphics John C. Hart.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
1 Graphics CSCI 343, Fall 2015 Lecture 34 Curves and Surfaces III.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
CS559 – Curves Lecture These are course notes (not used as slides) Written by Mike Gleicher, Oct Updates Oct 2006, 2007 Updates Oct 2008 © 2005 Michael.
Rendering Bezier Curves (1) Evaluate the curve at a fixed set of parameter values and join the points with straight lines Advantage: Very simple Disadvantages:
Curves University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
CS552: Computer Graphics Lecture 19: Bezier Curves.
Piecewise Polynomial Parametric Curves Sun-Jeong Kim.
Object Modeling: Curves and Surfaces CEng 477 Introduction to Computer Graphics.
Introduction to Parametric Curve and Surface Modeling.
© University of Wisconsin, CS559 Spring 2004
CS5500 Computer Graphics May 11, 2006
Parametric Curves cgvr.korea.ac.kr.
CSE 167 [Win 17], Lecture 10: Curves 2 Ravi Ramamoorthi
Subdivision curves.
Daniil Rodin for CAGD course, 2016
Parametric Curves.
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Fall 2004
Subdivision curves.
© University of Wisconsin, CS559 Spring 2004
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
CSCE 441: Keyframe Animation/Smooth Curves (Cont.)
Lecture 21: B Spline Curve
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

Interpolating curves

Reading Optional Bartels, Beatty, and Barsky. An Introduction to Splines for use in Computer Graphics and Geometric Modeling, 1987. (See course reader.) University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 2

Parametric curve review

Parametric curves We use parametric curves, Q(u)=(x(u),y(u)), where x(u) and y(u) are cubic polynomials: Advantages: easy (and efficient) to compute “well behaved” infinitely differentiable We also assume that u varies from 0 to 1 University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 4

Various ways to set A,B,C,D 0) Directly – non-intuitive; not very useful. 1) Set positions and derivatives of endpoints: “Hermite Curve” 2) Use “control points” that indirectly influence the curve: “Bezier curve”: - interpolates endpoints - does not interpolate middle control points “B-spline” - does not interpolate ANY control points University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 5

Splines = join cubic curves B-spline Considerations What kind of continuity at join points (“knots”)? C0 = value C1 = first derivative C2 = second derivative How do control points work? University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 6

Spline summary Joined Hermite curves: C1 continuity Interpolates control points B-splines: C2 continuity Does not interpolate control points Can we get… That’s what we’ll talk about towards the end of this lecture. But first, some other useful tips. University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 7

Useful tips for Bézier curves

Displaying Bézier curves How could we draw one of these things? It would be nice if we had an adaptive algorithm, that would take into account flatness. DisplayBezier( V0, V1, V2, V3 ) begin if ( FlatEnough( V0, V1, V2, V3 ) ) Line( V0, V3 ); else something; end; University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 9

Subdivide and conquer DisplayBezier( V0, V1, V2, V3 ) begin if ( FlatEnough( V0, V1, V2, V3 ) ) Line( V0, V3 ); else Subdivide(V[])  L[], R[] DisplayBezier( L0, L1, L2, L3 ); DisplayBezier( R0, R1, R2, R3 ); end; University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 10

Testing for flatness Compare total length of control polygon to length of line connecting endpoints: University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 11

B-spline: - C2 continuity - does not interpolate any ctrl points Tips for B-splines B-spline: - C2 continuity - does not interpolate any ctrl points

Endpoints of B-splines We can see that B-splines don’t interpolate the control points. It would be nice if we could at least control the endpoints of the splines explicitly. There’s a trick to make the spline begin and end at control points by repeating them. In the example below, let’s force interpolation of the last endpoint: (use endpoint 3 times) University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 13

Tips for animator project

Closing the loop What if we want a closed curve, i.e., a loop? With Catmull-Rom and B-spline curves, this is easy: University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 15

C2 interpolating curves

Simple interpolating splines Join several Hermite curves: - Make derivatives match - You still have ability to pick what that matched derivative is. University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 17

Catmull-Rom splines If we set each derivative to be one half of the vector between the previous and next controls, we get a Catmull-Rom spline. This leads to: for any two consecutive interior points pi and pi+1 (we can deal with the endpoints separately if need be) University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 18

Catmull-Rom splines University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 19

Cardinal splines -tension control We can give more control by exposing the derivative scale factor as a parameter: The parameter t controls the tension. Catmull-Rom uses t = 1/2. (p2-p0) (p3-p1) (p4-p2) University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 20

Catmull-Rom blending functions University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 21

C2 interpolating splines How can we keep the C2 continuity we get with B-splines but get interpolation, too? Again start with connected cubic curves. Each cubic segment is an Hermite curve for which we get to set the position and derivative of the endpoints. That leaves us with a spline that’s C0 and C1 such as a Catmull-Rom or Cardinal spline. But interestingly, there are other ways to choose the values of the (shared) first derivatives at the join points. Is there a way to set those derivatives to get other useful properties? University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 22

Find second derivatives So far, we have: C0, C1 continuity Derivatives are still free, as ‘D0…D4’ Compute second derivatives at both sides of every join point: For p1: For p2: … University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 23

Match the second derivatives Now, symbolically set the second derivatives to be equal. For p1 For p2 … University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 24

Not quite done yet How many equations is this? m-1 How many unknowns are we solving for? m+1 We have two additional degrees of freedom, which we can nail down by imposing more conditions on the curve. There are various ways to do this. We’ll use the variant called natural C2 interpolating splines, which requires the second derivative to be zero at the endpoints. This condition gives us the two additional equations we need. At the P0 endpoint, it is: At the Pm endpoint, we have: University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 25

Solving for the derivatives Let’s collect our m+1 equations into a single linear system: It’s easier to solve than it looks. See the notes from Bartels, Beatty, and Barsky for details. University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 26

C2 interpolating spline Once we’ve solved for the real Dis, we can plug them in to find our Bézier or Hermite curves and draw the final spline: Have we lost anything? => Yes, local control. University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 27

Next time: Subdivision curves Basic idea: Represent a curve as an iterative algorithm, rather than as an explicit function. Reading: • Stollnitz, DeRose, and Salesin. Wavelets for Computer Graphics: Theory and Applications, 1996, section 6.1-6.3, A.5. [Course reader pp. 248-259 and pp. 273-274] University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 28