Parametric Curves. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Similar documents
Parametric Curves. University of Texas at Austin CS384G - Computer Graphics

CS130 : Computer Graphics Curves (cont.) Tamar Shinar Computer Science & Engineering UC Riverside

08 - Designing Approximating Curves

Fall CSCI 420: Computer Graphics. 4.2 Splines. Hao Li.

Splines. Parameterization of a Curve. Curve Representations. Roller coaster. What Do We Need From Curves in Computer Graphics? Modeling Complex Shapes

Design considerations

Lecture IV Bézier Curves

CSE 167: Introduction to Computer Graphics Lecture #11: Bezier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

3D Modeling Parametric Curves & Surfaces. Shandong University Spring 2013

Curves. Computer Graphics CSE 167 Lecture 11

Curves and Surfaces 1

CSE 167: Introduction to Computer Graphics Lecture #13: Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

Rendering Curves and Surfaces. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

3D Modeling Parametric Curves & Surfaces

CSE 167: Introduction to Computer Graphics Lecture 12: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

Computer Graphics Curves and Surfaces. Matthias Teschner

Information Coding / Computer Graphics, ISY, LiTH. Splines

Parametric curves. Brian Curless CSE 457 Spring 2016

CS-184: Computer Graphics

An Introduction to B-Spline Curves

Until now we have worked with flat entities such as lines and flat polygons. Fit well with graphics hardware Mathematically simple

2D Spline Curves. CS 4620 Lecture 18

(Spline, Bezier, B-Spline)

Curves and Surfaces Computer Graphics I Lecture 9

OUTLINE. Quadratic Bezier Curves Cubic Bezier Curves

2D Spline Curves. CS 4620 Lecture 13

Curves and Surfaces Computer Graphics I Lecture 10

Interactive Graphics. Lecture 9: Introduction to Spline Curves. Interactive Graphics Lecture 9: Slide 1

Central issues in modelling

Introduction to Computer Graphics

Bezier Curves, B-Splines, NURBS

COMPUTER AIDED GEOMETRIC DESIGN. Thomas W. Sederberg

Figure 5.1: Spline and ducks.

Sung-Eui Yoon ( 윤성의 )

Know it. Control points. B Spline surfaces. Implicit surfaces

Objects 2: Curves & Splines Christian Miller CS Fall 2011

and the crooked shall be made straight, and the rough ways shall be made smooth; Luke 3:5

Computer Graphics. Curves and Surfaces. Hermite/Bezier Curves, (B-)Splines, and NURBS. By Ulf Assarsson

Intro to Curves Week 1, Lecture 2

Intro to Modeling Modeling in 3D

CS 536 Computer Graphics Intro to Curves Week 1, Lecture 2

Intro to Curves Week 4, Lecture 7

LECTURE #6. Geometric Modelling for Engineering Applications. Geometric modeling for engineering applications

Representing Curves Part II. Foley & Van Dam, Chapter 11

Computergrafik. Matthias Zwicker. Herbst 2010

Further Graphics. Bezier Curves and Surfaces. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd

CS-184: Computer Graphics. Today

An introduction to interpolation and splines

Properties of Blending Functions

Curves D.A. Forsyth, with slides from John Hart

Parametric curves. Reading. Curves before computers. Mathematical curve representation. CSE 457 Winter Required:

A Curve Tutorial for Introductory Computer Graphics

Curves and Surfaces for Computer-Aided Geometric Design

Rational Bezier Curves

CS 475 / CS Computer Graphics. Modelling Curves 3 - B-Splines

CS130 : Computer Graphics Curves. Tamar Shinar Computer Science & Engineering UC Riverside

Geometric Modeling of Curves

CS348a: Computer Graphics Handout #24 Geometric Modeling Original Handout #20 Stanford University Tuesday, 27 October 1992

(Refer Slide Time: 00:02:24 min)

Remark. Jacobs University Visualization and Computer Graphics Lab : ESM4A - Numerical Methods 331

Bézier Splines. B-Splines. B-Splines. CS 475 / CS 675 Computer Graphics. Lecture 14 : Modelling Curves 3 B-Splines. n i t i 1 t n i. J n,i.

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

The Free-form Surface Modelling System

The goal is the definition of points with numbers and primitives with equations or functions. The definition of points with numbers requires a

Curve and Surface Basics

Lecture 25: Bezier Subdivision. And he took unto him all these, and divided them in the midst, and laid each piece one against another: Genesis 15:10

