47
CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Embed Size (px)

DESCRIPTION

Michael Eckmann - Skidmore College - CS325 - Spring 2010 Polygonal Meshes A collection of edges, vertices and polygons –which are connected –and where each edge is shared by at most 2 polygons (example on board)‏ –each vertex is shared by at least 2 edges When polygonal meshes are created interactively –care must be taken to make sure that the above constraints are fulfilled. Different ways to store a polygonal mesh have consequences on –space (to store the mesh data)‏ –and time (to operate on the polygonal mesh)‏

Citation preview

Page 1: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

CS 325Computer Graphics

04 / 30 / 2010

Instructor: Michael Eckmann

Page 2: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 325 - Spring 2010

Today’s Topics• Questions?• Polygonal meshes• Piecewise Cubic Parametric curves

– General description and concept– Hermite– Bezier– Spline

Page 3: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS325 - Spring 2010

Polygonal Meshes• A collection of edges, vertices and polygons

– which are connected– and where each edge is shared by at most 2 polygons (example on

board)– each vertex is shared by at least 2 edges

• When polygonal meshes are created interactively– care must be taken to make sure that the above constraints are

fulfilled.

• Different ways to store a polygonal mesh have consequences on – space (to store the mesh data)– and time (to operate on the polygonal mesh)

Page 4: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS325 - Spring 2010

Polygonal Meshes• Some operations that are common on polygonal meshes

– find all edges containing a particular vertex– find all the polygons sharing a particular edge or vertex– find the two vertices for an edge– find all the edges of a polygon– determining if all the conditions of a polygonal mesh are met

• How the polygonal mesh is represented has consequences on the speed of

those operations and on how much space is needed to store a polygonal

mesh.

Page 5: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS325 - Spring 2010

Polygonal Meshes• Representation schemes:

– represent each polygon as a list of vertices in order around the polygon

• edges exist between each pair of successive vertices as well as between the last and the first

• efficient in space for a single polygon • inefficient in space for a polygonal mesh, why?• interactively working on a polygonal mesh represented this way

would be time consuming (e.g. move a vertex --- need to find all the polygons that contain it and move it...)

• etc.– store all the vertices in a list, and represent a polygon as an ordered

list of pointers into the vertex list.• more efficient in space for a polygonal mesh• move a vertex --- moves it for all polygons that contain it• still hard to find all polygons that share an edge

Page 6: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS325 - Spring 2010

Polygonal Meshes• Representation schemes:

– store all the vertices in a list, and all the edges in an edge list* and represent a polygon as an ordered list of pointers into the edge list

* edge list contains pointers to two vertices and pointers to one or two polygons

• can easily find all polys that share an edge now

• In all 3 representation schemes just described it is still not easy to find all the edges containing a particular vertex

– in the description of a vertex, could add pointers to all the edges

Page 7: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS325 - Spring 2010

Curves• Some motivations for having mathematical equations define curves and

surfaces (see section 8-8 Spline Representations in our text).• 1) polylines and polygons are 1st degree piecewise linear approximations

to curves and surfaces (they are approximations unless they are the exact description of the outline or shape)

– if they are approximations, then it takes large numbers of points to describe them for more accurate representations == BAD

– if interactively building these surfaces (or edges/outlines) then the more points, the more tedious it is to build

• We want to be able to get more accurate representations of curved

surfaces (or edges/outlines) than polygons or polylines give us AND we

want to be able to represent them with less points. This will benefit us by

having less storage and being able to be built interactively more easily.

Page 8: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS325 - Spring 2010

Curves• These smooth curves are also used in graphics for other purposes like

describing a motion path for an animation sequence.

Page 9: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS325 - Spring 2010

Curves• Let's consider 2d dimensional curves which can be later generalized to 3d

surfaces.• Instead of using piecewise linear functions, we use piecewise smooth

curves. These are of a higher degree than linear functions.• We have several choices

– a) we can use functions like y = f(x) • problem that for each value of x there is one and only one y value

– can't represent circles/ellipses etc.• problem that you can't represent vertical lines and is problematic

to represent curves with a tangent/slope of infinity– b) we can use implicit equations like f(x,y) = 0 (e.g. a circle of radius

1 like: x2 + y2 – 1 = 0)• may have more solutions than we want --- e.g. to model half a

