Interpolating Splines, Implicit Descriptions Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday, March 5,

Slides:



Advertisements
Similar presentations
Interpolating curves.
Advertisements

Lecture Notes #11 Curves and Surfaces II
Computer Graphics (Spring 2008) COMS 4160, Lecture 6: Curves 1
© 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
B-Spline Blending Functions
1 Curves and Surfaces. 2 Representation of Curves & Surfaces Polygon Meshes Parametric Cubic Curves Parametric Bi-Cubic Surfaces Quadric Surfaces Specialized.
Splines II – Interpolating Curves
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 12: Spline Curves (review) Ravi Ramamoorthi Most material.
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
Modeling of curves Needs a ways of representing curves: Reproducible - the representation should give the same curve every time; Computationally Quick;
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
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
Bezier and Spline Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
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.
Polygon Lists & 3-D File Formats Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, February 18, 2002.
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
Numerical Computation
1 Dr. Scott Schaefer Smooth Curves. 2/109 Smooth Curves Interpolation  Interpolation through Linear Algebra  Lagrange interpolation Bezier curves B-spline.
Bézier Algorithms & Properties Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, March 3, 2004.
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.
Chapter VI Parametric Curves and Surfaces
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 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.
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.
Bézier Curves & Surfaces Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, March 1, 2004.
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.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Parametric Curves & Surfaces Greg Humphreys University of Virginia CS 445, Spring.
11/26/02(C) University of Wisconsin Last Time BSplines.
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.
(c) 2002 University of Wisconsin
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann.
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.
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.
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.
© University of Wisconsin, CS559 Spring 2004
CS5500 Computer Graphics May 11, 2006
Curve & Surface.
CSE 167 [Win 17], Lecture 9: Curves 1 Ravi Ramamoorthi
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
CSCE 441: Keyframe Animation/Smooth Curves (Cont.)
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

Interpolating Splines, Implicit Descriptions Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday, March 5, 2004

5 Mar 2004CS 481/6812 Review: Bézier Algorithms [1/3] The de Casteljau Algorithm computes a point on a Bézier curve using this repeated lirping procedure. Each lirp is done using the same value of t. x, y, and z are computed separately. lirp P0P0 P1P1 P2P2 P3P3 P4P4 Point on curve

5 Mar 2004CS 481/6813 Review: Bézier Algorithms [2/3] Another way to draw a Bézier curve is to use the polynomial that describes it to compute coordinates of points. If there are n control points (P 0, P 1, …, P n–1 ), then a Bézier curve is parameterized by a polynomial of degree n–1. For four control points the polynomial is P 0 ·(1–t) 3 + P 1 ·3(1–t) 2 t + P 2 ·3(1–t)t 2 + P 3 ·t 3. This is made up of pieces called Bernstein polynomials. B 3 0 (t) = (1–t) 3. B 3 1 (t) = 3(1–t) 2 t. B 3 2 (t) = 3(1–t)t 2. B 3 3 (t) = t 3. The pattern: Descending powers of (1–t). Ascending powers of t. Coefficients are binomial coefficients. Found in Pascal’s Triangle.

5 Mar 2004CS 481/6814 Review: Bézier Algorithms [3/3] The way we described Bézier surfaces last time suggests how to extend curve-drawing algorithms to surfaces. Say we have a grid of 9 control points, as shown. The horizontal curves have the following formulas: P 0,0 ·(1–t) 2 + P 0,1 ·2(1–t)t + P 0,2 ·t 2 P 1,0 ·(1–t) 2 + P 1,1 ·2(1–t)t + P 1,2 ·t 2 P 2,0 ·(1–t) 2 + P 2,1 ·2(1–t)t + P 2,2 ·t 2 Now we use points on these curves as control points. Let our vertical parameter be s. We obtain the following formula for a Bézier patch: [ P 0,0 ·(1–t) 2 + P 0,1 ·2(1–t)t + P 0,2 ·t 2 ]·(1–s) 2 + [ P 1,0 ·(1–t) 2 + P 1,1 ·2(1–t)t + P 1,2 ·t 2 ]·2(1–s)s + [ P 2,0 ·(1–t) 2 + P 2,1 ·2(1–t)t + P 2,2 ·t 2 ]·s 2 P 0,0 P 0,1 P 0,2 P 1,0 P 1,1 P 1,2 P 2,0 P 2,1 P 2,2

5 Mar 2004CS 481/6815 Review: Bézier Properties [1/3] Two properties of Bézier curves are worth another look: Affine Invariance Convex-Hull Property An affine transformation is a transformation that can be produced by doing a linear transformation followed by a translation. All of the transformations we have dealt with, except for perspective projection, are affine. Bézier curves have the property that applying an affine transformation to each control points results in the same transformation being applied to every point on the curve. This property is called affine invariance. For example, to rotate a Bézier curve, apply a rotation to the control points. In short: Transformations act the way you want them to.

