Interactive Graphics Lecture 9: Slide 1 Interactive Graphics Lecture 9: Introduction to Spline Curves.

Slides:



Advertisements
Similar presentations
Interpolating curves.
Advertisements

Lecture Notes #11 Curves and Surfaces II
Lecture 10 Curves and Surfaces I
Interpolation A method of constructing a function that crosses through a discrete set of known data points. .
Cubic Curves CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
ICS 415 Computer Graphics Bézier Splines (Chapter 8)
Cubic Curves CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
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.
Dr. S.M. Malaek Assistant: M. Younesi
Computational Methods in Physics PHYS 3437
Bezier Curves and Splines David Eno MAT 499 Fall ‘06.
Lecture 29 of 42 Bezier Curves and Splines Wednesday, 02 April 2008
Splines II – Interpolating Curves
CSCE 441 Computer Graphics: Keyframe Animation/Smooth Curves Jinxiang Chai.
1 Lecture 13 Modeling Curved Lines and Surfaces. 2 Types of Surfaces Ruled Surfaces B-Splines and Bezier Curves Surfaces of Revolution.
Designing Parametric Cubic Curves Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Drawing Parametric Curves Jean-Paul Mueller. Curves - The parametric form of a curve expresses the value of each spatial variable for points on the curve.
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
RASTER CONVERSION ALGORITHMS FOR CURVES: 2D SPLINES 2D Splines - Bézier curves - Spline curves.
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.
Designing Parametric Cubic Curves
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.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 16.
This Week Week Topic Week 1 Week 2 Week 3 Week 4 Week 5
(Spline, Bezier, B-Spline)
Introduction to Computer Graphics with WebGL
Numerical Computation
Review of Interpolation. A method of constructing a function that crosses through a discrete set of known data points.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
Chapter VI Parametric Curves and Surfaces
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.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric Curves.
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.
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.
Curves: ch 4 of McConnell General problem with constructing curves: how to create curves that are “smooth” CAD problem Curves could be composed of segments.
Interactive Graphics Lecture 10: Slide 1 Interactive Computer Graphics Lecture 10 Introduction to Surface Construction.
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.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
Designing Parametric Cubic Curves 1. 2 Objectives Introduce types of curves ­Interpolating ­Hermite ­Bezier ­B-spline Analyze their performance.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
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
Computing & Information Sciences Kansas State University Lecture 30 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 30 of 42 Wednesday, 09.
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.
Object Modeling: Curves and Surfaces CEng 477 Introduction to Computer Graphics.
Introduction to Parametric Curve and Surface Modeling.
Lecture 24: Surface Representation
(Spline, Bezier, B-Spline)
Chapter 10-2: Curves.
Parametric Curves.
Designing Parametric Cubic Curves
© University of Wisconsin, CS559 Spring 2004
Chapter XVII Parametric Curves and Surfaces
Three-Dimensional Object Representation
Lecture 21: B Spline Curve
Introduction to Parametric Curve and Surface Modeling
Designing Parametric Cubic Curves
Type to enter a caption. Computer Graphics Week 10 Lecture 1.
Presentation transcript:

Interactive Graphics Lecture 9: Slide 1 Interactive Graphics Lecture 9: Introduction to Spline Curves

Interactive Graphics Lecture 13: Slide 2

Interactive Graphics Lecture 9: Slide 3 Splines The word spline comes from the ship building trade where planks were originally shaped by bending them round pegs fixed in the ground. Originally it was the pegs that were referred to as splines. Now it is the smooth curve that is called a spline.

Interactive Graphics Lecture 9: Slide 4 Interpolating Splines Modern splines are smooth curves defined from a small set of points often called knots. In one main class of splines, the curve must pass through each point of the set. These are called interpolating splines

Interactive Graphics Lecture 9: Slide 5 Approximating Splines In other cases the curves do not pass through the points. The points act as control points which the user can move to adjust the shape of the curve interactively