Curves and Curved Surfaces. Adapted by FFL from CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

Computer Graphics CS 543 Lecture 13a Curves, Tesselation/Geometry Shaders & Level of Detail

Curves and Surfaces. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd

Curve Representation ME761A Instructor in Charge Prof. J. Ramkumar Department of Mechanical Engineering, IIT Kanpur

Computer Graphics Splines and Curves

A MATRIX FORMULATION OF THE CUBIC BÉZIER CURVE

Splines. Connecting the Dots

GL9: Engineering Communications. GL9: CAD techniques. Curves Surfaces Solids Techniques

The Essentials of CAGD

Need for Parametric Equations

Splines Computer Graphics I Lecture 10

Curves, Surfaces and Recursive Subdivision

Most shapes are simply too complicated to dene using a single Bezier curve. A spline curve is

Outline. Properties of Piecewise Linear Interpolations. The de Casteljau Algorithm. Recall: Linear Interpolation

Lecture 9: Introduction to Spline Curves

INF3320 Computer Graphics and Discrete Geometry

Freeform Curves on Spheres of Arbitrary Dimension

TO DUY ANH SHIP CALCULATION

From curves to surfaces. Parametric surfaces and solid modeling. Extrusions. Surfaces of revolution. So far have discussed spline curves in 2D

Computer Graphics I Lecture 11

Derivative. Bernstein polynomials: Jacobs University Visualization and Computer Graphics Lab : ESM4A - Numerical Methods 313

Dgp _ lecture 2. Curves

Review of Tuesday. ECS 175 Chapter 3: Object Representation

Computer Graphics. Unit VI: Curves And Fractals. By Vaishali Kolhe

Homework #2. Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves

Parametric Surfaces. Michael Kazhdan ( /657) HB , FvDFH 11.2

COMPUTER AIDED ENGINEERING DESIGN (BFF2612)

Outline. The de Casteljau Algorithm. Properties of Piecewise Linear Interpolations. Recall: Linear Interpolation

A Practical Review of Uniform B-Splines

A generalized conversion matrix between non-uniform B-spline and Bézier representations with applications in CAGD

Subdivision curves. University of Texas at Austin CS384G - Computer Graphics

Homework #2. Hidden Surfaces, Projections, Shading and Texture, Ray Tracing, and Parametric Curves

PS Geometric Modeling Homework Assignment Sheet I (Due 20-Oct-2017)

CS3621 Midterm Solution (Fall 2005) 150 points

Transcription:

Parametric Curves University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Parametric Representations 3 basic representation strategies: Explicit: y = mx + b Implicit: ax + by + c = 0 Parametric: P = P 0 + t (P 1 - P 0 ) Advantages of parametric forms More degrees of freedom Directly transformable Dimension independent No infinite slope problems Separates dependent and independent variables Inherently bounded Easy to express in vector and matrix form Common form for many curves and surfaces University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 2

Algebraic Representation All of these curves are just parametric algebraic polynomials expressed in different bases Parametric linear curve (in E 3 ) x = a x u + b x p(u) = au + b Parametric cubic curve (in E 3 ) p(u) = au 3 + bu 2 + cu + d y = a y u + b y z = a z u + b z x = a x u 3 + b x u 2 + c x u + d x y = a y u 3 + b y u 2 + c y u + d y z = a z u 3 + b z u 2 + c z u + d z Basis (monomial or power) [ u 1] [ u 3 u 2 u 1] University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 3

Hermite Curves 12 degrees of freedom (4 3-d vector constraints) Specify endpoints and tangent vectors at endpoints p(0) = d p(1) = a + b + c + d p u (0) = c p u (1) = 3a + 2b + c Solving for the coefficients: a = 2p(0) " 2p(1) + p u (0) + p u (1) b = "3p(0) + 3p(1) " 2p u (0) " p u (1) c = p u (0) d = p(0) p(0) u = 0 p u (u) " dp du (u) p u (0) p u (1) p(1) u = 1 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 4