circle you'd need constraints on the values of x or y or both.• joining 2 implicitly defined curves is hard to make the tangents at

the join point agree (why might we want that? -- example on board)

Page 10: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS325 - Spring 2010

Curves• We have several choices

– c) we can use parametric equations of the curve• x = f(t) and y = g(t)

– where f(t) and g(t) are typically cubic polynomials• the problems of the other 2 choices are solved as we shall see

– we typically use cubic polynomials because• 1) quadratic or linear polynomials do not allow a curve segment

to be described with 2 endpoints and specific slopes at the 2 endpoints (examples on the board)

• 2) higher degree (than 3) polynomials are more compute intensive and allow (possibly) unwanted artefacts in the curve

• A cubic polynomial to define a finite curve segment has 4 coefficients per

parametric equationx(t) = axt

3 + bxt2 + cxt + dx y(t) = ayt

3 + byt2 + cyt + dy

z(t) = azt3 + bzt

2 + czt + dz where 0 <= t <= 1

Page 11: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS325 - Spring 2010

Curves• x(t) = axt

3 + bxt2 + cxt + dx

• y(t) = ayt3 + byt

2 + cyt + dy • z(t) = azt

3 + bzt2 + czt + dz where 0 <= t <= 1

• can be written in matrix form as:

• Q(t) = [x(t) y(t) z(t)] = T C • where T = [t3 t2 t 1] and

[ax ay az]• C = [bx by bz]

[cx cy cz] [dx dy dz]

Page 12: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS325 - Spring 2010

Curves• We specify these curves by a set of control points.• Polynomial sections can be fit together so that all the control points

are connected which is called interpolated.• Polynomial sections can be fit together so that some or none of the

control points are connected which is called approximated.• Examples of these on the next two slides.

Page 13: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann
Page 14: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann
Page 15: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS325 - Spring 2010

Curves• Continuity - when joining two curve segments together (piecewise

curves). There are several different kinds of continuity to consider• Geometric continuity

– G0 geometric continuity = the curve segments are joined together– G1 geometric continuity = the curve segments are joined together and

the directions of tangent vectors are equal at the point where they are joined

• Parametric continuity– C0 parametric continuity = same as G0 geometric continuity– C1 parametric continuity = the curve segments are joined together and

the directions AND magnitudes of tangent vectors are equal at the point where they are joined

– Ck parametric continuity = the curve segments are joined together and the directions AND magnitudes of all the derivatives up to the kth are equal at the point where they are joined (that is, the 1st through kth derivatives exist and are continuous themselves)

Page 16: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS325 - Spring 2010

Curves• Let me draw on the board some example joined curve segments and point

out their continuity. See page 422 in text.

Page 17: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS325 - Spring 2010

Curves• There are several families of cubic polynomial curve segments that are

determined by different things– Hermite

• determined by the 2 endpoints and the tangent vector at each of the 2 endpoints

– Bezier• determined by the 2 endpoints P1 & P4 and 2 other intermediate

points P2 & P3 not on the curve– the tangent vectors at the end points are the vectors P1P2 and

P3P4– which are [P2 – P1] and [P4 – P3]

– Spline• determined by 4 specific points

• Note: there can be higher degree polynomials of these families of curves

(see a few slides ahead for a 4th degree polynomial Bezier curve segment)

Page 18: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Bezier Curve segment examples

Page 19: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

more Bezier Curve segment examples

Page 20: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Recall• x(t) = axt

3 + bxt2 + cxt + dx

• y(t) = ayt3 + byt

2 + cyt + dy • z(t) = azt

3 + bzt2 + czt + dz where 0 <= t <= 1

• can be written in matrix form as:

• Q(t) = [x(t) y(t) z(t)] = T C • where T = [t3 t2 t 1] and

[ax ay az]• C = [bx by bz]

[cx cy cz] [dx dy dz]

Page 21: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Basis Matrix and Geometry Matrix• Q(t) = [x(t) y(t) z(t)] = T C

• where T = [t3 t2 t 1] and

[ax ay az]• C = [bx by bz]

[cx cy cz] [dx dy dz]

• can be rewritten so that C = M G where – M is a 4x4 matrix called the Basis Matrix and – G is a 4x1 column vector called the Geometry Matrix

