Splines Vida Movahedi January 2007.

Slides:



Advertisements
Similar presentations
Lecture 14 Curves and Surfaces II
Advertisements

Splines IV – B-spline Curves
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. .
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
Jehee Lee Seoul National University
MATH 685/ CSI 700/ OR 682 Lecture Notes
B-Spline Blending Functions
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
1 Curves and Surfaces. 2 Representation of Curves & Surfaces Polygon Meshes Parametric Cubic Curves Parametric Bi-Cubic Surfaces Quadric Surfaces Specialized.
Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 161 Today’s class Curve fitting Evaluators Surfaces.
CS CS 175 – Week 9 B-Splines Definition, Algorithms.
Rational Bezier Curves
1cs426-winter-2008 Notes  Ian Mitchell is running a MATLAB tutorial, Tuesday January 15, 5pm-7pm, DMP 110 We won’t be directly using MATLAB in this course,
CS CS 175 – Week 8 Bézier Curves Definition, Algorithms.
1 Lecture 13 Modeling Curved Lines and Surfaces. 2 Types of Surfaces Ruled Surfaces B-Splines and Bezier Curves Surfaces of Revolution.
Geometric Modeling Surfaces Mortenson Chapter 6 and Angel Chapter 9.
Cubic Bezier and B-Spline Curves
1 Dr. Scott Schaefer Catmull-Rom Splines: Combining B-splines and Interpolation.
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.
CS Subdivision I: The Univariate Setting Peter Schröder.
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.
Curve Modeling B-Spline Curves
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 / 23 / 2007 Instructor: Michael Eckmann.
(Spline, Bezier, B-Spline)
V. Space Curves Types of curves Explicit Implicit Parametric.
Introduction to Computer Graphics with WebGL
Extrapolation Models for Convergence Acceleration and Function ’ s Extension David Levin Tel-Aviv University MAIA Erice 2013.
Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 1 2D Spline Curves CS 465 Lecture 15.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
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.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
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.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 15 General Least Squares and Non- Linear.
11/26/02(C) University of Wisconsin Last Time BSplines.
Parametric Curves CS 318 Interactive Computer Graphics John C. Hart.
(c) 2002 University of Wisconsin
Slide 129 October 1999CS Computer Graphics (Top Changwatchai) Bézier Curves - Results of Derivation Tangents at endpoints are equal to endpoint slopes.
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.
Splines Sang Il Park Sejong University. Particle Motion A curve in 3-dimensional space World coordinates.
CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann.
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:
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
Curves University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
Introduction to Parametric Curve and Surface Modeling.
B(asis)-Splines Ashish Myles CISE, UF. Splines ● Piecewise polynomial ● More flexible than single polynomials – can have finite support – can be periodic.
© University of Wisconsin, CS559 Spring 2004
ECE3340 Numerical Fitting, Interpolation and Approximation
Lecture 22: B Spline Curve Properties
(Spline, Bezier, B-Spline)
2D Spline Curves CS 465 Lecture 15 © 2004 Steve Marschner • 1.
© University of Wisconsin, CS559 Spring 2004
Curves and Surfaces.
Spline Interpolation Class XVII.
PPT3: B-spline Curves and Surfaces
SKTN 2393 Numerical Methods for Nuclear Engineers
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

Splines Vida Movahedi January 2007

Outline Piecewise polynomials Splines Two approaches B-splines Multivariate functions Examples

What problem splines solve? In the simplest situation, one is given points (ti, yi) and is looking for a piecewise polynomial function f that satisfies f(ti)=yi , all i, more or less. Exact fit  Interpolation Approximate fit  least squares approximation or smoothing splines Or we have a complex function g that we want to approximate with a piecewise polynomial function f that satisfies f(ti)=g(ti) , all i, more or less.

Why polynomials? Easy evaluation, differentiation, and integration If done properly, the work needed for data fitting grows only linearly with the number of data points.

Definition of Polynomial of order n Note that a polynomial of order n has degree<n The set of all polynomials of order n forms a linear space <n: linear space of polynomials of order n

Why piecewise polynomials? Jackson’s Theorem: If g has r continuous derivatives on [a..b] and n> r+1, then The only way to make the error small is to make (b-a)/ (n-1) small  partitioning [a..b]  using piecewise polynomial approximation. It is usually much more efficient to make (b-a) small than to increase n. This is the justification for piecewise polynomial approximation.

Why not higher order polynomials? We expect the error between the function g and the polynomial approximation pn on n sites to decrease when n increases. If the sites are uniformly spaced, it can be shown that this is not true and the interpolation error increases with n for some examples. It is shown that choosing the sites as the zeros of the Chebyshev polynomial of degree n can lead to much decreasing interpolation error with increasing n. For some examples, the error, while decreasing, decreases far too slowly.

