Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 1 2D Spline Curves CS 465 Lecture 15.

Slides:



Advertisements
Similar presentations
Lecture Notes #11 Curves and Surfaces II
Advertisements

Computer Graphics (Spring 2008) COMS 4160, Lecture 6: Curves 1
2002 by Jim X. Chen: Bezier Curve Bezier Curve.
Lecture 10 Curves and Surfaces I
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
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.
Lecture 29 of 42 Bezier Curves and Splines Wednesday, 02 April 2008
MIT EECS 6.837, Durand and Cutler Curves & Surfaces.
Splines II – Interpolating Curves
Informationsteknologi Monday, December 10, 2007Computer Graphics - Class 161 Today’s class Curve fitting Evaluators Surfaces.
Curves Chiew-Lan Tai.
Curves Chiew-Lan Tai. Curves 2 Reading Required Hearn & Baker, 8-8 – 8-10, 8-12 Foley, 11.2.
Cornell CS465 Fall 2004 Lecture 16© 2004 Steve Marschner 1 Curved surfaces CS 465 Lecture 16.
Rational Bezier Curves
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 12: Spline Curves (review) Ravi Ramamoorthi Most material.
1 Lecture 13 Modeling Curved Lines and Surfaces. 2 Types of Surfaces Ruled Surfaces B-Splines and Bezier Curves Surfaces of Revolution.
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
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.
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.
V. Space Curves Types of curves Explicit Implicit Parametric.
Introduction to Computer Graphics with WebGL
CS 445 / 645 Introduction to Computer Graphics Lecture 23 Bézier Curves Lecture 23 Bézier Curves.
Splines Vida Movahedi January 2007.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric Curves.
Graphics Graphics Korea University cgvr.korea.ac.kr 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.
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.
Keyframing and Splines Jehee Lee Seoul National University.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
CS 445 / 645 Introduction to Computer Graphics Lecture 23 Bézier Curves Lecture 23 Bézier 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.
Computer Graphics (Fall 2003) COMS 4160, Lecture 10: Curves 1 Ravi Ramamoorthi
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
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.
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
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.
Piecewise Polynomial Parametric Curves Sun-Jeong Kim.
Introduction to Parametric Curve and Surface Modeling.
© University of Wisconsin, CS559 Spring 2004
CS 445 / 645 Introduction to Computer Graphics
2D Spline Curves CS 465 Lecture 15 © 2004 Steve Marschner • 1.
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
Spline Curves COMP 575/COMP 770.
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 1 2D Spline Curves CS 465 Lecture 15

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 2 Motivation: smoothness In many applications we need smooth shapes –that is, without discontinuities So far we can make –things with corners (lines, squares, rectangles, …) –circles and ellipses (only get you so far!) [Boeing]

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 3 Classical approach Pencil-and-paper draftsmen also needed smooth curves Origin of “spline:” strip of flexible metal –held in place by pegs or weights to constrain shape –traced to produce smooth contour

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 4 Translating into usable math Smoothness –in drafting spline, comes from physical curvature minimization –in CG spline, comes from choosing smooth functions usually low-order polynomials Control –in drafting spline, comes from fixed pegs –in CG spline, comes from user-specified control points

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 5 Defining spline curves At the most general they are parametric curves Generally f(t) is a piecewise polynomial –for this lecture, the discontinuities are at the integers

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 6 Defining spline curves Generally f(t) is a piecewise polynomial –for this lecture, the discontinuities are at the integers –e.g., a cubic spline has the following form over [k, k + 1]: –Coefficients are different for every interval

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 7 Control of spline curves Specified by a sequence of control points Shape is guided by control points (aka control polygon) –interpolating: passes through points –approximating: merely guided by points

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 8 Splines as reconstruction

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 9 Trivial example: piecewise linear This spline is just a polygon –control points are the vertices But we can derive it anyway as an illustration Each interval will be a linear function –x(t) = at + b –constraints are values at endpoints –b = x 0 ; a = x 1 – x 0 –this is linear interpolation

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 10 Trivial example: piecewise linear Vector formulation Matrix formulation

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 11 Trivial example: piecewise linear Basis function formulation –regroup expression by p rather than t –interpretation in matrix viewpoint

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 12 Trivial example: piecewise linear Vector blending formulation: “average of points” –weighting functions: contribution of each point as t changes

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 13 Trivial example: piecewise linear Basis function formulation: “function times point” –basis functions: contribution of each point as t changes –this is just like a reconstruction filter!

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 14 Hermite splines Less trivial example Form of curve: piecewise cubic Constraints: endpoints and tangents (derivatives)

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 15 Hermite splines Solve constraints to find coefficients

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 16 Hermite splines Matrix form is much simpler –cofficients = rows –basis functions = columns note p columns sum to [ ] T

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 17 Hermite splines Hermite blending functions

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 18 Hermite splines Hermite basis functions

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 19 Continuity Smoothness can be described by degree of continuity –zero-order: position matches from both sides –first-order: tangent matches from both sides –second-order: curvature matches from both sides –Gn vs. Cn zero orderfirst ordersecond order

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 20 Control Local control –changing control point only affects a limited part of spline –without this, splines are very difficult to use –many likely formulations lack this natural spline polynomial fits

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 21 Control Convex hull property –convex hull = smallest convex region containing points think of a rubber band around some pins –some splines stay inside convex hull of control points make clipping, culling, picking, etc. simpler YES NO

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 22 Affine invariance Transforming the control points is the same as transforming the curve –true for all commonly used splines –extremely convenient in practice…

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 23 Matrix form of spline

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 24 Hermite splines Constraints are endpoints and endpoint tangents

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 25 Hermite basis

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 26 Affine invariance Basis functions associated with points should always sum to 1

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 27 Hermite to Bézier Mixture of points and vectors is awkward Specify tangents as differences of points – note derivative is defined as 3 times offset reason is illustrated by linear case

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 28 Hermite to Bézier

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 29 Bézier matrix –note that these are the Bernstein polynomials C(n,k) t k (1 – t) n – k and that defines Bézier curves for any degree

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 30 Bézier basis

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 31 Convex hull If basis functions are all positive, the spline has the convex hull property –we’re still requiring them to sum to 1 –if any basis function is ever negative, no convex hull prop. proof: take the other three points at the same place

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 32 Chaining spline segments Hermite curves are convenient because they can be made long easily Bézier curves are convenient because their controls are all points and they have nice properties –and they interpolate every 4th point, which is a little odd We derived Bézier from Hermite by defining tangents from control points –a similar construction leads to the interpolating Catmull- Rom spline

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 33 Chaining Bézier splines No continuity built in Achieve C 1 using collinear control points

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 34 Subdivision A Bézier spline segment can be split into a two- segment curve: –de Casteljau’s algorithm –also works for arbitrary t

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 35 Cubic Bézier splines Very widely used type, especially in 2D –e.g. it is a primitive in PostScript/PDF Can represent C 1 and/or G 1 curves with corners Can easily add points at any position Illustrator demo

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 36 Have not yet seen any interpolating splines Would like to define tangents automatically –use adjacent control points –end tangents: extra points or zero Hermite to Catmull-Rom

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 37 Hermite to Catmull-Rom Tangents are (p k + 1 – p k – 1 ) / 2 –scaling based on same argument about collinear case

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 38 Catmull-Rom basis

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 39 Catmull-Rom splines Our first example of an interpolating spline Like Bézier, equivalent to Hermite –in fact, all splines of this form are equivalent First example of a spline based on just a control point sequence Does not have convex hull property

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 40 Evaluating splines for display Need to generate a list of line segments to draw –generate efficiently –use as few as possible –guarantee approximation accuracy Approaches –reccursive subdivision (easy to do adaptively) –uniform sampling (easy to do efficiently)

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 41 Evaluating by subdivision –Recursively split spline stop when polygon is within epsilon of curve –Termination criteria distance between control points distance of control points from line p1p1 p2p2 p3p3 p4p4

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 42 Evaluating with uniform spacing Forward differencing –efficiently generate points for uniformly spaced t values –evaluate polynomials using repeated differences

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 43 B-splines We may want more continuity than C 1 We may not need an interpolating spline B-splines are a clean, flexible way of making long splines with arbitrary order of continuity Various ways to think of construction –a simple one is convolution –relationship to sampling and reconstruction

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 44 Cubic B-spline basis

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 45 Deriving the B-Spline Approached from a different tack than Hermite- style constraints –Want a cubic spline; therefore 4 active control points –Want C 2 continuity –Turns out that is enough to determine everything

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 46 Efficient construction of any B-spline B-splines defined for all orders –order d: degree d – 1 –order d: d points contribute to value One definition: Cox-deBoor recurrence

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 47 B-spline construction, alternate view Recurrence –ramp up/down Convolution –smoothing of basis fn –smoothing of curve

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 48 Cubic B-spline matrix

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 49 Other types of B-splines Nonuniform B-splines –discontinuities not evenly spaced –allows control over continuity or interpolation at certain points –e.g. interpolate endpoints (commonly used case) Nonuniform Rational B-splines (NURBS) –ratios of nonuniform B-splines: x(t) / w(t); y(t) / w(t) –key properties: invariance under perspective as well as affine ability to represent conic sections exactly

Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 50 Converting spline representations All the splines we have seen so far are equivalent –all represented by geometry matrices where S represents the type of spline –therefore the control points may be transformed from one type to another using matrix multiplication