Presentation is loading. Please wait.

Presentation is loading. Please wait.

Representation of Curves and Surfaces Chapter 9. Chapter 9 -- Representation of Curves and Surfaces2 u The classic teapot shown here is perhaps one of.

Similar presentations


Presentation on theme: "Representation of Curves and Surfaces Chapter 9. Chapter 9 -- Representation of Curves and Surfaces2 u The classic teapot shown here is perhaps one of."— Presentation transcript:

1 Representation of Curves and Surfaces Chapter 9

2 Chapter 9 -- Representation of Curves and Surfaces2 u The classic teapot shown here is perhaps one of the best known icons of computer graphics F Since it was modeled in 1975 it has been used by dozens of researchers as a structure for demonstrating the latest techniques for producing realistic surfaces and textures.

3 Chapter 9 -- Representation of Curves and Surfaces3 u Modeling the teapot required specifying its shape as a collection of smooth surface elements, known as bicubic patches u The need to represent curves and surfaces arises in two cases: F in modeling existing objects (a car, a face, or a mountain)(a car, a face, or a mountain) F in modeling from scratch u This chapter introduces the general area of surface modeling. F This area is very broad, and only three of the most common representations for 3D surfaces are presented here.

4 Chapter 9 -- Representation of Curves and Surfaces4 u A Polygon Mesh F is a set of connected polygonally bounded planar surfaces. Open boxes, cabinets, and building exteriors can be easily and naturally represented by polygon meshes.Open boxes, cabinets, and building exteriors can be easily and naturally represented by polygon meshes. They can be used (although less easily) to to represent objects with curved surfacesThey can be used (although less easily) to to represent objects with curved surfaces

5 Chapter 9 -- Representation of Curves and Surfaces5 u Parametric polynomial curves F you define points on a 3D curve by using three polynomial parameters. F The term cubic curve will often be used for such curves. u Parametric bivariate (two-variable) polynomial surface patches. F Define the points on a surface using three bivariate polynomials (one for each of x,y, and z) F The boundaries of the patches are parametric polynomial curves. F Sometimes called bicubic surfaces.

6 Chapter 9 -- Representation of Curves and Surfaces6 u Quadric surfaces F defined implicitly by an equation f(x,y,z)=0; where f is a quadric polynomial F Quadric surfaces are convenient representations for the familiar sphere, ellipsoid, and cylinder u Chapter 10 (solid modeling) incorporates these representations to represent not just surfaces, but also bounded (solid) volumes. F The surface representations we present here are used, sometimes in combination with one another, to bound a 3D volume.

7 Chapter 9 -- Representation of Curves and Surfaces7 u A polygon mesh is a collection of edges, vertices, and polygons connected such that each edge is shared by at most two polygons. u A polygon mesh can be represented in several different ways, each with its advantages and disadvantages. F Your task is to choose the appropriate representation. F Two basic criteria, space and time, can be used to evaluation the different representations. 1. Polygonal Meshes

8 Chapter 9 -- Representation of Curves and Surfaces8 u Typical operations include: F finding all edges incident to a vertex. F finding the vertices connected by an edge F finding the edges of a polygon F displaying the mesh F identifying errors missing edge, vertex, or polygonmissing edge, vertex, or polygon u In general, the more explicitly the relationships among the polygons, vertices, and edges are represented, F the faster the operations F the more space the representation requires.

9 Chapter 9 -- Representation of Curves and Surfaces9 1.1 Representing Polygonal Meshes u In this section, we discuss three polygon-mesh representations: F explicit representation F a vertex list F an edge list

10 Chapter 9 -- Representation of Curves and Surfaces10 u Explicit representation F each polygon is represented by a list of vertex coordinates: P((x1,y1,z1), (x2,y2,z2),…,(xn,yn,zn))P((x1,y1,z1), (x2,y2,z2),…,(xn,yn,zn)) F the vertices are stored in the order in which we would encounter them were we traveling around the polygon. F For a single polygon, this representation is space efficient; for a polygon mesh, however, much space is list, because the coordinates of shared vertices are duplicated. F Even more of a problem, there is no explicit representation of shared edges and vertices so, if you wish to move one, you have to search for all instances of it.so, if you wish to move one, you have to search for all instances of it.