• so Q(t) = T M G

Page 22: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Basis Matrix and Geometry Matrix• Q(t) = [x(t) y(t) z(t)] = T M G

• where T = [t3 t2 t 1] and

[m11 m12 m13 m14]• M = [m21 m22 m23 m24]

[m31 m32 m33 m34][m41 m42 m43 m44]

[G1]• G = [G2]

[G3][G4]

Note: the values of Gi are the conditions that define the curve --- such as

endpoints and tangent vectors at those end points

Page 23: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Blending functions• look at x(t) • x(t) = (t3 m11+ t2 m21 + t m31 + m41)g1x + (t3 m12+ t2 m22 + t m32 + m42)g2x +

(t3 m13+ t2 m23 + t m33 + m43)g3x + (t3 m14+ t2 m24 + t m34 + m44)g4x

where g1x is the x coordinate of G1

similar equations for y(t) and z(t)

the curve is a weighted sum of the elements of the Geometry Matrix where the weights are cubic polynomials of t which are called the Blending Functions

the Blending Functions B are given by B = T M, since Q(t) = T M G,Q(t) = B G

Page 24: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Example with lines• Before going through an example to find the blending functions from a

set of geometry information for parametric cubic polynomials, let's first see how the procedure works with determining the blending functions of a parametric line.

Page 25: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

Example with lines• Recall the parametric equation of a line:

• x(t) = x0 + t ( xend – x0)• y(t) = y0 + t ( yend – y0)• z(t) = z0 + t ( zend – z0)• what are the endpoints of the line segment described above?

can be rewritten as: • x(t) = axt + bx

• y(t) = ayt + by

• y(t) = azt + bz

Page 26: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• x(t) = axt + bx

• y(t) = ayt + by

• y(t) = azt + bz To get this in the form of Q(t) = T C = T M G

• T = [ t 1 ] and • C = [ ax ay az ]• [ bx by bz]

• C = M G where

• M = [ m11 m12 ] and G = [ g1x g1y g1z ]• [ m21 m22 ] [ g2x g2y g2z ]

Example with lines

Page 27: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• The geometry matrix is simply the two endpoints • G = [ G1 ] = [ g1x g1y g1z ] = [ x0 y0 z0 ] = [ P0 ]• [ G2 ] [ g2x g2y g2z ] [ xend yend zend ] [ P1 ]

• we need to find out the Basis Matrix M• M = [ m11 m12 ]• [ m21 m22 ]

• Q(t) = T M G = [ t 1 ] M G

• Let's do the rest on the board to figure out M

Example with lines

Page 28: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• Q(t) = [ t 1 ] M G• when t=0, Q(0) is the first endpoint G1

• when t=1, Q(1) is the first endpoint G2

• Q(0) = G1 = [ 0 1 ] M G and• Q(1) = G2 = [ 1 1 ] M G

• [ G1 ] = [ 0 1 ] M [ G1 ]• [ G2 ] [ 1 1 ] [ G2 ] • Therefore, • [ 0 1 ] M = I (the identity matrix)• [ 1 1 ] • So, to get M, take the inverse of [ 0 1 ]• [ 1 1 ]

Example with lines

Page 29: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• So, to get M, take the inverse of [ 0 1 ]• [ 1 1 ] The inverse of a 2x2 invertible matrix A = [ a11 a12 ] = [ a21 a22 ] 1 [ a22 -a12 ] ---------------- [ -a21 a11 ]a11a22 - a12 a21

So,M = (1 / (0-1)) [1 -1] = -1 [1 -1] = [ -1 1 ] [-1 0] [-1 0] [ 1 0 ]

Example with lines

Page 30: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• Q(t) = T M G = [ t 1 ] M G = [ t 1 ] [ -1 1 ] G • [ 1 0 ]

• Recall that T M are the blending functions. • What then, are the blending functions of lines?

• Let's plot them on the board.

Example with lines

Page 31: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• Q(t) = T C = T M G = [ t3 t2 t 1 ] M G• M is the 4x4 Basis matrix and G is the Geometry matrix• For Hermite curve segments, recall that they are defined with 2 endpoints

and the tangents at those endpoints. So, the Geometry matrix is made up of the 2 endpoints and the 2 tangent vectors.