5 Mar 2004CS 481/6816 The convex hull of a set of points is the smallest convex region containing them. Informally speaking, “lasso” (or shrink-wrap) the points; the region inside the lasso is the convex hull. A Bézier curve lies entirely in the convex hull of its control points. This is called the convex-hull property. This property makes it easy to specify where a curve will not go. Smooth interpolating splines never have this property. Review: Bézier Properties [2/3] P1P1 P0P0 P2P2 P1P1 P0P0 P2P2 PointsConvex hull P1P1 P0P0 P2P2

5 Mar 2004CS 481/6817 Review: Bézier Properties [3/3] Bézier curves do not interpolate all their control points. So we can easily specify where it does not go, but not where it does go. Bézier curves also do not have “local control”. A curve has local control if moving a single control point only changes a small part of the curve (the part near the control point). Moving any control point on a Bézier curve changes the whole curve. This is the main reason we do not use Bézier curves with a large number of control points. Instead, we piece together several 3- or 4-point Bézier curves in a smooth way. This multiple-Bézier curve does have local control.

5 Mar 2004CS 481/6818 Review: Building Better Curves The biggest problems with Bézier curves are: Lack of local control. High degree, if there are a large number of control points. Lack of interpolation (sometimes a problem, sometimes not). Better curve #1: B-spline. Parametric curve described by polynomials based on control points. Has affine invariance & local control. Has same degree regardless of number of control points. Approximating, has convex-hull property. Better curve #2: Catmull-Rom spline. Parametric curve described by polynomials based on control points. Has affine invariance & local control. Has same degree (3) regardless of number of control points. Interpolating, no convex-hull property, (and a bit tough to get “just right”). Better curve #3: NURBS (Non-Uniform Rational B-Spline). Parametric curve described by rational functions based on control points. Has affine invariance & local control. Very general & adaptable, but thus somewhat tougher to use. Built into GLU.

5 Mar 2004CS 481/6819 Interpolating Splines: Overview We would like to define an interpolating spline with lots of convenient properties. We can get pretty much all the good properties, except for the convex-hull property. Remember that smooth, interpolating splines never have this property. Some interpolating splines require additional information, besides their control points. Our goal is not to require this. Our goal is called a Catmull-Rom spline. We will reach this goal in three steps. Hermite Curves Interpolating splines that require a vector to be specified at each control point. Cardinal Splines Nearly to the goal, but there is a “tension” parameter. Catmull-Rom Splines The goal.

5 Mar 2004CS 481/68110 Interpolating Splines: Hermite Curves — Idea [1/2] The first step toward our goal is an Hermite curve. French again. Say “air-MEET”. Clear your throat a little during the “r”, and you’ll have it perfect. An Hermite curve is an interpolating spline whose formulas are cubic (degree  3) polynomials. We look at the segment between two control points: P i and P i+1. At each control point, we specify a velocity (or direction) vector. Call the vectors v i and v i+1. P i+1 PiPi vivi v i+1

5 Mar 2004CS 481/68111 Interpolating Splines: Hermite Curves — Idea [2/2] It turns out that there is a unique cubic polynomial that meets the following four constraints: At t = 0, its value is P i. At t = 1, its value is P i+1. At t = 0, its derivative is v i. At t = 1, its derivative is v i+1. Remember that the value of this polynomial is a point in space. So it will have the form f(t) = At 3 + Bt 2 + Ct + D, where A, B, C, and D are points/vectors. P i+1 PiPi vivi v i+1

5 Mar 2004CS 481/68112 Interpolating Splines: Hermite Curves — Computations Again, there is a unique cubic polynomial f(t) = At 3 + Bt 2 + Ct + D that meets the following four constraints: At t = 0, its value is P i. At t = 1, its value is P i+1. At t = 0, its derivative is v i. At t = 1, its derivative is v i+1. How do we find it? First, find the derivative: f (t) = 3At 2 + 2Bt + C Next figure out what the four constraints mean: P i = f(0) = D P i+1 = f(1) = A + B + C + D v i = f (0) = C v i+1 = f (1) = 3A + 2B + C This gives a system of 4 linear equations in 4 variables (A, B, C, D). Solve to obtain: A = 2P i – 2P i+1 + v i + v i+1 B = –3P i + 3P i+1 – 2v i – v i+1 C = v i D = P i