What is a spline? An interval [a..b] is subdivided into sufficiently small intervals [j.. j+1], with a=1<…<l+1=b, On each such interval, a polynomial pj of relatively low degree can provide a good approximation to g. This can even be done in such a way that the polynomial pieces blend smoothly, i.e. so that the resulting composite function s(x) that equals pj(x) for x[j j+1] , all j , has several continuous derivatives. Any such smooth piecewise polynomial function is called a spline.

Continuous 1st derivative Continuous 2nd derivative

Two major approaches The ppform: Use of piecewise polynomials The B-form: Use of Basis functions

ppform More efficient when evaluating the spline extensively The ppform of a polynomial spline of order k provides a description in terms of its breaks 1,…,l+1 and the local polynomial coefficients cji of its l pieces. For linear approximation

Example g(x)=sin(x) >> x=0:0.6:pi; y=sin(x); >> figure; plot (x,y, 'o') >> sp=spapi(2,x,y); >> hold on; fnplt(sp); >> pp=sp2pp(sp); >>fnbrk(pp) The input describes a ppform breaks(1:l+1) Columns 1 through 5 0 0.6000 1.2000 1.8000 2.4000 Column 6 3.0000 coefficients(d*l,k) 0.9411 0 0.6123 0.5646 0.0697 0.9320 -0.4973 0.9738 -0.8906 0.6755 pieces number l 5 order k 2 dimension d of target 1 Breaks (interpolation) Interpolating spline of order 2 The ppform provides the coefficients for each of the polynomial pieces between the breaks. In the above example the coefficients for each of the lines is provided.

The B-form Useful during construction of a spline The B-form describes a spline as a weighted sum of B-splines of the required order k, with their number n>k-1+l Each Bj,k is defined on an interval [tj..tj+k] and is zero elsewhere. tj are called knots and are provided based on the smoothness required (breaks, but sometimes repeated!) B-splines are functions that:

(uniform spacing between knots) Example B-splines of order 2 (uniform spacing between knots)

Note that in ppform, we had 6 breaks, and 10 coefficients. Example (cont.) >> fnbrk(sp) The input describes a B-form knots(1:n+k) Columns 1 through 7 0 0 0.6000 1.2000 1.8000 2.4000 3.0000 Column 8 3.0000 coefficients(d,n) 0 0.5646 0.9320 0.9738 0.6755 0.1411 number n of coefficients 6 order k 2 dimension d of target 1 Note that in ppform, we had 6 breaks, and 10 coefficients.

Control Points aj are called the control points If B are B-splines  aj are de Boor control points If B are Bezier splines  aj are Bezier control points Bezier Control Points de Boor Control Points for B-splines

Why B-splines? Composed of (n-k+2) curves of k-order joined Ck-2 continuously at knot values (t0,…,tn+k)  smoothness and continuity Each point is affected by k control points Each control point affects k segments  local controllability Inside convex hull  Built-in boundedness  does not shoot to infinity (unlike Bezier) Affine invariance Any degree of detail desired  Generative nature

Uniform B-splines If the knots are equi-spaced, for a given order k, the splines are simply shifted copies of one another. Linear B-splines (k=2) Cubic B-splines (k=4)

knot multiplicity Knots are a sequence of breaks, sometimes repeated! The rule is Knot multiplicity + condition multiplicity = order For example, for a B-spline of order k=3 Simple knot  smoothness_cond=2  continuity of function and first derivative Double knot  smoothness_cond= 1  just continuity Triple knot  No condition  function can even be discontinuous

Multivariate Functions If f is a function of x, and g is a function of y, then their tensor-product p(x,y):=f(x)g(y) is a function of x and y. For example for a bivariate spline of order h in x and k in y, we have: Knot sequences s= (s1,…, sm+h) t= (t1,…,tn+k) Coefficients (aij:i=1..m, j=1..n)

Chord-Length Method The knots must be non-decreasing! So, what should we do for closed curves?! [1,4,7,10,6,3]  not acceptable t: new variable , increasing as we follow the contour x and y will be functions of t

Representing Image Contours Contour from Paco’s grouping algorithm

Interpolation unit step: 50

Interpolation unit step: 10

Smoothing unit step: 50

Smoothing unit step: 10

Note the corners At least one sample from each line? Unit step: 20

Questions? Which method is better? Interpolation or smoothing? What order? Linear, cubic, …? How can we calculate the error? Should we compare with the original lines? Or with image?

References Matlab Spline Toolbox Carl de Boor, A Practical Guide to Splines, Springer, 2001. ‘An Interactive Introduction to Splines’, http://www.ibiblio.org/e-notes/Splines/Intro.htm Cohen, F.S.; Wang, J.Y. , “Part I: Modeling Image Curves Using Invariant 3-D Object Curve Models- A Path to 3-D Recognition and Shape Estimation from Image Contours”, IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 16, no. 1, Jan. 1994. Miroslaw Kuc, COSC 4080.03 Project report: “Representing Image Contours with Splines”, Jan. 2005 Branka Otasevic, COSC 4080.03 Project report, Winter 1999.