• The tangent vectors are determined by the derivative of the curve with respect to t at each of the end points (when t=0 and when t=1).

• x(t) = axt3 + bxt

2 + cxt + dx • y(t) = ayt

3 + byt2 + cyt + dy

• z(t) = azt3 + bzt

2 + czt + dz where 0 <= t <= 1• x'(t) = 3axt

2 + 2bxt + cx

• y'(t) = 3ayt2 + 2byt + cy

• z'(t) = 3azt2 + 2bzt + cz

Hermite Basis Matrix and Blending Functions

Page 32: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• x'(t) = 3axt2 + 2bxt + cx

• y'(t) = 3ayt2 + 2byt + cy

• z'(t) = 3azt2 + 2bzt + cz

So, Q'(t) = [ 3t2 2t 1 0 ] C• agreed?• Let's call the 2 endpoints in the Geometry Matrix P1 and P4 and the 2

tangent vectors at those 2 endpoints R1 and R4.• [ P1 ]• G = [ P4 ]• [ R1 ]• [ R4 ]

Hermite Basis Matrix and Blending Functions

Page 33: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• Let's just work with the x coordinates (the y and z coordinates will be handled similarly)

• So, x(t) = axt3 + bxt

2 + cxt + dx = T Cx = [ t3 t2 t 1 ] M Gx • and x'(t) = 3axt

2 + 2bxt + cx = T Cx = [ 3t2 2t 1 0 ] M Gx • when t = 0, x(t) gets us the first endpoint and when t = 1, x(t) gets us the

other endpoint.• x(0) = P1x = [ 0 0 0 1 ] M Gx • x(1) = P4x = [ 1 1 1 1 ] M Gx • when t = 0, x'(t) gets us the tangent at the first endpoint and when t = 1,

x'(t) gets us the tangent at the other endpoint.• x'(0) = R1x = [ 0 0 1 0 ] M Gx • x'(1) = R4x = [ 3 2 1 0 ] M Gx

Hermite Basis Matrix and Blending Functions

Page 34: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• [P1 ] [ 0 0 0 1 ] • [P4 ] = Gx = [ 1 1 1 1 ] M Gx • [R1 ] [ 0 0 1 0 ] • [R4 ]x [ 3 2 1 0 ]

• just like when we solved for M (the basis matrix) with the line equations, we do the same thing here because clearly

• [ 0 0 0 1 ] • [ 1 1 1 1 ] M = Identity• [ 0 0 1 0 ] • [ 3 2 1 0 ]• so, that matrix on the left is equal to M-1

Hermite Basis Matrix and Blending Functions

Page 35: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• There are techniques to get the inverse of a matrix which we won't go into here --- if you've had linear algebra, you should know how.

• The inverse of• [ 0 0 0 1 ] • [ 1 1 1 1 ]• [ 0 0 1 0 ] • [ 3 2 1 0 ]• is• [ 2 -2 1 1 ] • [ -3 3 -2 -1 ]• [ 0 0 1 0 ] • [ 1 0 0 0 ]• This is the Basis Matrix for Hermite curve segments. • Let's verify that it is indeed the inverse of the matrix above. How?

Hermite Basis Matrix and Blending Functions

Page 36: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• [ 2 -2 1 1 ] • T M = [ t3 t2 t 1 ] [ -3 3 -2 -1 ]• [ 0 0 1 0 ] • [ 1 0 0 0 ]• The blending functions are:

2 t3 - 3t2 + 1 -2 t3 + 3t2

t3 - 2t2 + t t3 - t2

• These are respectively multiplied by P1, P4, R1, and R4

and then added together to get Q(t) which is the curve

Hermite Basis Matrix and Blending Functions

Page 37: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann
Page 38: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• [ P1 ]• G1 = [ P4 ]• [ R1 ]• [ R4 ]

• [ P4 ]• G2 = [ P7 ]• [ kR4 ]• [ R7 ]• If two Hermite curve segments have the above geometry matrices then

we can see that they join up at P4 and that the tangent vectors at P4 are proportional, hence giving G1 continuity. If k=1 then C1 continuity.

Using the Geometry matrices to join curves together

Page 39: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• As stated earlier, the pieces of information defining a Bezier curve are 4 points. Therefore, the Geometry Matrix are these 4 points.

