CS 376 Introduction to Computer Graphics 04 / 23 / 2007 Instructor: Michael Eckmann.

Slides:



Advertisements
Similar presentations
Splines I – Curves and Properties
Advertisements

© University of Wisconsin, CS559 Spring 2004
2002 by Jim X. Chen: Bezier Curve Bezier Curve.
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
1 Curves and Surfaces. 2 Representation of Curves & Surfaces Polygon Meshes Parametric Cubic Curves Parametric Bi-Cubic Surfaces Quadric Surfaces Specialized.
Slide 127 October 1999CS Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to in Hearn & Baker Splines can be 2D.
CS 376 Introduction to Computer Graphics 02 / 09 / 2007 Instructor: Michael Eckmann.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 12: Spline Curves (review) Ravi Ramamoorthi Most material.
1. 2 The use of curved surfaces allows for a higher level of modeling, especially for the construction of highly realistic models. There are several approaches.
Modelling: Curves Week 11, Wed Mar 23
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Curves Week 13, Mon 24 Nov 2003.
Designing Parametric Cubic Curves
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.
CS 376 Introduction to Computer Graphics 04 / 27 / 2007 Instructor: Michael Eckmann.
Computer Graphics Lecture 13 Curves and Surfaces I.
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.
Curves and Surfaces CSE3AGR - Paul Taylor Polynomials of Degree n Degree is equal to the highest exponent of a term. Higher exponents result in.
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.
CS 376 Introduction to Computer Graphics 04 / 30 / 2007 Last Lecture :( Instructor: Michael Eckmann.
Numerical Computation
Curves.
Review of Interpolation. A method of constructing a function that crosses through a discrete set of known data points.
CS 376 Introduction to Computer Graphics 04 / 20 / 2007 Instructor: Michael Eckmann.
INTERPOLATION & APPROXIMATION. Curve algorithm General curve shape may be generated using method of –Interpolation (also known as curve fitting) Curve.
June D Object Representation Shmuel Wimer Bar Ilan Univ., School of Engineering.
Splines IV – B-spline Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Representation of Curves and Surfaces Graphics.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
Basic Theory (for curve 02). 1.3 Parametric Curves  The main aim of computer graphics is to display an arbitrary surface so that it looks real.  The.
CS 445 / 645 Introduction to Computer Graphics Lecture 23 Bézier Curves Lecture 23 Bézier Curves.
Representation of Curves & Surfaces Prof. Lizhuang Ma Shanghai Jiao Tong University.
L5 – Curves in GIS NGEN06 & TEK230: Algorithms in Geographical Information Systems by: Sadegh Jamali (source: Lecture notes in GIS, Lars Harrie) 1 L5-
11/6/ :55 Graphics II Introduction to Parametric Curves and Surfaces Session 2.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Parametric Curves & Surfaces Greg Humphreys University of Virginia CS 445, Spring.
Splines I – Curves and Properties based on: Michael Gleicher Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
Computing & Information Sciences Kansas State University Lecture 31 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 32 of 42 Wednesday, 11.
(c) 2002 University of Wisconsin
Designing Parametric Cubic Curves 1. 2 Objectives Introduce types of curves ­Interpolating ­Hermite ­Bezier ­B-spline Analyze their performance.
1 Graphics CSCI 343, Fall 2015 Lecture 34 Curves and Surfaces III.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 12: Curves 1
College of Computer and Information Science, Northeastern UniversityFebruary 27, CS U540 Computer Graphics Prof. Harriet Fell Spring 2009 Lectures.
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.
CS552: Computer Graphics Lecture 18: Representing Cubic Splines.
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
Curve & Surface.
Representation of Curves & Surfaces
Chapter 10-2: Curves.
CS 430/536 Computer Graphics I Intro to Curves Week 4, Lecture 7
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
Implicit Functions Some surfaces can be represented as the vanishing points of functions (defined over 3D space) Places where a function f(x,y,z)=0 Some.
UNIT-5 Curves and Surfaces.
Introduction to Parametric Curve and Surface Modeling
Type to enter a caption. Computer Graphics Week 10 Lecture 1.
Presentation transcript:

CS 376 Introduction to Computer Graphics 04 / 23 / 2007 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS Spring 2007 Today’s Topics Questions? Piecewise Cubic Parametric curves –Hermite –Bezier –Spline

Michael Eckmann - Skidmore College - CS Spring 2007 Curves Some motivations for having mathematical equations define curves and surfaces 1) polylines and polygons are 1 st degree piecewise linear approximations to curves and surfaces (they are approximations unless they are the exact description of the outline or shape) –if they are approximations, then it takes large numbers of points to describe them for more accurate representations == BAD –if interactively building these surfaces (or edges/outlines) then the more points, the more tedious it is to build We want to be able to get more accurate representations of curved surfaces (or edges/outlines) than polygons or polylines give us AND we want to be able to represent them with less points. This will benefit us by having less storage and be more easily built interactively.

Michael Eckmann - Skidmore College - CS Spring 2007 Curves These smooth curves are also used in graphics for other purposes like describing a motion path for an animation sequence.