11 Chapter 9 -- Representation of Curves and Surfaces11 F If you are going to search for it, it is best to sort the vertices and even then there is danger of round-off error in vertex storage, so the same vertex might have slightly different coordinates -- then you might never find it.and even then there is danger of round-off error in vertex storage, so the same vertex might have slightly different coordinates -- then you might never find it. So, at best we have added O(n log n) and at worst it is O(n) where n is the number of vertices and edges.So, at best we have added O(n log n) and at worst it is O(n) where n is the number of vertices and edges. F With this representation, drawing will duplicate edges, and vertices can be drawn multiple times. A problem may also be created for raster displays if edges are drawn in opposite directions, in which case extra pixels may be intensified.A problem may also be created for raster displays if edges are drawn in opposite directions, in which case extra pixels may be intensified.

12 Chapter 9 -- Representation of Curves and Surfaces12 u Pointers to a vertex list F each vertex in the polygon mesh is stored just once, in the vertex list, V. F A polygon is defined by a list of indices (or pointers) into the vertex list. V = (V1, V2, V3)V = (V1, V2, V3) –=((x1,y1,z1),…,(x4,y4,z4)) P1 = (1,2,4)P1 = (1,2,4) P2 = (4,2,3)P2 = (4,2,3)

13 Chapter 9 -- Representation of Curves and Surfaces13 u Pointers to an edge list F when using this method, we again have the vertex list V, but we represent a polygon as a list of pointers not to the vertex list, but to an edge list F In the edge list, each edge occurs once, and each edge points to the two vertices in the vertex list. (as well as telling you which polygons this edge is in. F We show polygons by displaying all edges, rather than displaying all polygons.

14 Chapter 9 -- Representation of Curves and Surfaces14 u Note: F In none of these three representations is it easy to determine which edges are incident to a vertex, All edges must be inspected. F Of course, information can be added explicitly to determine such relationships, and the literature contains some examples of this.

15 Chapter 9 -- Representation of Curves and Surfaces15 1.2 Plane Equations u When we are working with polygons or polygon meshes, we frequently need to know the equation of the plane in which the polygon lies. F Some cases it is known. F In others we can use 3 of the vertices to find the plane. Recall Ax + By +Cz + D = 0Recall Ax + By +Cz + D = 0

16 Chapter 9 -- Representation of Curves and Surfaces16 u The coefficients A, B, and C define the normal to the plane. F Given P1, P2, and P3 on the plane, the normal to the plane can be computes as P1P2xP1P3 (or P2P3xP2P1, … etc). Note if the cross-product is zero, then the three points are collinear and do not define a plane.Note if the cross-product is zero, then the three points are collinear and do not define a plane. F We can find D by putting A, B, and C into the equation along with any one of the points(x,y,z). u Note: If there are more than 3 points in the polygon the polygon may not be planar.

17 Chapter 9 -- Representation of Curves and Surfaces17 2. Parametric Cubic Curves u Polylines and polygons are first-degree, piecewise approximates to curves and surfaces. F Unless the curves or surfaces are also piecewise linear, a large number of endpoint coordinates must be created and stored if we are to achieve reasonable accuracy. u In this section, a more compact and more manipulable representation of piecewise smooth curves is developed. Section 3 generalizes this from curves to surfaces.

18 Chapter 9 -- Representation of Curves and Surfaces18 u The higher degree approximations can be based on one of three methods: F First: express y and z as explicit functions of x [y=f(x), z=g(x)] There are a lot of problems with this (it can’t handle being rotates,…)There are a lot of problems with this (it can’t handle being rotates,…) F Second: we can choose to model curves as implicit equations of the form f(x,y,z) = 0 This method is fraught with its own perils. -- when curves are joined, you can’t guarantee tangent continuity, which is important in a lot of applications.This method is fraught with its own perils. -- when curves are joined, you can’t guarantee tangent continuity, which is important in a lot of applications. F These two methods do not permit rapid determination of whether a point lies on the curve, or on which side it lies. (as we did in Chapter 3 for rasterization)

19 Chapter 9 -- Representation of Curves and Surfaces19 F Third: The parametric representation for curves [x=x(t), y=y(t), z=z(t)] overcomes the problems caused by functional or implicit forms and offers a variety of other attractions that will come clear later in this chapter. Here a curve is approximated by a piecewise polynomial curve instead of by a piecewise linear curveHere a curve is approximated by a piecewise polynomial curve instead of by a piecewise linear curve Cubic polynomials are most often used because lower- degree polynomials give too little flexibility in controlling the shape of the curve. (and higher degree polynomials can introduce unwanted wiggles -- and more computation)Cubic polynomials are most often used because lower- degree polynomials give too little flexibility in controlling the shape of the curve. (and higher degree polynomials can introduce unwanted wiggles -- and more computation) Also parametric cubics are the lowest-degree curves that are non-planar in 3DAlso parametric cubics are the lowest-degree curves that are non-planar in 3D Despite these complexities, higher degree curves are used in applications -- such as car and airplane design -- in which higher degree derivatives must be controlled to create surfaces that are aerodynamically efficient.Despite these complexities, higher degree curves are used in applications -- such as car and airplane design -- in which higher degree derivatives must be controlled to create surfaces that are aerodynamically efficient.

20 Chapter 9 -- Representation of Curves and Surfaces20 2.1 Basic Characteristics  The cubic polynomials that define a curve segment Q(t) =[x(t), y(t), z(t)] T are of the form: F x(t) = a x t 3 + b x t 2 + c x t + d x F y(t) = a y t 3 + b y t 2 + c y t + d y F z(t) = a z t 3 + b z t 2 + c z t + d z F To deal with finite segments of the curve, we restrict the parameter to the [0,1] interval

21 Chapter 9 -- Representation of Curves and Surfaces21 u Define:  T = [t 3 t 2 t 1] T, F And C as:  we can then rewrite the equations on the previous slide as: Q(t) = C. T

22 Chapter 9 -- Representation of Curves and Surfaces22 u This figure shows two joined parametric cubic curve segments and their polynomials. u Note how this figure illustrates the ability of parametrics to easily represent multiple values of y for a single x.

23 Chapter 9 -- Representation of Curves and Surfaces23 u Continuity between curve segments F the derivative of Q(t) is the parametric tangent vector of the curve. F If two curve segments join together, the curve has G 0 geometric continuity F If the directions of the two segments tangent vectors (but not necessarily their magnitude) are the same at the join point, the curve is said to have G 1 geometric continuity F If the tangent vectors are the same (directions and magnitude), the curves are said to have first-degree continuity in t, or parametric continuity, and is said to be C 1 continuous.

24 Chapter 9 -- Representation of Curves and Surfaces24 F If the direction and magnitude of derivatives 1 to n are equal at the joined point, the curves are called C n continuous. F This figure shows curve S and 3 curves C0, C1, and C2 joined with it with three different continuities with S.

25 Chapter 9 -- Representation of Curves and Surfaces25 F In this figure Q1, Q2, and Q3 join at point P2. F Q1 and Q2 are G 1 and C 1 continuous. F Q1 and Q3 have tangents with different magnitude (same direction) so they are only G 1 continuous.

26 Chapter 9 -- Representation of Curves and Surfaces26 u Relation to constraints F A curve segment Q(t) is defined by constraints on endpoints, tangent vectors, and continuity between curve segments. F There are three major type of curves described in the next few subsections: HermiteHermite BezierBezier SplinesSplines

27 Chapter 9 -- Representation of Curves and Surfaces27 2.2 Hermite Curves u The Hermite form of the cubic polynomial curve segment is determined by constraints on the endpoints (P1 and P4) and the tangent vector endpoints (R1 and R4)

28 Chapter 9 -- Representation of Curves and Surfaces28 u This figure shows the four functions F weighted by the y component F Their sum y(t) F and the curve Q(t)

29 Chapter 9 -- Representation of Curves and Surfaces29 u This figure shows a series of Hermite curves with everything equal except the length of the tangent vector R1

30 Chapter 9 -- Representation of Curves and Surfaces30 u This figure shows a series of Hermite curves with everything equal except the direction of one of the tangent vectors

31 Chapter 9 -- Representation of Curves and Surfaces31 u In an interactive computer graphics system, the endpoints of the tangent vector of the curve are manipulated interactively by the user to shape the curve. This figure shows one way to implement this

32 Chapter 9 -- Representation of Curves and Surfaces32 u Drawing Parametric curves F Hermite and other similar parametric cubic curves are simple to display. Program 9.1 pg 336 gives the code to calculate the vertices to display.Program 9.1 pg 336 gives the code to calculate the vertices to display. The for loop has 12 multiplies and 10 adds per 3D pointThe for loop has 12 multiplies and 10 adds per 3D point F Because the cubic curves are linear combinations (weighted sums) of the four elements, we can transform the curves by transforming the geometry vector that defines them and then use it to generate the curve. This is much easier that generating and translating, rotating,...This is much easier that generating and translating, rotating,...

33 Chapter 9 -- Representation of Curves and Surfaces33 2.3 Bezier Curves u The Bezier form of the cubic polynomial curve segment F It was named after Pierre Bezier who developed them for use in designing automobiles at Renault. F It indirectly specifies the endpoint tangent vector by specifying two intermediate points that are not on the curve.

34 Chapter 9 -- Representation of Curves and Surfaces34 F The starting and ending tangent vectors are defined by P1P2 and P3P4 and are related to R1 and R4 F Notice the curve is inside the convex hull of the control points.

35 Chapter 9 -- Representation of Curves and Surfaces35 F The Bernstein Polynomials, which are the weighting functions for Bezier Curves are shown in this figure Notice at t=0, B B1 is the only curve nonzero, and at t=1, B B4 is the only curve nonzero, so the curve goes through the two end control points.Notice at t=0, B B1 is the only curve nonzero, and at t=1, B B4 is the only curve nonzero, so the curve goes through the two end control points.

36 Chapter 9 -- Representation of Curves and Surfaces36 F Joining Curve Segments: In this figure we have two curves joined at P4 with G 1 continuity.In this figure we have two curves joined at P4 with G 1 continuity. –That is provided since P3, P4, and P5 are colinear. If P3-P4 == P4-P5 then we could have had C 1 continuity.If P3-P4 == P4-P5 then we could have had C 1 continuity.

37 Chapter 9 -- Representation of Curves and Surfaces37 F Importance of the convex hull: the curve -- Q(t) -- is just a weighted average of the four polynomials based upon the t valuethe curve -- Q(t) -- is just a weighted average of the four polynomials based upon the t value Thus Q(t) is a weighted average of the four control points (weights determined by the polynomials)Thus Q(t) is a weighted average of the four control points (weights determined by the polynomials) This means that each curve segment is contained in the convex hull of the control points.This means that each curve segment is contained in the convex hull of the control points. –This is useful in clipping, where you can clip the whole convex hull and then worry about the curve later.

38 Chapter 9 -- Representation of Curves and Surfaces38 2.4 Uniform Nonrational B- Splines u History: F The term spline goes back to the long flexible strips of metal used by draftsmen to lay out surfaces of airplanes, cars, and ships. F Weights were attached to the splines to pull it in various directions. F The metal splines, unless severely stressed, had second order continuity.

39 Chapter 9 -- Representation of Curves and Surfaces39 u The mathematical equivalent: F the natural cubic spline is a C0, C1, and C2 continuous cubic polynomial that passes through the control points. F These curves have one more degree of continuity than is inherent in the Hermite and Bezier forms, and are thus smoother than the previous forms. F The polynomial coefficients are, however, dependent upon all n control points moving one control point affects the entire curve.moving one control point affects the entire curve. The computation of these coefficients can interfere with rapid reshaping of the curve.The computation of these coefficients can interfere with rapid reshaping of the curve.

40 Chapter 9 -- Representation of Curves and Surfaces40 u So, we are going to look at B-splines F polynomial coefficients are dependant upon only a few control points. (this is called local-control) F B-splines have the same continuity as cubic splines, BUT do not interpolate (go through) their control points. u In our examples we will look at curves consisting of several segments

41 Chapter 9 -- Representation of Curves and Surfaces41 u Cubic B-splines F approximate a series of m+1 control points (P 0,..P m ) F the curve consists of m-1 cubic polynomial curve segments, joined at knots (and each end is a knot)

42 Chapter 9 -- Representation of Curves and Surfaces42 F Each curve segment is defined by 4 control points, and each control point influences four curve segments (except those control points at the ends)

43 Chapter 9 -- Representation of Curves and Surfaces43 F The term uniform means that the knots are spaced at equal intervals of the parameter t. F B stands for Basis, since the splines can be represented as weighted sums of polynomial basis functions. F This figure shows a B-spline blendign function. Note that at the end points three of the functions are non- zero, which is why they do not interpolate the control points.Note that at the end points three of the functions are non- zero, which is why they do not interpolate the control points.

44 Chapter 9 -- Representation of Curves and Surfaces44 2.5 Nonuniform Nonrational B- Splines

45 Chapter 9 -- Representation of Curves and Surfaces45 uauauaua

46 Chapter 9 -- Representation of Curves and Surfaces46 2.6 Nonuniform, Rational Cubic Polynomial Curve Segments

47 Chapter 9 -- Representation of Curves and Surfaces47 uauauaua

48 Chapter 9 -- Representation of Curves and Surfaces48 2.7 Fitting Curves to Digitized Points

49 Chapter 9 -- Representation of Curves and Surfaces49 uauauaua

50 Chapter 9 -- Representation of Curves and Surfaces50 2.8 Comparison of Cubic Curves

51 Chapter 9 -- Representation of Curves and Surfaces51 uauauaua

52 Chapter 9 -- Representation of Curves and Surfaces52 3. Parametric Bicubic Surfaces

53 Chapter 9 -- Representation of Curves and Surfaces53 uauauaua

54 Chapter 9 -- Representation of Curves and Surfaces54 3.1 Hermite Surfaces

55 Chapter 9 -- Representation of Curves and Surfaces55 uauauaua

56 Chapter 9 -- Representation of Curves and Surfaces56 3.2 Bezier Surfaces

57 Chapter 9 -- Representation of Curves and Surfaces57 uauauaua

58 Chapter 9 -- Representation of Curves and Surfaces58 3.3 B-Spline Surfaces

59 Chapter 9 -- Representation of Curves and Surfaces59 uauauaua

60 Chapter 9 -- Representation of Curves and Surfaces60 3.4 Normals to Surfaces

61 Chapter 9 -- Representation of Curves and Surfaces61 uauauaua

62 Chapter 9 -- Representation of Curves and Surfaces62 3.5 Displaying Bicubic Surfaces

63 Chapter 9 -- Representation of Curves and Surfaces63 uauauaua

64 Chapter 9 -- Representation of Curves and Surfaces64 4. Quadric Surfaces

65 Chapter 9 -- Representation of Curves and Surfaces65 uauauaua

66 Chapter 9 -- Representation of Curves and Surfaces66 5. Specialized Modeling Techniques

67 Chapter 9 -- Representation of Curves and Surfaces67 uauauaua

68 Chapter 9 -- Representation of Curves and Surfaces68 5.1 Fractal Models

69 Chapter 9 -- Representation of Curves and Surfaces69 uauauaua

70 Chapter 9 -- Representation of Curves and Surfaces70 5.2 Grammar-Based Models

71 Chapter 9 -- Representation of Curves and Surfaces71 uauauaua

72 Chapter 9 -- Representation of Curves and Surfaces72 Summary n This chapter has only touched on important ideas concerning curve and surface representation, n But it has given sufficient information so that you can implement interactive systems using these representations.


Download ppt "Representation of Curves and Surfaces Chapter 9. Chapter 9 -- Representation of Curves and Surfaces2 u The classic teapot shown here is perhaps one of."

Similar presentations


Ads by Google