Parametric Curves CS 318 Interactive Computer Graphics John C. Hart.

Slides:



Advertisements
Similar presentations
© University of Wisconsin, CS559 Spring 2004
Advertisements

2002 by Jim X. Chen: Bezier Curve Bezier Curve.
Cubic Curves CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
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
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.
Computer graphics & visualization Key frame Interpolation.
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
09/04/02 Dinesh Manocha, COMP258 Bezier Curves Interpolating curve Polynomial or rational parametrization using Bernstein basis functions Use of control.
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
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
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.
Splines III – Bézier Curves
Curve Modeling Bézier Curves
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
(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.
Vector Computer Graphic. Vector entities Line Circle, Ellipse, arc,… Curves: Spline, Bezier’s curve, … … Areas Solids Models.
Splines Vida Movahedi January 2007.
Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 1 2D Spline Curves CS 465 Lecture 15.
Chapter VI Parametric Curves and Surfaces
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric Curves.
Splines IV – B-spline Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
Computer Graphics Representing Curves and Surfaces.
Keyframing and Splines Jehee Lee Seoul National University.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
Representation of Curves & Surfaces Prof. Lizhuang Ma Shanghai Jiao Tong University.
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.
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.
(c) 2002 University of Wisconsin
1 Graphics CSCI 343, Fall 2015 Lecture 34 Curves and Surfaces III.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
1 CS 430/536 Computer Graphics I B-Splines and NURBS Week 5, Lecture 9 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing.
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.
CS 318 Intro to Computer Graphics John C. Hart
College of Computer and Information Science, Northeastern UniversityFebruary 27, CS U540 Computer Graphics Prof. Harriet Fell Spring 2009 Lectures.
Blossoms CS 419 Advanced Topics in Computer Graphics John C. Hart
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.
Piecewise Polynomial Parametric Curves Sun-Jeong Kim.
Introduction to Parametric Curve and Surface Modeling.
© University of Wisconsin, CS559 Spring 2004
Introduction to Parametric Curve and Surface Modeling
(Spline, Bezier, B-Spline)
2D Spline Curves CS 465 Lecture 15 © 2004 Steve Marschner • 1.
Parametric Curves.
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
Spline Curves COMP 575/COMP 770.
Curve design 455.
Three-Dimensional Object Representation
Lecture 21: B Spline Curve
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

Parametric Curves CS 318 Interactive Computer Graphics John C. Hart

Linear Interpolation Need to get from point p 0 to point p 1 Define a parametric function p(t) p(0) = p 0, p(1) = p 1 Separate into coordinate functions p(t) = (x(t), y(t)) x(0) = x 0, x(1) = x 1 y(0) = y 0, y(1) = y 1 Interpolate p(t) = p 0 + t (p 1 – p 0 ) = (1-t)p 0 + t p 1 x(t) = x 0 + t(x 1 – x 0 ) = (1-t)x 0 + t x 1 y(t) = y 0 + t(y 1 – y 0 ) = (1-t)y 0 + t y 1 p 0 =(x 0,y 0 ) p 1 =(x 1,y 1 ) x y t x t y

Hermite Interpolation From point p 0 along p’ 0 to point p 1 toward p’ 1 Define a parametric function p(t) p(0) = p 0, p(1) = p 1 p’(0) = p’ 0, p’(1) = p’ 1 Separate into coordinate functions x(0) = x 0, x(1) = x 1 x’(0) = x’ 0, x’(1) = x’ 1 Need cubic function x(t) = At 3 + Bt 2 + Ct + D x’(t) = 3At 2 + 2Bt + C Solve A = 2x 0 – 2x 1 + x’ 0 + x’ 1 B = -3x 0 + 3x 1 – 2x’ 0 – x’ 1 C = x’ 0, D = x 0 x y x(0) = D = x 0, x’(0) = C = x’ 0 x(1) = A + B + C + D = x 1 A + B = x 1 – x 0 – x’ 0 x’(1) = 3A + 2B + C = x’ 1 3A + 2B = x’ 1 – x’ 0 A= x’ 1 – x’ 0 – 2x 1 + 2x 0 + 2x’ 0 = x’ 1 + x’ 0 – 2x 1 + 2x 0 B= x 1 – x 0 – x’ 0 – x’ 1 – x’ 0 + 2x 1 – 2x 0 = 3x 1 – 3x 0 – x’ 1 – 2x’ 0 p 0 =(x 0,y 0 ) p 1 =(x 1,y 1 ) p’ 0 =(x’ 0,y’ 0 ) p’ 1 =(x’ 1,y’ 1 )

Hermite Interpolation From point p 0 along p’ 0 to point p 1 toward p’ 1 Define a parametric function p(t) p(0) = p 0, p(1) = p 1 p’(0) = p’ 0, p’(1) = p’ 1 Separate into coordinate functions x(0) = x 0, x(1) = x 1 x’(0) = x’ 0, x’(1) = x’ 1 Need cubic function x(t) = At 3 + Bt 2 + Ct + D x’(t) = 3At 2 + 2Bt + C Solve A = 2x 0 – 2x 1 + x’ 0 + x’ 1 B = -3x 0 + 3x 1 – 2x’ 0 – x’ 1 C = x’ 0, D = x 0 p 0 =(x 0,y 0 ) p 1 =(x 1,y 1 ) x y p’ 0 =(x’ 0,y’ 0 ) p’ 1 =(x’ 1,y’ 1 ) t x t y

Hermite Matrix p(t) = (2p 0 – 2p 1 + p’ 0 + p’ 1 )t 3 + (-3p 0 + 3p 1 – 2p’ 0 – p’ 1 )t 2 + p’ 0 t + p 0 (1) p(t) =(2t 3 – 3t 2 + 1)p 0 + (-2t 3 + 3t 2 )p 1 + (t 3 – 2t 2 + 1)p’ 0 + (t 3 – t 2 )p’ 1 p 0 =(x 0,y 0 ) p 1 =(x 1,y 1 ) x y d 0 =(x’ 0,y’ 0 ) d 1 =(x’ 1,y’ 1 ) t p0p0 t p1p1 t p’ 0 t p’

Linear Interpolation Need to get from point p 0 to point p 1 Define a parametric function p(t) p(0) = p 0, p(1) = p 1 Separate into coordinate functions p(t) = (x(t), y(t)) x(0) = x 0, x(1) = x 1 y(0) = y 0, y(1) = y 1 Interpolate p(t) = p 0 + t (p 1 – p 0 ) = (1-t)p 0 + t p 1 x(t) = x 0 + t(x 1 – x 0 ) = (1-t)x 0 + t x 1 y(t) = y 0 + t(y 1 – y 0 ) = (1-t)y 0 + t y 1 p 0 =(x 0,y 0 ) p 1 =(x 1,y 1 ) x y t x t y

Interpolating Interpolations B i n (t) = (1-t)B i n-1 (t) + tB i n (t) = + = B 0 2 (t) = (1-t) B 0 1 (t) = B 1 2 (t) = (1-t) B 1 1 (t) + t B 0 1 (t) B 2 2 (t) = t B 1 1 (t)

Bernstein Polynomials Defined for any degree B i n (t) = ( n i ) t i (1-t) n-i n choose i ( n i ) = n!/(i!(n – i)!) = ( n i - 1 ) + ( n i ) Partition of unity –Sum to one for any t in [0,1]  i=0..n B i n (t) = 1 Higher degrees lerps of lower degrees B i n (t) = ( n i ) t i (1-t) n-i = ( n i - 1 ) t i (1-t) n-i + ( n i ) t i (1-t) n-i = (1-t)B i n-1 (t) + tB i n (t) B03(t)B03(t) B13(t)B13(t)B23(t)B23(t) B33(t)B33(t) 01/32/ x0x0 x1x1 x2x2 x3x3 x(t)=aB 0 3 (t)+bB 1 3 (t)+cB 2 3 (t)+dB 3 3 (t) x(t)x(t)

Cubic Bezier Curves Bernstein basis applied to points p(t) =  i ( 3 i ) t i (1-t) 3-i p i Bezier curve specified by four control points including two endpoints Affine invariance: –Let M be a 4x4 transformation –Then M p(t) =  i B i (t) Mp i Curve entirely contained in the convex hull of the control points p0p0 p1p1 p3p3 p2p2 B0(t)B0(t) B1(t)B1(t)B2(t)B2(t) B3(t)B3(t) 01/32/31 0 1

Cubic Bezier Matrix p(t)= (1-t) 3 p 0 + 3(1-t) 2 tp 1 + 3(1-t)t 2 p 2 + t 3 p 3 = (1 – 3t + 3t 2 – t 3 )p 0 + (3t – 6t 2 + 3t 3 )p 1 + (3t 2 – 3t 3 )p 2 + t 3 p 3 p0p0 p1p1 p3p3 p2p2 B0(t)B0(t) B1(t)B1(t)B2(t)B2(t) B3(t)B3(t) 01/32/31 0 1

Bezier v. Hermite p 1 = p p’ 0 p 2 = p 3 – 3 p’ 3 Bezier Hermite p0p0 p3p3 p’0p’0 p’3p’3 p2p2 p1p1

Building Bernsteins B i n (t) = (1-t)B i n-1 (t) + tB i n (t) = + = B 0 2 (t) = (1-t) B 0 1 (t) = B 1 2 (t) = (1-t) B 1 1 (t) + t B 0 1 (t) B 2 2 (t) = t B 1 1 (t)

de Casteljau Algorithm Cascading lerps p 01 = (1-t) p 0 + t p 1 p 12 = (1-t) p 1 + t p 2 p 23 = (1-t) p 2 + t p 3 p 012 = (1-t) p 01 + t p 12 p 123 = (1-t) p 12 + t p 23 p 0123 = (1-t) p t p 123 Subdivides curve at p 0123 –p 0 p 01 p 012 p 0123 –p 0123 p 123 p 23 p 3 Repeated subdivision converges to curve p0p0 p1p1 p3p3 p2p2 p 01 p 12 p 23 p 012 p 123 p 0123 t 1-t

B-Spline Segment p0p0 p1p1 p2p2 p3p3 p(t) = (–1/6p 0 +1/2p 1 –1/2p 2 +1/6p 3 )t 3 + ( 1/2p 0 – p 1 +1/2p 2 )t 2 + (–1/2p 0 + 1/2p 2 )t + 1/6p 0 +2/3p 1 +1/6p 2 but makes more sense as… p(t) = (–1/6t 3 + 1/2t 2 – 1/2t + 1/6)p 0 + ( 1/2t 3 – t 2 + 2/3)p 1 + (–1/2t 3 + 1/2t 2 + 1/2t + 1/6)p 2 + ( 1/6t 3 )p 3 t=0 t=1

B-Spline Basis p(t) = (–1/6t 3 + 1/2t 2 – 1/2t + 1/6)p 0 + ( 1/2t 3 – t 2 + 2/3)p 1 + (–1/2t 3 + 1/2t 2 + 1/2t + 1/6)p 2 + ( 1/6t 3 )p 3 = B 0 (t)p 0 +B 1 (t)p 1 +B 2 (t)p 2 +B 3 (t)p 3 Piecewise cubic approximation of a Gaussian bump function Progressively weights points along spline B0 (t)B0 (t) B1(t)B1(t)B2 (t)B2 (t) B3(t)B3(t) B0(t)B0(t) B1(t)B1(t)B2 (t)B2 (t) B3 (t)B3 (t) p3p3 p2p2 p1p1 p0p t01 2/3 1/6

Uniform B-Splines Notation –d = degree of polynomial –k = order of polynomal = d + 1 –E.g. cubic: d = 3, k = 4 Segment i  t < i+1 uses k = d + 1 control points p i to p i+d p(t) =  j 3 = 0 B j (t mod 1)p i+j Normalized basis function N i,d (t) N i,d (t) = B floor(t-i) (t mod 1) if i  t < i+d+1 –Otherwise its zero Knot vector –e.g. [0,1,2,3,4,5,6,7] –in general [t 0,t 1,…,t n+k ] p0p0 p1p1 p2p2 p4p4 p6p6 p7p7 p5p5 p3p3 t=0 t=1 p1p1 p2p2 p3p3 p4p4 p5p5 p6p6 t=3 t=5 t=4 t=2 t

Non-Uniform B-Splines Can specify an arbitrary parameter t i at each control point p i Let N = # of polynomial curve segments Parameters contained in a knot vector –Length (N+1) + 2d – 2 –[t 0,t 1,t 2,t 3,…,t N+2d-2 ] –Cubic: [t 0,t 1,t 2,t 3,…,t N+4 ] Domain of resulting curve is [t d-1,t N+d-1 ] –Cubic: domain = [t 2,t N+2 ] (segments [t 0,t 1 ], [t 1,t 2 ], [t N+2,t N+3 ] and [t N+3,t N+4 ] aren’t plotted) –Need d–1 “extra” knots at the beginning and end of the knot vector p1p1 p2p2 p4p4 p6p6 p7p7 p5p5 p3p3 t=1.3 t=4 t=3.4 p0p0 knot vector: [0,.5, 1.3, 3.4, 4, 5.1, 6, 7] N=3 curve segments d=3 (cubic) t=5.1

Knot Multiplicity Knot multiplicity = # of times a given knot appears in the knot vector Continuity = d – multiplicity Cubic example –All knots unique – 2 nd derivative continuity –Multiplicity two – 1 st derivative cont. –Multiplicity three – 0 th derivative cont. –Multiplicity four – discontinuous Endpoint interpolation –Knots of multiplicity d+1 at beginning and end of knot vector –e.g. [0, 0, 0, 0, 1, 2, 3, 3, 3, 3] 2 nd derivative discontinuity 1 st derivative discontinuity (0 th derivative) discontinuity

N i,0 (t) N i+1,0 (t) N i+2,0 (t) N i+3,0 (t) N i,1 (t) N i+1,1 (t) N i+2,1 (t) N i,2 (t) N i+1,2 (t) N i,3 (t) Recursion Higher degree basis can be constructed from lower degree bases N i,0 (t) = 1 if t i  t < t i+1 0 otherwise Non-uniform B-splines constructed using a systolic array knot vector: [0,.5, 1.3, 3.4, 4, 5.1, 6, 7] N=3 curve segments d=3 (cubic)

Example knot vector: [0,.5, 1.3, 3.4, 4, 5.1, 6, 7] N i,0 (t) = 1 when t i  t < t i+1 else 0 N0N0 N1N1 N2N2 N3N3 N4N4 N5N5 N6N6 d=0 t d=1 d=2 d=3

de Boor Algorithm Evaluate at t = 2 p 4,3 = 1/3 p 4,2 + 2/3 p 3,2 p 4,2 = 1/4 p 4,1 + 3/4 p 3,1 p 3,2 = 2/4 p 3,1 + 2/4 p 2,1 p 4,1 = 1/4 p 4,0 + 3/4 p 3,0 p 3,1 = 2/5 p 3,0 + 3/5 p 2,0 p 2,1 = 2/4 p 2,0 + 2/4 p 1,0 knot vector: [ ] Cubic (d = 3, k = 4) p0p0 p1p1 p2p2 p3p3 p4p4 p5p5 p 2,1 p 3,1 p 4,1 p 3,2 p 4,2 p 4,3

Rational B-Splines Quotient of B-splines p(t) = (  w i p i N i (t))/(  w i N i (t)) B-spline in 4-D homogenous space Projected back into 3-D via homogenous division Weight values affect “tension” near control points Weights can also define control points at infinity from Tom Sederberg’s notes on Computer Aided Geometric Design

Conic Sections Circles, ellipses, arcs Only approximated by polynomial parametrics Modeled precisely by rational parametrics Can be rational Bezier, rational B- spline, etc. p 2 = (0,1) w 2 = 1 p 1 = (1,1) w 1 = 0 p 0 = (1,0) w 0 = 1 x = (cos  t/2, sin  t/2)