Michael Eckmann - Skidmore College - CS Spring 2007 Curves Let's consider 2d dimensional curves which can be later generalized to 3d surfaces. Instead of using piecewise linear functions, we use piecewise smooth curves. These are of a higher degree than linear functions. We have several choices –a) we can use functions like y = f(x) problem that for each value of x there is one and only one y value –can't represent circles/ellipses etc. problem that you can't represent vertical lines and is problematic to represent curves with a tangent/slope of infinity –b) we can use implicit equations like f(x,y) = 0 (e.g. a circle of radius 1 like: x 2 + y 2 – 1 = 0) may have more solutions than we want --- e.g. to model half a circle you'd need constraints on the values of x or y or both. joining 2 implicitly defined curves is hard to make the tangents at the join point agree

Michael Eckmann - Skidmore College - CS Spring 2007 Curves We have several choices –c) we can use parametric equations of the curve x = f(t) and y = g(t) –where f(t) and g(t) are typically cubic polynomials the problems of the other 2 choices are solved as we shall see –we typically use cubic polynomials because 1) quadratic or linear polynomials do not allow a curve segment to be described with 2 endpoints and specific slopes at the 2 endpoints (examples on the board) 2) higher degree (than 3) polynomials are more compute intensive and allow (possibly) unwanted artefacts in the curve A cubic polynomial to define a finite curve segment has 4 coefficients per parametric equation 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 where 0 <= t <= 1

Michael Eckmann - Skidmore College - CS Spring 2007 Curves 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 where 0 <= t <= 1 can be written in matrix form as: Q(t) = [x(t) y(t) z(t)] = T C where T = [t 3 t 2 t 1] and [a x a y a z ] C = [b x b y b z ] [c x c y c z ] [d x d y d z ]

Michael Eckmann - Skidmore College - CS Spring 2007 Curves Continuity - when joining two curve segments together (piecewise curves). There are several different kinds of continuity to consider Geometric continuity –G 0 geometric continuity = the curve segments are joined together –G 1 geometric continuity = the curve segments are joined together and the directions of tangent vectors are equal at the point where they are joined Parametric continuity –C 0 parametric continuity = same as G 0 geometric continuity –C 1 parametric continuity = the curve segments are joined together and the directions AND magnitudes of tangent vectors are equal at the point where they are joined –C k parametric continuity = the curve segments are joined together and the directions AND magnitudes of all the derivatives up to the k th are equal at the point where they are joined (that is, the 1 st through k th derivatives exist and are continuous themselves)

Michael Eckmann - Skidmore College - CS Spring 2007 Curves Let me draw on the board some example joined curve segments and point out their continuity.

Michael Eckmann - Skidmore College - CS Spring 2007 Curves There are several families of cubic polynomial curve segments that are determined by different things –Hermite determined by the 2 endpoints and the tangent vector at each of the 2 endpoints –Bezier determined by the 2 endpoints P 1 & P 4 and 2 other intermediate points P 2 & P 3 not on the curve –the tangent vectors at the end points are the vectors P 1 P 2 and P 3 P 4 –which are [P 2 – P 1 ] and [P 4 – P 3 ] –Spline determined by 4 specific points Note: there can be higher degree polynomials of these families of curves (see a few slides ahead for a 4 th degree polynomial Bezier curve segment)

Hermite Curve segment examples (on the board)

Bezier Curve segment examples

more Bezier Curve segment examples

Michael Eckmann - Skidmore College - CS Spring 2007 Recall 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 where 0 <= t <= 1 can be written in matrix form as: Q(t) = [x(t) y(t) z(t)] = T C where T = [t 3 t 2 t 1] and [a x a y a z ] C = [b x b y b z ] [c x c y c z ] [d x d y d z ]

Michael Eckmann - Skidmore College - CS Spring 2007 Basis Matrix and Geometry Matrix Q(t) = [x(t) y(t) z(t)] = T C where T = [t 3 t 2 t 1] and [a x a y a z ] C = [b x b y b z ] [c x c y c z ] [d x d y d z ] can be rewritten so that C = M G where –M is a 4x4 matrix called the Basis Matrix and –G is a 4x1 column vector called the Geometry Matrix so Q(t) = T M G

Michael Eckmann - Skidmore College - CS Spring 2007 Recall Q(t) = [x(t) y(t) z(t)] = T M G where T = [t 3 t 2 t 1] and [m 11 m 12 m 13 m 14 ] M = [m 21 m 22 m 23 m 24 ] [m 31 m 32 m 33 m 34 ] [m 41 m 42 m 43 m 44 ] [G 1 ] G = [G 2 ] [G 3 ] [G 4 ] Note: the values of G i are the conditions that define the curve --- such as endpoints and tangent vectors at those end points