Interactive Graphics Lecture 9: Slide 6 Non Parametric Spline The simplest splines are just equations in x and y (for two dimensions)‏ The most common is the polynomial spline: y = a 2 x 2 + a 1 x + a 0 given three points we can calculate a 2 a 1 and a 0

Interactive Graphics Lecture 9: Slide 7 A non parametric (parabolic spline)‏ P0P0 P1P1 P2P2 y = a 2 x 2 + a 1 x + a 0 There is no control using non parametric splines. Only one curve (a parabola) fits the data.

Interactive Graphics Lecture 9: Slide 8 Parametric Splines If we write our spline in a vector form we get: P = a 2  2 + a 1   + a 0 which has a parameter  by convention, as  ranges from 0 to 1 the point P traces out a curve.

Interactive Graphics Lecture 9: Slide 9 Calculating simple parametric splines We can now solve for the vector constants a 0 a 1 and a 2 as follows. Suppose we want the curve to start at point P 0 P 0 = a 2  2 + a 1  + a 0 we have  =0 at the start so P 0 = a 0

Interactive Graphics Lecture 9: Slide 10 Calculating simple parametric splines Suppose we want the spline to end at P 2 we have that at the end  = 1 thus P 2 = a 2  2 + a 1  + a 0 = a 2 + a 1 + a 0 = a 2 + a 1 + P 0

Interactive Graphics Lecture 9: Slide 11 Calculating simple parametric splines and in the middle (say  = 1/2) we want it to pass through P 1 P 1 = a 2  2 + a 1  + a 0 = a 2  + a 1  + P 0 We have enough equations to solve for a 1 and a 2. Notice that this formulation is the same in 2 and 3 dimensions.

Interactive Graphics Lecture 9: Slide 12 Possibilities using parametric splines P0P0 P1P1 P2P2 P0P0 P1P1 P2P2 P = a 2  2 + a 1   + a 0 P0P0 P1P1 P2P2 P0P0 P1P1 P2P2

Interactive Graphics Lecture 9: Slide 13 Higher order parametric splines Parametric polynomial splines must have an order to match the number of knots. 3 knots - quadratic polynomial 4 knots - cubic polynomial etc. Higher order polynomials are undesirable since they tend to oscillate

Interactive Graphics Lecture 9: Slide 14 Spline Patches To get round the problem, we can piece together a number of patches, each patch being a parametric spline. Patch 1 Patch 3 Patch 2

Interactive Graphics Lecture 9: Slide 15 Cubic Spline Patches The simplest, and most effective way to calculate parametric spline patches is to use a cubic polynomial. P = a 3  3 + a 2  2 + a 1  + a 0 This allows us to join the patches together smoothly

Interactive Graphics Lecture 9: Slide 16 Choosing the gradients P = a 3  3 + a 2  2 + a 1  + a 0 P0P0 P3P3 P1P1 P2P2 Gradient P 1 ' = (P 2 - P 0 )/2 P 2 ' = (P 3 - P 1 )/2

Interactive Graphics Lecture 9: Slide 17 Calculating a Cubic Spline Patch P = a 3  3 + a 2  2 + a 1  + a 0 for a patch joining points P i and P i+1 we have  =0 at P i and  =1 at P i+1 Substituting these values we get P i = a 0 P i+1 = a 3 + a 2 + a 1 + a 0

Interactive Graphics Lecture 9: Slide 18 Calculating a Cubic Spline Patch differentiating P = a 3  3 + a 2  2 + a 1  + a 0 we get P’ = 3a 3  2 + 2a 2  + a 1 substituting for  =0 at P i and  =1 at P i+1 we get P' i = a 1 P' i+1 = 3a 3 + 2a 2 + a 1

Interactive Graphics Lecture 9: Slide 19 Calculating a Cubic Spline Patch Putting these four equations into matrix form we get:

Interactive Graphics Lecture 9: Slide 20 Calculating a Cubic Spline Patch Finally, inverting the matrix gives us the result we want. Notice that the matrix is the same for every patch

