Splines I – Curves and Properties based on: Michael Gleicher Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.

Slides:



Advertisements
Similar presentations
Arc-length computation and arc-length parameterization
Advertisements

Splines IV – B-spline Curves
Splines I – Curves and Properties
2002 by Jim X. Chen: Bezier Curve Bezier Curve.
Parametric Equations Local Coordinate Systems Curvature Splines
Lecture 10 Curves and Surfaces I
Geometric Modeling Notes on Curve and Surface Continuity Parts of Mortenson, Farin, Angel, Hill and others.
Cubic Curves CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
Copyright © Cengage Learning. All rights reserved.
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.
13 VECTOR FUNCTIONS.
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 Locus of a point moving with one degree of freedom
Geometric Modeling Surfaces Mortenson Chapter 6 and Angel Chapter 9.
Curves Mortenson Chapter 2-5 and Angel Chapter 9
ENDS 375 Foundations of Visualization Geometric Representation 9/30/04.
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.
Chapter 10: Curves and Surfaces Part 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
1 Representing Curves and Surfaces. 2 Introduction We need smooth curves and surfaces in many applications: –model real world objects –computer-aided.
09/16/02 Dinesh Manocha, COMP258 Surfaces Locally a 2D manifold: i.e. approximating a plane in the ngbd. of each point. A 2-parameter family of points.
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.
© Dr Moudar Zgoul Non-uniform rational basis spline (NURBS) An Introduction to.
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 / 23 / 2007 Instructor: Michael Eckmann.
V. Space Curves Types of curves Explicit Implicit Parametric.
Chapter 10-Vector Valued Functions Calculus, 2ed, by Blank & Krantz, Copyright 2011 by John Wiley & Sons, Inc, All Rights Reserved.
CS 376 Introduction to Computer Graphics 04 / 20 / 2007 Instructor: Michael Eckmann.
Splines IV – B-spline Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
ME 2304: 3D Geometry & Vector Calculus
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.
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.
Review CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Parametric Curves & Surfaces Greg Humphreys University of Virginia CS 445, Spring.
Vector-Valued Functions Copyright © Cengage Learning. All rights reserved.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
(c) 2002 University of Wisconsin
CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann.
Copyright © Cengage Learning. All rights reserved. 16 Vector Calculus.
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:
Vector Analysis 15 Copyright © Cengage Learning. All rights reserved.
Curves University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
Object Modeling: Curves and Surfaces CEng 477 Introduction to Computer Graphics.
Introduction to Parametric Curve and Surface Modeling.
CSCI480/582 Lecture 9 Chap.2.2 Cubic Splines – Hermit and Bezier Feb, 11, 2009.
Copyright © Cengage Learning. All rights reserved.
Representation of Curves & Surfaces
Copyright © Cengage Learning. All rights reserved.
Arc Length and Curvature
Copyright © Cengage Learning. All rights reserved.
© University of Wisconsin, CS559 Spring 2004
Copyright © Cengage Learning. All rights reserved.
Spline Interpolation Class XVII.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.)
Introduction to Parametric Curve and Surface Modeling
Type to enter a caption. Computer Graphics Week 10 Lecture 1.
Presentation transcript:

Splines I – Curves and Properties based on: Michael Gleicher Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides by Marc van Kreveld 1

What is a curve? Intuitively: what you can draw with a pen without lifting it up Mathematically: image of a continuous mapping of an interval into the plane (or higher-d space) f : [0,1]  R 2 [] 2

Types of curves Normal (two endpoints) Closed loops (no endpoints) Infinite curves (no endpoints) 3

More curves Curves may self-intersect, have sharp corners, trace back on themselves, … Well-known curves: line segment, line, circle, ellipse, square (boundary), parabola, circular arc, … General curves are called free-form curves 4

How to specify a curve (3 ways) Implicit curve Parametric curve Procedurally defined curve 5

Implicit curves Given by a function in 2 variables (for curves in the plane) and an outcome value of that function – Circle with radius 2 centered at origin: x 2 + y 2 = 4 the function is f(x,y)= x 2 + y 2 – Some weird curve: log x – x 2 + y 3 = 0 (if this equation yields a connected set???) We can assume the given value is 0 Not every function+value gives a connected set, implying that it cannot be the image of a continuous mapping 6

Parametric curves Use a parameter, e.g. t, and use two functions f(t) and g(t) to describe corresponding x and y coordinates – f(t) = cos tfor t in [0, 2  ); this is a circle g(t) = sin t – f(t) = t 2 g(t) = t – f(t) = t 4 g(t) = t 2 – f(t) = t 6 g(t) = t 3 7

Parametric curves Representations are not unique The functions f and g can be written together as a vector-valued function f, we then write (x, y) = f (t) as a shorthand for (x, y) = (f(t), g(t)) 8