Michael Eckmann - Skidmore College - CS Spring 2007 Blending functions look at x(t) x(t) = (t 3 m 11 + t 2 m 21 + t m 31 + m 41 )g 1x + (t 3 m 12 + t 2 m 22 + t m 32 + m 42 )g 2x + (t 3 m 13 + t 2 m 23 + t m 33 + m 43 )g 3x + (t 3 m 14 + t 2 m 24 + t m 34 + m 44 )g 4x where g 1x is the x coordinate of G 1 similar equations for y(t) and z(t) the curve is a weighted sum of the elements of the Geometry Matrix where the weights are cubic polynomials of t which are called the Blending Functions the Blending Functions B are given by B = T M so Q(t) = B G

Michael Eckmann - Skidmore College - CS Spring 2007 Example with lines Recall the parametric equation of a line: x(t) = x 0 + t ( x end – x 0 ) y(t) = y 0 + t ( y end – y 0 ) z(t) = z 0 + t ( z end – z 0 ) what are the endpoints of the line segment described above? can be rewritten as: x(t) = a x t + b x y(t) = a y t + b y y(t) = a z t + b z

Michael Eckmann - Skidmore College - CS Spring 2007 x(t) = a x t + b x y(t) = a y t + b y y(t) = a z t + b z To get this in the form of Q(t) = T C = T M G T = [ t 1 ] and C = [ a x a y a z ] [ b x b y b z ] C = M G where M = [ m 11 m 12 ] and G = [ g 1x g 1y g 1z ] [ m 21 m 22 ] [ g 2x g 2y g 2z ] Example with lines

Michael Eckmann - Skidmore College - CS Spring 2007 The geometry matrix is simply the two endpoints G = [ G 1 ] = [ g 1x g 1y g 1z ] = [ x 0 y 0 z 0 ] = [ P 0 ] [ G 2 ] [ g 2x g 2y g 2z ] [ x end y end z end ] [ P 1 ] we need to find out the Basis Matrix M M = [ m 11 m 12 ] [ m 21 m 22 ] Q(t) = T M G = [ t 1 ] M G Let's do the rest on the board to figure out M Example with lines

Michael Eckmann - Skidmore College - CS Spring 2007 Q(t) = T M G = [ t 1 ] M G Recall that T M are the blending functions. What then, are the blending functions of lines? Example with lines

Michael Eckmann - Skidmore College - CS Spring 2007 Q(t) = T C = T M G = [ t 3 t 2 t 1 ] M G M is the 4x4 Basis matrix and G is the Geometry matrix For Hermite curve segments, recall that they are defined with 2 endpoints and the tangents at those endpoints. So, the Geometry matrix is made up of the 2 endpoints and the 2 tangent vectors. The tangent vectors are determined by the derivative of the curve with respect to t at each of the end points (when t=0 and when t=1). 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 where 0 <= t <= 1 x'(t) = 3a x t 2 + 2b x t + c x y'(t) = 3a y t 2 + 2b y t + c y z'(t) = 3a z t 2 + 2b z t + c z Hermite Basis Matrix and Blending Functions

Michael Eckmann - Skidmore College - CS Spring 2007 x'(t) = 3a x t 2 + 2b x t + c x y'(t) = 3a y t 2 + 2b y t + c y z'(t) = 3a z t 2 + 2b z t + c z So, Q'(t) = [ 3t 2 2t 1 0 ] C agreed? Let's call the 2 endpoints in the Geometry Matrix P 1 and P 4 and the 2 tangent vectors at those 2 endpoints R 1 and R 4. [ P 1 ] G = [ P 4 ] [ R 1 ] [ R 4 ] Hermite Basis Matrix and Blending Functions

Michael Eckmann - Skidmore College - CS Spring 2007 Let's just work with the x coordinates (the y and z coordinates will be handled similarly) So, x(t) = a x t 3 + b x t 2 + c x t + d x = T C x = [ t 3 t 2 t 1 ] M G x and x'(t) = 3a x t 2 + 2b x t + c x = T C x = [ 3t 2 2t 1 0 ] M G x when t = 0, x(t) gets us the first endpoint and when t = 1, x(t) gets us the other endpoint. x(0) = P 1 = [ ] M G x x(1) = P 4 = [ ] M G x when t = 0, x'(t) gets us the tangent at the first endpoint and when t = 1, x'(t) gets us the tangent at the other endpoint. x'(0) = R 1 = [ ] M G x x'(1) = R 4 = [ ] M G x Hermite Basis Matrix and Blending Functions

Michael Eckmann - Skidmore College - CS Spring 2007 [P 1 ] [ ] [P 4 ] = G x = [ ] M G x [R 1 ] [ ] [R 4 ] [ ] just like when we solved for M (the basis matrix) with the line equations, we do the same thing here because clearly [ ] [ ] M = Identity [ ] [ ] so, that matrix on the left is equal to M -1 Hermite Basis Matrix and Blending Functions

Michael Eckmann - Skidmore College - CS Spring 2007 There are techniques to get the inverse of a matrix which we won't go into here --- if you've had linear algebra, you should know how. The inverse of [ ] [ ] [ ] [ ] is [ ] [ ] [ ] [ ] This is the Basis Matrix for Hermite curve segments. Let's verify that it is indeed the inverse of the matrix above. Hermite Basis Matrix and Blending Functions