• P1 and P4 are the endpoints and P2 and P3 are the intermediate points that do not necessarily (usually don't) live on the curve.

• R1 (the tangent at the first endpoint) = 3 [P2 – P1] • R4 (the tangent at the other endpoint) = 3 [P4 – P3] • [ P1 ]• G = [ P2 ]• [ P3 ]• [ P4 ]• Q(t) = [ t3 t2 t 1 ] M G

Bezier Basis Matrix and Blending Functions

Page 40: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• The Basis Matrix M for Bezier curves is:

• [ -1 3 -3 1 ] • [ 3 6 3 0 ] • [ -3 3 0 0 ] • [ 1 0 0 0 ]

• Q(t) = [ t3 t2 t 1 ] M G• So, what are the blending functions?

Bezier Basis Matrix and Blending Functions

Page 41: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• The Blending functions are:-t3 + 3t2 -3t + 13t3 + 6t2 + 3t-3t3 + 3t2 t3

• These functions are the Bernstein polynomials which are of the form:

• C(n, k) tk(1 – t )n-k

• where C(n,k) is the choose function. C(n,k) = n! / (k! ((n-k)!))

• In the case where n=3 (cubic), we have k among 0,1,2,3, which gives one

function per geometric element (point.)

Bezier Basis Matrix and Blending Functions

Page 42: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann
Page 43: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• A nice feature of Bezier curves is:– Because the blending functions are symmetric to the lines t and 1-t,

the sequence of points used to define a Bezier curve can be reversed without changing the shape of the curve.

• Both Bezier and Hermite curves are easy to make have G1 or C1

continuity at all the join points.

• It is not easy though to get C2 continuity at the join points for Hermite

and Bezier curves.

• Hermite and Bezier curves interpolate the points (that is, the curves go

through the points).

• Splines are C2 continuous.

Bezier/Hermite Curves vs. Splines

Page 44: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• Splines are C2 continuous. • Natural cubic splines interpolate the control points and the coefficients

of a natural cubic spline are dependent on all n control points. – expensive to invert an n+1 by n+1 matrix– moving one control point affects the entire curve

• B-splines are defined by m+1 control points, where m>=3. The control points are named P0 through Pm.

– There are m-2 cubic polynomial, C2 continuous curve segments joined together. These segments are named Q3 through Qm.

– The join points (as well as the endpoints) of the B-spline are called knots. There are m-1 knots.

– moving one control point has only a local effect (that is a good thing)– clearly the B-splines approximate (not interpolate) the control points– Let's look at the handout

Splines

Page 45: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• Uniform = spacing between knots are equal (that is the difference in t between knots is uniform)

– the blending functions for each segment have the same shape but are shifted

• Nonuniform = spacing between knots are unequal – more flexibility to control the curve shape than uniform– 2 or more consecutive knots that are the same reduce the continuity

there (e.g., if we have 0 difference between 2 or more knots then continuity is reduced by 1 (i.e., C2 -> C1 continuity))

• Rational = each spline curve segment is defined as a ratio of polynomials– are invariant under rotation, scaling, translation AND perspective

transformations of the control points. So, we apply the perspective transform to the control points and then generate the perspectively transformed curve from the transformed control points to obtain the correct view of the curve.

– in addition to the myriad of curves that can be produced, they can precisely define the conic sections (e.g. circle, ellipse, parabola, hyperbola)

• NURBS = NonUniform Rational B-Splines

B-Splines

Page 46: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• NURBS = NonUniform Rational B-Splines– used frequently in graphics packages due to the properties just

described• Nonrational = each spline curve segment is defined as a polynomial (not

a ratio of polynomials)– has the disadvantage (compared to rational B-splines) that they are

not invariant to perspective transformations as well as cannot precisely describe the conics

B-Splines

Page 47: CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS 376 - Spring 2007

• Recall that we defined parametric cubic curves as Q(t) = T M G.• For surfaces we define a parametric cubic surface with two parameters,

hence Q(s,t)• for some particular value of s, say s1, Q(s1,t) is a parametric curve. Also,

for some particular value of t, say t1, Q(s,t1) is a parametric curve.• [ G1(t) ]• Q(s,t) = S M G(t) = S M [ G2(t) ]• [ G3(t) ]• [ G4(t) ]

Curve Surfaces