5 Mar 2004CS 481/68113 Interpolating Splines: Hermite Curves — Code The results: A = 2P i – 2P i+1 + v i + v i+1 B = –3P i + 3P i+1 – 2v i – v i+1 C = v i D = P i Here is some code using TRANSF: const int ncp; // Number of Control Points pos p[ncp]; // Array of control points vec v[ncp]; // Vector for each control point int i; // subscript, same as i above double t; // parameter value, in [0,1] vec A = 2.*(p[i] – p[i+1]) + v[i] + v[i+1]; vec B = -3.*(p[i] – p[i+1]) – 2*v[i] – v[i+1]; vec C = v[i]; pos D = p[i]; pos point_on_hermite_curve = t*t*t*A + t*t*B + t*C + D;

5 Mar 2004CS 481/68114 Interpolating Splines: Hermite Curves — Notes In practice, Hermite curve segments join to make a smooth curve. Hermite curves are relatively common. Whenever you see an interpolating curve with direction handles on the control points, you are probably dealing with an Hermite curve. Why did we use cubic polynomials? P i+1 PiPi vivi v i+1 P i+2 v i+2

5 Mar 2004CS 481/68115 Interpolating Splines: Cardinal Splines Hermite curves fall short of our goal, since they require direction vectors to be specified. If we can compute these vectors automatically, based on the control points, then we can meet our goal using Hermite curves. Idea Let v i be parallel to the vector from P i–1 to P i+1. So v i = k(P i+1 – P i–1 ). The value k is called the tension. The tension can be whatever you want, but usually it is between 0 and 1. Tension 0 makes a polyline. Problem: We cannot define the first & last curve segments. We address this later. P i+1 P i–1 PiPi vivi

5 Mar 2004CS 481/68116 Interpolating Splines: Catmull-Rom Splines (The Goal) Suppose the control points of a cardinal spline are equally spaced along a straight line. What should the tension be? k = ½ seems natural, since it makes the speed constant. A cardinal spline with tension ½ is called a Catmull-Rom spline. Properties Defined entirely in terms of control points. Can use any number of control points; always defined by cubic polynomials. Interpolating. Smooth. Local control. Affine invariant. NO convex-hull property , but you can’t have everything. Use the Hermite-curve code to draw it.

5 Mar 2004CS 481/68117 Interpolating Splines: Hitting the Endpoints One small problem with a Catmull-Rom spline is that we cannot hit the first and last control points (unless they lie in a loop). Each segment needs 4 constraints. Normally, these are the two positions and the two vectors. But we don’t have a vector at the first & last points. Solution Instead of constraining f to be a certain velocity vector, use the constraint f (0) = 0 or f (1) = 0 at the endpoints. Then solve the system again. Then, given any list of control points, we have a uniquely defined curve passing through all of them, in order. There are any number of other proposed variations on the cardinal spline, higher-degree versions, etc.

5 Mar 2004CS 481/68118 Interpolating Splines: Surface Patches We define a Catmull-Rom surface patch using the same ideas that we used to define a Bézier patch. Start with a rectangular grid of control points. Compute curves through each horizontal row of control points. Use corresponding points on these curves as control points for vertical curves. Put the vertical curves together to make the patch. See the formula for a Bézier patch to get an idea of how the computation would look.

5 Mar 2004CS 481/68119 Implicit Descriptions: Introduction Recall, a surface can be defined using: A Polygon List An Explicit description Formulas based on parameters. An Implicit Description Equations to be solved. Spline curves & surfaces are a way to create easy-to-define explicit descriptions. Now, we look at implicit descriptions.

5 Mar 2004CS 481/68120 Implicit Descriptions: Why? One problem with explicit descriptions is that they generally assume some kind of rectangular grid on a surface. Can you put a rectangular grid on an arbitrary object? What about a surface that can change topology? Implicit descriptions do not have these problems. Of course, they have other problems …

5 Mar 2004CS 481/68121 Implicit Descriptions: What They Look Like [1/2] Strictly speaking, an implicit description is an equation to be solved. In practice, however, things look a bit different. Typically, we specify “potential” values at various points in space. We want to approximate the surface consisting of all points at a particular “threshold” value. This is called an isosurface. Thus, we want solutions to this equation: potential(x, y, z) = threshold_value However, we do not define the potential everywhere, so it might not be clear exactly what we are approximating.

5 Mar 2004CS 481/68122 Implicit Descriptions: What They Look Like [2/2] Specifying potential values generally takes one of two forms: Specify potentials at every point in a 3-D grid. Specify potentials at a very limited set of points. The former method is well studied, and somewhat reasonable algorithms exist to draw approximations of the surface. The latter method is up-and-coming … Time for a blackboard picture.