Hermite Curves - Hermite Basis Substituting for the coefficients and collecting terms gives p(u) = (2u 3 " 3u 2 +1)p(0) + ("2u 3 + 3u 2 )p(1) + (u 3 " 2u 2 + u)p u (0) + (u 3 " u 2 )p u (1) Call H 1 (u) = (2u 3 " 3u 2 +1) H 2 (u) = ("2u 3 + 3u 2 ) H 3 (u) = (u 3 " 2u 2 + u) H 4 (u) = (u 3 " u 2 ) H 1 H 2 H 3 n the Hermite blending functions or basis functions H 4 Then p(u) = H 1 (u)p(0) + H 2 (u)p(1) + H 3 (u)p u (0) + H 4 (u)p u (1) University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 5

Hermite Curves - Matrix Form Putting this in matrix form H = [ H 1 (u) H 2 (u) H 3 (u) H 4 (u)] = [ u 3 u 2 u 1] # 2 "2 1 1 & % ( % "3 3 "2 "1 ( % 0 0 1 0 ( % ( $ 1 0 0 0 ' = UM H M H is called the Hermite characteristic matrix Collecting the Hermite geometric coefficients into a geometry vector B, we have a matrix formulation for the Hermite curve p(u) " p(0) % $ ' p(1) B = $ ' $ p u (0)' $ # p u ' (1) & p(u) = UM H B University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 6