Procedural curves Defined by a process or a grammar, e.g. Koch snowflake (a fractal curve) 9

Parametric curves Most common in graphics Easy to work with (we can draw by evaluating at the parameter) 10

About the parameterization The value of the parameter tells you where you are on the curve The parameter determines “speed” along the curve f (t) = (t, t) (0,1) (0,0) (1,0) t=0 t=1 t=½ f (t) = (t 2, t 2 ) t=0 t=1 t=½ t=0 t=1 t=½ f (t) = (t 1/2, t 1/2 ) 11

About the parameterization Speed is the derivative (magnitude): | d f(t)/d t | f (t) = (t, t) (0,1) (0,0) (1,0) t=0 t=1 t=½ f (t) = (t 2, t 2 ) t=0 t=1 t=½ t=0 t=1 t=½ f (t) = (t 1/2, t 1/2 ) speed is  2 everywhere speed increases from 0 to 2  2 speed decreases from  to ½  2 12

Arc-length parameterizations Informally, constant-speed parameterizations Formally, when s is used as parameter when it is an arc-length parameterization f(t) = (t, t) 13

Arc-length parameterizations Informally, constant-speed parameterizations Formally, when s is used as parameter when it is an arc-length parameterization f(t) = (t 2, t 2 ) 14

Tangent vector along a curve Has a direction and magnitude; the magnitude is speed f(s) = sin s s  [0,  /2] g(s) = cos s f(t) = t t  [0,1] g(t) =  ((1 – t) 2 ) The direction of tangent depends purely on the position on the curve, whereas the magnitude depends on the parameterization as well 15

Length of a parameterized curve You get the length of a curve by integrating over the magnitude of the tangent vector of the curve The arc length from parameter value a to b, so the arc length between f (a) and f (b), is: (x,y) = f (a) (x,y) = f (b) 16

Piecewise curves Defined by a sequence of functions Should line up head-to-tail to get a continuous overall mapping f1f1 f2f2 f3f3 f4f4 A piecewise curve is a curve by definition; its description just happens to be done using pieces 17

Piecewise curves Example – f 1 (t) = (t, 0)for t  [0,1) – f 2 (t) = (t, t – 1)for t  [1,3) – f 3 (t) = (t 2 – 2t, t – 1)for t  [3,4] 18

Piecewise curves Pieces must connect  continuous curve Tangent vector at both sides is the same  differential curve 19

Types of continuity C 0 is the name/notation for normal continuity Parametric continuity C 1 : The tangent vectors are the same “just before and just after every point on the curve”, in particular for breakpoints Geometric continuity G 1 : The tangent vector directions are the same just before and just after Parametric continuity depends on the parameterization, while geometric continuity depends only on the shape 20

Types of continuity You cannot “see” parametric continuity, you need the parameterization Parametric continuity implies geometric continuity Re-parameterization may make a geometrically continuous curve parametrically continuous C n and G n means that all derivatives up to (and including) the n-th are continuous Practice: C 1 / G 1 continuous curves look good, C 2 / G 2 continuous curves look slightly better, more is not needed 21

Types of continuity Consider the piecewise curve – f 1 (t) = (t, t)for t  [0, ½) – f 2 (t) = (2t – ½, 2t – ½)for t  [½, 1] ½ ½

Types of continuity Consider the piecewise curve – f 1 (t) = (t 2, 1)for t  [0, 1) – f 2 (t) = (1 + sin(t-1), 2 – cos(t-1))for t  [1, 1+  /2] Question: What is the speed just before and just after (1,1)? Is it C 1, G 1, both, neither?

Polynomial pieces Both functions used for the f are polynomials in the parameter Simplest example: piecewise linear (polygonal) curve, consisting of straight line segments; only C 0 – Each piece can be expressed using linear interpolation between two points: f(u) = (1 – u) p 0 + u p 1, u  [0,1] – Also : f(u) = a 0 + u a 1 (where a 0 = p 0 and a 1 = p 1 - p 0 ) p0p0 p1p1 u is used as parameter notation when it ranges over the unit interval [0,1] 24

Polynomial pieces Both functions used for the f are polynomials in the parameter Simplest example: piecewise linear (polygonal) curve, consisting of straight line segments; only C 0 – Each piece can be expressed using linear interpolation between two points: f(u) = (1 – u) p 0 + u p 1, u  [0,1] – Also : f(u) = a 0 + u a 1 (where a 0 = p 0 and a 1 = p 1 - p 0 ) a0a0 a1a1 u is used as parameter notation when it ranges over the unit interval [0,1] 25

Polynomial pieces Higher-degree polynomials can be written in canonical form: f(u) = a 0 + u a 1 + u 2 a 2 (quadratic), or f(u) = a 0 + u a 1 + u 2 a 2 + … + u n a n (n-th degree) In vector/matrix notation: these have an x- and a y-coordinate 26