Interactive Graphics Lecture 9: Slide 21 Bezier Curves Bezier curves were developed as a method for CAD design. They give very predictable results for small sets of knots, and so are useful as spline patches. The main characteristics of Bezier curves are They interpolate the end points The slope at an end is the same as the line joining the end point to its neighbour

Interactive Graphics Lecture 9: Slide 22 A typical Bezier Curve P0P0 P3P3 P2P2 P1P1

Interactive Graphics Lecture 9: Slide 23 Casteljau’s Algorithm Bezier curves may be computed and visualised using a geometric construction due to Paul de Casteljau. Like a cubic patch, we need a parameter  which is to be 0 at the start of the curve, and 1 at the end. A construction can be made for any value of 

Interactive Graphics Lecture 9: Slide 24 P 0,0 P 0,3 P 0,2 P 0,1 P 3,0 P 2,0 P 2,1 P 1,0 P 1,1 P 1,2 Casteljau’s Construction  = 0.25

Interactive Graphics Lecture 9: Slide 25 Casteljau’s Construction  = 0.5 P 0,0 P 0,3 P 0,2 P 0,1 P 3,0 P 2,0 P 2,1 P 1,0 P 1,1 P 1,2

Interactive Graphics Lecture 9: Slide 26 P 0,0 P 0,3 P 0,2 P 0,1 P 3,0 P 2,0 P 2,1 P 1,0 P 1,1 P 1,2 Casteljau’s Construction  = 0.75

Interactive Graphics Lecture 9: Slide 27 Bernstein Blending Function Splines (including Bezier curves) can be formulated as a blend of the knots. Consider the vector line equation P = (1-   )P 0 +  P 1 It is a linear ‘blend’ of two points, and could also be considered the 2 point Bezier curve!

Interactive Graphics Lecture 9: Slide 28 Blending Equation Any point on the spline is simply a blend of all the other points. For N+1 knots we have: where W is the Bernstein blending function

Interactive Graphics Lecture 9: Slide 29 Expanded Bezier Equations 2 Point:P 0 (1-  ) + P 1  3 Point: P 0 (1-  )  + 2P 1 (1-  )  + P 2   4 Point: P 0 (1-  )  + 3P 1 (1-  )    + 3P 2 (1-  )   + P 3   etc

Interactive Graphics Lecture 9: Slide 30 Bezier Curves lack local control Since all the knots of the Bezier curve all appear in the blend they cannot be used for curves with fine detail. However they are very effective as spline patches.

Interactive Graphics Lecture 9: Slide 31 Four point Bezier Curves and Cubic Patches Four point Bezier curves are equivalent to cubic patches going through the first and last knot (P0 and P3)‏ It is possible to show their equivalence in two ways: Expanding the iterative blending equation Reversing the de Casteljau algorithm

Interactive Graphics Lecture 9: Slide 32 Expanding the blending equation For the case of four knots we can expand the Bernstein blending function to get a polynomial in  : This can be multiplied out to give an equation of the form: where:

Interactive Graphics Lecture 9: Slide 33 Casteljau’s algorithm gives the same result P 0,0 P 0,3 P 0,2 P 0,1 P 3,0 P 2,0 P 2,1 P 1,0 P 1,1 P 1,2 We start from point P 3,0 and express it in terms of its construction line. Then the process is continued.

Interactive Graphics Lecture 9: Slide 34 Continuing expanding We can drop the first subscript (which indicates the recursion level) to get: which is the same as before

Interactive Graphics Lecture 9: Slide 35 Control Points We can summarise the four point Bezier Curve by saying that it has two points that are interpolated and two control points. The curve starts at P 0 and ends at P 3 and its shape can be determined by moving control points (P 1 and P 2 ). This could be done interactively using a mouse.

Interactive Graphics Lecture 9: Slide 36 In summary The simplest and most effective way to draw a smooth curve through a set of points is to use a cubic patch. If no interaction is needed setting the gradients by the central difference (P i+1 - P i-1 )/2 is effective. If the user wants to interactively adjust the shape the four point Bezier formulation is ideal