Hermite and Algebraic Forms M H transforms geometric coefficients ( coordinates ) from the Hermite basis to the algebraic coefficients of the monomial basis " a% $ ' b A = $ ' $ c' $ ' # d& p(u) = UA = UM H B A = M H B B = M (1 H A # 0 0 0 1& % ( 1 1 1 1 M "1 H = % ( % 0 0 1 0( % ( $ 3 2 1 0' University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 7

Cubic Bézier Curves Specifying tangent vectors at endpoints isn t always convenient for geometric modeling We may prefer making all the geometric coefficients points, let s call them control points, and label them p 0, p 1, p 2, and p 3 For cubic curves, we can proceed by letting the tangents at the endpoints for the Hermite curve be defined by a vector between a pair of control points, so that: p(0) = p 0 p 2 p(1) = p 3 p u (0) = k 1 (p 1 " p 0 ) p u (1) = k 2 (p 3 " p 2 ) p 0 k 1 p 1 p 3 p(u) k 2 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 8

Cubic Bézier Curves Substituting this into the Hermite curve expression and rearranging, we get p(u) = [( 2 " k 1 )u 3 + ( 2k 1 " 3)u 2 " k 1 u +1]p 0 + [ k 1 u 3 " 2k 1 u 2 + k 1 u]p 1 + ["k 2 u 3 + k 2 u 2 ]p 2 + [( k 2 " 2)u 3 + ( 3" k 2 )u 2 ]p 3 In matrix form, this is # 2 " k 1 k 1 "k 2 k 2 " 2& % ( 2k 1 " 3 "2k 1 k 2 3" k 2 p(u) = UM B P M B = % ( % "k 1 k 1 0 0 ( % ( $ 1 0 0 0 ' " $ P = $ $ $ # p 0 p 1 p 2 p 3 % ' ' ' ' & University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 9

Cubic Bézier Curves What values should we choose for k 1 and k 2? If we let the control points be evenly spaced in parameter space, then p 0 is at u = 0, p 1 at u = 1/3, p 2 at u = 2/3 and p 3 at u = 1. Then p u (0) = (p 1 " p 0 ) (1/3 " 0) = 3(p 1 " p 0 ) p u (1) = (p 3 " p 2 ) (1" 2 /3) = 3(p 3 " p 2 ) and k 1 = k 2 = 3, giving a nice symmetric characteristic matrix: #"1 3 "3 1& % ( 3 "6 3 0 M B = % ( %"3 3 0 0( % ( So $ 1 0 0 0' p(u) = ("u 3 + 3u 2 " 3u +1) p 0 + ( 3u 3 " 6u 2 + 3u)p 1 + ("3u 3 + 3u 2 )p 2 + u 3 p 3 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 10

General Bézier Curves This can be rewritten as p(u) = (1" u) 3 p 0 + 3u(1" u) 2 p 1 + 3u 2 (1" u)p 2 + u 3 p 3 = 3 ) i= 0 # 3 % & ( u i 1" u $ i' ( ) 3"i p i Note that the binomial expansion of (u + (1 - u)) n is n ) i= 0 " n% $ ' u i 1( u # i & ( ) n(i This suggests a general formula for Bézier curves of arbitrary degree p(u) = n ) i= 0 " n% $ ' u i 1( u # i & ( ) n(i p i University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 11

General Bézier Curves The binomial expansion gives the Bernstein basis (or Bézier blending functions) B i,n for arbitrary degree Bézier curves p(u) = n ) i= 0 " n $ % ' u i 1( u # i & " B i,n (u) = $ n% ' u i 1( u # i & p(u) = n ) i= 0 ( ) n(i p i ( ) n(i B i,n (u) p i B 0,3 Cubic Bézier Blending Functions B 1,3 B 2,3 B 3,3 n Of particular interest to us (in addition to cubic curves): Linear: p(u) = (1 - u)p 0 + up 1 Quadratic: p(u) = (1 - u) 2 p 0 + 2u(1 - u)p 1 + u 2 p 2 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 12

Bézier Curve Properties Interpolates end control points, not middle ones Stays inside convex hull of control points Important for many algorithms Because it s a convex combination of points, i.e. affine with positive weights Variation diminishing Doesn t wiggle more than control polygon p 1 p 3 p 0 p 2 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 13

Rendering Bézier Curves We can obtain a point on a Bézier curve by just evaluating the function for a given value of u Fastest way, precompute A=M B P once control points are known, then evaluate p(u i )=[u i 3 u i 2 u i 1]A, i = 0,1,2,,n for n fixed increments of u For better numerical stability, take e.g. a quadratic curve (for simplicity) and rewrite p(u) = (1" u) 2 p 0 + 2u(1" u)p 1 + u 2 p 2 = (1" u)[(1" u)p 0 + up 1 ] + u[(1" u)p 1 + up 2 ] This is just a linear interpolation of two points, each of which was obtained by interpolating a pair of adjacent control points University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 14

de Casteljau Algorithm This hierarchical linear interpolation works for general Bézier curves, as given by the following recurrence p i, j = (1" u)p i, j"1 + up i+1, j"1 where p i,0 i = 0,1,2,,n are the control points for a degree n Bézier curve and p 0,n = p(u) For efficiency this should not be implemented recursively. Useful for point evaluation in a recursive subdivision algorithm to render a curve since it generates the control points for the subdivided curves. # $ % i = 0,1,2,K,n " j j =1,2,K,n University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 15

de Casteljau Algorithm p 1 p 0 p 2 Starting with the control points and a given value of u In this example, u 0.25 p 3 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 16

de Casteljau Algorithm p 1 q 1 p 0 q 0 p 2 q 0 (u) = (1" u)p 0 + up 1 q 2 q 1 (u) = (1" u)p 1 + up 2 q 2 (u) = (1" u)p 2 + up 3 p 3 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 17

de Casteljau Algorithm q 0 r 0 q 1 r 1 r 0 (u) = (1" u)q 0 (u) + uq 1 (u) r 1 (u) = (1" u)q 1 (u) + uq 2 (u) q 2 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 18

de Casteljau Algorithm r 0 p(u) r 1 p(u) = (1" u)r 0 (u) + ur 1 (u) University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 19

de Casteljau algorihm p 1 p 0 p(u) p 2 p 3 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 20

Drawing Bézier Curves How can you draw a curve? Generally no low-level support for drawing curves Can only draw line segments or individual pixels Approximate the curve as a series of line segments Analogous to tessellation of a surface Methods: Sample uniformly Sample adaptively Recursive Subdivision University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 21

Uniform Sampling Approximate curve with n line segments n chosen in advance Evaluate p i = p(u i ) where u i = i i = 0,1,...,n n For an arbitrary cubic curve p i = a( i 3 n 3 ) + b( i 2 n 2 ) + c( i n) + d Connect the points with lines Too few points? Bad approximation Curve is faceted Too many points? Slow to draw too many line segments Segments may draw on top of each other p(u) p 0 p 1 p 2 p 3 p 4 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 22

Adaptive Sampling Use only as many line segments as you need Fewer segments needed where curve is mostly flat More segments needed where curve bends No need to track bends that are smaller than a pixel Various schemes for sampling, checking results, deciding whether to sample more p(u) Or, use knowledge of curve structure: Adapt by recursive subdivision University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 23

Recursive Subdivision Any cubic curve segment can be expressed as a Bézier curve Any piece of a cubic curve is itself a cubic curve Therefore: Any Bézier curve can be broken up into smaller Bézier curves But how? University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 24

de Casteljau subdivision p 1 p 0 q r 0 0 x r 1 p 2 q 2 de Casteljau construction points are the control points of two Bézier sub-segments p 3 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 25

Adaptive subdivision algorithm Use de Casteljau construction to split Bézier segment Examine each half: If flat enough: draw line segment Else: recurse To test if curve is flat enough Only need to test if hull is flat enough Curve is guaranteed to lie within the hull e.g., test how far the handles are from a straight segment If it s about a pixel, the hull is flat University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 26

Composite Curves Hermite and Bézier curves generalize line segments to higher degree polynomials. But what if we want more complicated curves than we can get with a single one of these? Then we need to build composite curves, like polylines but curved. Continuity conditions for composite curves C 0 - The curve is continuous, i.e. the endpoints of consecutive curve segments coincide C 1 - The tangent (derivative with respect to the parameter) is continuous, i.e. the tangents match at the common endpoint of consecutive curve segments C 2 - The second parametric derivative is continuous, i.e. matches at common endpoints G 0 - Same as C 0 G 1 - Derivatives wrt the coordinates are continuous. Weaker than C 1, the tangents should point in the same direction, but lengths can differ. G 2 - Second derivatives wrt the coordinates are continuous University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 27

Composite Bézier Curves C 0, G 0 - Coincident end control points C 1 - p 3 - p 2 on first curve equals p 1 - p 0 on second G 1 - p 3 - p 2 on first curve proportional to p 1 - p 0 on second C 2, G 2 - More complex, use B-splines to automatically control continuity across curve segments University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 28

Polar form for Bézier Curves A much more useful point labeling scheme Start with knots, interesting values in parameter space For Bézier curves, parameter space is normally [0, 1], and the knots are at 0 and 1. 0 u 1 knot knot Now build a knot vector, a non-decreasing sequence of knot values. For a degree n Bézier curve, the knot vector will have n 0 s followed by n 1 s [0,0,,0,1,1,,1] Cubic Bézier knot vector [0,0,0,1,1,1] Quadratic Bézier knot vector [0,0,1,1] Polar labels for consecutive control points are sequences of n knots from the vector, incrementing the starting point by 1 each time Cubic Bézier control points: p 0 = p(0,0,0), p 1 = p(0,0,1), p 2 = p(0,1,1), p 3 = p(1,1,1) Quadratic Bézier control points: p 0 = p(0,0), p 1 = p(0,1), p 2 = p(1,1) University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 29

Polar form rules Polar values are symmetric in their arguments, i.e. all permutations of a polar label are equivalent. p(0,0,1) = p(0,1,0) = p(1,0,0), etc. Given p(u 1, u 2,,u n-1, a) and p(u 1, u 2,,u n-1, b), for any value c we can compute p(u 1,u 2,...,u n"1,c) = (b " c)p(u,u,...,u,a) + (c " a)p(u,u,...,u,b) 1 2 n"1 1 2 n"1 b " a That is, p(u 1, u 2,,u n-1, c) is an affine combination of p(u 1, u 2,,u n-1, a) and p(u 1, u 2,,u n-1, b). Examples: p(0,u,1) = (1" u)p(0,0,1) + up(0,1,1) (4 " u)p(0,2) + (u " 2)p(0,4) p(0,u) = 2 p(1,2,3,u) = (u 2 " u)p(2,1,3,u 1 ) + (u " u 1 )p(3,2,1,u 2 ) u 2 " u 1 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 30

de Casteljau in polar form p(0,0,1) p(0,0,0) p(0,1,1) p(1,1,1) University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 31

de Casteljau in polar form p(0,0,1) p(0,0,u) p(0,u,1) p(0,0,0) p(0,1,1) p(u,1,1) p(1,1,1) University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 32

de Casteljau in polar form p(0,0,1) p(0,u,u) p(0,0,u) p(0,0,0) p(0,u,1) p(u,u,1) p(0,1,1) p(u,1,1) p(1,1,1) University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 33

de Casteljau in polar form p(0,0,1) p(0,u,u) p(0,0,u) p(u,u,u) p(0,0,0) p(0,u,1) p(u,u,1) p(0,1,1) p(u,1,1) p(1,1,1) University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 34

de Casteljau in polar form p(0,0,1) p(0,u,u) p(0,0,u) p(u,u,u) p(0,0,0) p(0,u,1) p(u,u,1) p(0,1,1) p(u,1,1) p(1,1,1) University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 35

Composite curves in polar form Suppose we want to glue two cubic Bézier curves together in a way that automatically guarantees C 2 continuity everywhere. We can do this easily in polar form. Start with parameter space for the pair of curves 1st curve [0,1], 2nd curve (1,2] 0 u 1 knot knot u 2 knot Make a knot vector: [000,1,222] Number control points as before: p(0,0,0), p(0,0,1), p(0,1,2), p(1,2,2), p(2,2,2) Okay, 5 control points for the two curves, so 3 of them must be shared since each curve needs 4. That s what having only 1 copy of knot 1 achieves, and that s what gives us C 2 continuity at the join point at u = 1 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 36

de Boor algorithm in polar form p(0,0,1) p(0,1,2) p(0,0,0) p(1,2,2) p(2,2,2) u = 0.5 Knot vector = [0,0,0,1,2,2,2] University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 37

Inserting a knot p(0,0,1) p(0,0.5,1) p(0,1,2) p(0,0,0.5) p(0.5,1,2) p(0,0,0) p(1,2,2) p(2,2,2) u = 0.5 Knot vector = [0,0,0,0.5,1,2,2,2] University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 38

Inserting a 2nd knot p(0,0,0.5) p(0,0,1) p(0,0.5,0.5) p(0,0.5,1) p(0.5,0.5,1) p(0,1,2) p(0.5,1,2) p(0,0,0) p(1,2,2) u = 0.5 Knot vector = [0,0,0,0.5,0.5,1,2,2,2] p(2,2,2) University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 39

Inserting a 3rd knot to get a point p(0,0,1) p(0,0.5,1) p(0,0.5,0.5) p(0.5,0.5,1) p(0,0,0.5) p(0.5,0.5,0.5) p(0,1,2) p(0.5,1,2) p(0,0,0) p(1,2,2) u = 0.5 Knot vector = [0,0,0,0.5,0.5,0.5,1,2,2,2] p(2,2,2) University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 40

Recovering the Bézier curves p(0,0,1) p(0,1,1) p(0,1,2) p(1,1,2) p(0,0,0) p(1,2,2) p(2,2,2) Knot vector = [0,0,0,1,1,2,2,2] University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 41

Recovering the Bézier curves p(0,0,1) p(0,1,1) p(0,1,2) p(1,1,1) p(1,1,2) p(0,0,0) p(1,2,2) p(2,2,2) Knot vector = [0,0,0,1,1,1,2,2,2] University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 42

B-Splines B-splines are a generalization of Bézier curves that allows grouping them together with continuity across the joints The B in B-splines stands for basis, they are based on a very general class of spline basis functions Splines is a term referring to composite parametric curves with guaranteed continuity The general form is similar to that of Bézier curves Given m + 1 values u i in parameter space (these are called knots), a degree n B-spline curve is given by: p(u) = where m i + n + 1 m"n"1 # i= 0 N i,n (u)p i % N i,0 (u) = 1 u i $ u < u i+1 & ' 0 otherwise N i,n (u) = u " u i u i+n " u i N i,n"1 (u) + u i+n +1 " u u i+n +1 " u i+1 N i+1,n"1 (u) University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 43

Uniform periodic basis N(u) = Let N(u) be a global basis function for our uniform cubic B-splines N(u) is piecewise cubic # 1 6 u3 %" 1 (u 2 "1)3 + 1 (u 2 "1)2 + 1 (u "1) + 1 2 6 $ 1 % (u " 2 2)3 " (u " 2) 2 + 2 3 & %" 1 (u " 6 3)3 + 1 (u " 2 3)2 " 1 (u " 3) + 1 2 6 = N(u) 0 1 2 3 4 u p0 p 3 p 2 p 1 1 6 u3 if u <1 " 1 2 u3 + 2u 2 " 2u + 2 3 if u < 2 1 2 u3 " 4u 2 +10u " 22 3 if u < 3 " 1 6 u3 + 2u 2 " 8u + 32 3 otherwise p(u) = N(u) p 3 + N(u+1) p 2 + N(u+2) p 1 + N(u+3)p 0 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 44

Uniform periodic B-Spline p 1 p 2 p 0 p(u) = ( 1/6u 3 + 1/2u 2 1/2u + 1/6)p 0 + ( 1/2u 3 u 2 + 2/3)p 1 + ( 1/2u 3 + 1/2u 2 + 1/2u + 1/6)p 2 + ( 1/6u 3 )p 3 p 3 University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 45