Quadratic pieces, quadrics The (vector) coefficients a 0, a 1 and a 2 of the canonical form are not convenient for making curves It is more natural to describe quadrics using 3 points, one for f(0), one for f(0.5), and one for f(1) p 0 = f(0) = a a a 2 p 1 = f(0.5) = a a a 2 p 2 = f(1) = a a a 2 With linear algebra, we can convert a 0, a 1 and a 2 into p 0, p 1 and p 2 and vice versa 27

Quadrics p2p2 p1p1 p0p0 p2p2 p1p1 p0p0 28

Quadratic curves in the real world 29

Quadrics p 0 = f(0) = a a a 2 p 1 = f(0.5) = a a a 2 p 2 = f(1) = a a a 2 constraint matrix 30

Quadrics p 0 = f(0) = a a a 2 p 1 = f(0.5) = a a a 2 p 2 = f(1) = a a a 2 base matrix If you have the three points p 0, p 1 and p 2, you can get the coefficients of the polynomial in canonical form 31

Quadrics Example 1: Given the points p 0 = (0,1), p 1 = (2,0) and p 2 = (4,4), compute the coefficients of the polynomial in canonical form for which f( 0 ) = p 0, f( 0.5 ) = p 1, and f( 1 ) = p 2 Solution: simply apply the base matrix B to ( p 0 p 1 p 2 ) T 32

Quadrics Example 2: Given the points p 0 = (0,1), p 1 = (2,0) and p 2 = (4,4), compute the coefficients of the polynomial in canonical form for which f( 0 ) = p 0, f( 0.3 ) = p 1, and f( 1 ) = p 2 Solution: determine the base matrix B for this case and apply it to ( p 0 p 1 p 2 ) T 33

Quadrics p 0 = f(0) = a a a 2 p 1 = f(0.3) = a a a 2 p 2 = f(1) = a a a 2 Now compute B = C – 1 and apply it to ( p 0 p 1 p 2 ) T 34

Quadrics We can specify the quadric using points and derivatives too – two points and one derivate at a point – one point, first derivative at a point and second derivative at a point p1p1 p0p0 35

Quadrics f(u) = a 0 + a 1 u + a 2 u 2 f’(u) = a a 2 u f’’(u) = 2 a 2 By specifying anything like p 0 = f(0), p 1 = f’(0.6), p 2 = f’’(0.7) we can determine a (and therefore the quadric in canonical form) by setting up the constraint matrix, doing matrix inversion, and applying it to ( p 0 p 1 p 2 ) T 36

Quadrics f(u) = a 0 + a 1 u + a 2 u 2 f’(u) = a a 2 u f’’(u) = 2 a 2 For example: p 0 = f(0.1) = a a a 2 p 1 = f’(0.6) = a  0.6 a 2 p 2 = f’’(0.7) = 2 a 2 Note: p 1 and p 2 are not points, but specifications of the first and second derivatives 37

Cubics Cubics are the most popular polynomial pieces – They are determined by 4 coefficients so we can for instance specify the two endpoints and the two first derivatives at these endpoints – This is important for building splines – f(u) = a 0 + a 1 u + a 2 u 2 + a 3 u 3 p2p2 p0p0 p3p3 p1p1 38

Cubics p 0 = f(0) = a 0 +0 a a a 3 p 1 = f’(0) = a 1 + 0a  0 2 a 3 p 2 = f(1) = a 0 +1 a a a 3 p 3 = f’(1) = a  1 a  1 2 a 3 This is the so-called Hermite form p2p2 p0p0 p3p3 p1p1 39

Cubics For example: p 0 = (0,0), p 1 = (0,2), p 2 = (3,0), p 3 = (2,0) p 0 = (0,0) p 1 = (0,2) p 2 = (3,0) p 3 = (2,0) point tangent vector 40

Summary There are three main ways to specify curves, parametric, implicit, and procedural There are different degrees of continuity of curves, important when designing piecewise defined curves We can build (parametric) linear curves from two specifications, quadric curves from 3 specifications and cubic curves from 4 specifications (through point, tangent at point, …) The constraint matrix and base matrix allow us to convert specifications into canonical form and v.v. 41

Questions 1.Given the piecewise, parameterized curve f(t) = (3t, t 2 ) for t  [0, 2) and f(t) = (4+t, 2t) for t  [2, 4]. Is the curve G 0 ? Is it G 1 ? Is the parameterization C 0 ? Is it C 1 ? Explain 2.Suppose we make a cubic curve by specifying f(0), f’(0), f(0.5) and f(1). Give the constraint matrix and the base matrix Suppose f(0) = (1,1), f’(0) = (0,1), f(0.5) = (3,1) and f(1) = (4,0). Put the curve in canonical form 3.Analyze the curve given by f(0) = (1,1), f’(0) = (1,0), f(1) = (3,1) and f’(1) = (-2,0). 42