Download presentation
Presentation is loading. Please wait.
Published byLucy Oliver Modified over 9 years ago
1
Curves and Surfaces Chapter 10
2
CS 480/680 2Chapter 9 -- Hierarchical Models Introduction: Introduction: Until now we have worked with flat entities such as lines and flat polygons Until now we have worked with flat entities such as lines and flat polygons Fit well with graphics hardware Fit well with graphics hardware Mathematically simple Mathematically simple But the world is not composed of flat entities But the world is not composed of flat entities Need curves and curved surfaces Need curves and curved surfaces May only have need at the application level May only have need at the application level Implementation can render them approximately with flat primitives Implementation can render them approximately with flat primitives
3
CS 480/680 3Chapter 9 -- Hierarchical Models Modeling with Curves Modeling with Curves data points approximating curve interpolating data point
4
CS 480/680 4Chapter 9 -- Hierarchical Models What Makes a Good Representation? What Makes a Good Representation? There are many ways to represent curves and surfaces There are many ways to represent curves and surfaces Want a representation that is Want a representation that is Stable Stable Smooth Smooth Easy to evaluate Easy to evaluate Must we interpolate or can we just come close to data? Must we interpolate or can we just come close to data? Do we need derivatives? Do we need derivatives?
5
CS 480/680 5Chapter 9 -- Hierarchical Models 1. Representation of Curves and Surfaces Before proceeding to our development of parametric polynomial curves and surfaces, we pause to summarize our knowledge of the three major types of object representation, Before proceeding to our development of parametric polynomial curves and surfaces, we pause to summarize our knowledge of the three major types of object representation, And to observe the advantages and disadvantages of each form. And to observe the advantages and disadvantages of each form.
6
CS 480/680 6Chapter 9 -- Hierarchical Models 1.1 Explicit Representations 1.1 Explicit Representations Most familiar form of curve in 2D Most familiar form of curve in 2D y=f(x) y=f(x) Cannot represent all curves Cannot represent all curves Vertical lines Vertical lines Circles Circles Extension to 3D Extension to 3D y=f(x), z=g(x) y=f(x), z=g(x) The form z = f(x,y) defines a surface The form z = f(x,y) defines a surface x y x y z
7
CS 480/680 7Chapter 9 -- Hierarchical Models 1.2 Implicit Representations 1.2 Implicit Representations Two dimensional curve(s) Two dimensional curve(s) g(x,y)=0 g(x,y)=0 Much more robust Much more robust All lines ax+by+c=0 All lines ax+by+c=0 Circles x 2 +y 2 -r 2 =0 Circles x 2 +y 2 -r 2 =0 Three dimensions g(x,y,z)=0 defines a surface Three dimensions g(x,y,z)=0 defines a surface Intersect two surface to get a curve Intersect two surface to get a curve In general, we cannot solve for points that satisfy In general, we cannot solve for points that satisfy
8
CS 480/680 8Chapter 9 -- Hierarchical Models Algebraic Surface Algebraic Surface Quadric surface 2 i+j+k At most 10 terms Can solve intersection with a ray by reducing problem to solving quadratic equation
9
CS 480/680 9Chapter 9 -- Hierarchical Models 1.3 Parametric Form 1.3 Parametric Form Separate equation for each spatial variable Separate equation for each spatial variable x=x(u) x=x(u) y=y(u) y=y(u) z=z(u) z=z(u) For u max u u min we trace out a curve in two or three dimensions For u max u u min we trace out a curve in two or three dimensions p(u) p(u min ) p(u max )
10
CS 480/680 10Chapter 9 -- Hierarchical Models Selecting Functions Selecting Functions Usually we can select “good” functions Usually we can select “good” functions not unique for a given spatial curve not unique for a given spatial curve Approximate or interpolate known data Approximate or interpolate known data Want functions which are easy to evaluate Want functions which are easy to evaluate Want functions which are easy to differentiate Want functions which are easy to differentiate Computation of normals Computation of normals Connecting pieces (segments) Connecting pieces (segments) Want functions which are smooth Want functions which are smooth
11
CS 480/680 11Chapter 9 -- Hierarchical Models Parametric Lines Parametric Lines Line connecting two points p 0 and p 1 p(u)=(1-u)p 0 +up 1 We can normalize u to be over the interval (0,1) p(0) = p 0 p(1)= p 1 Ray from p 0 in the direction d p(u)=p 0 +ud p(0) = p 0 p(1)= p 0 +d d
12
CS 480/680 12Chapter 9 -- Hierarchical Models Parametric Polynomial Surfaces Parametric Polynomial Surfaces Surfaces require 2 parameters Surfaces require 2 parameters x=x(u,v) x=x(u,v) y=y(u,v) y=y(u,v) z=z(u,v) z=z(u,v) p(u,v) = [x(u,v), y(u,v), z(u,v)] T p(u,v) = [x(u,v), y(u,v), z(u,v)] T Want same properties as curves: Want same properties as curves: Smoothness Smoothness Differentiability Differentiability Ease of evaluation Ease of evaluation x y z p(u,0) p(1,v) p(0,v) p(u,1)
13
CS 480/680 13Chapter 9 -- Hierarchical Models Normals Normals We can differentiate with respect to u and v to obtain the normal at any point p
14
CS 480/680 14Chapter 9 -- Hierarchical Models Parametric Planes Parametric Planes point-vector form p(u,v)=p 0 +uq+vr n = q x r q r p0p0 n three-point form p0p0 n p1p1 p2p2 q = p 1 – p 0 r = p 2 – p 0
15
CS 480/680 15Chapter 9 -- Hierarchical Models Parametric Sphere Parametric Sphere x(u,v) = r cos sin y(u,v) = r sin sin z(u,v) = r cos 360 0 180 0 constant: circles of constant longitude constant: circles of constant latitude differentiate to show n = p
16
CS 480/680 16Chapter 9 -- Hierarchical Models Curve Segments Curve Segments After normalizing u, each curve is written After normalizing u, each curve is written p(u)=[x(u), y(u), z(u)] T, 1 u 0 p(u)=[x(u), y(u), z(u)] T, 1 u 0 In classical numerical methods, we design a single global curve In classical numerical methods, we design a single global curve In computer graphics and CAD, it is better to design small connected curve segments In computer graphics and CAD, it is better to design small connected curve segments p(u) q(u) p(0) q(1) join point p(1) = q(0)
17
CS 480/680 17Chapter 9 -- Hierarchical Models 1.4 Parametric Polynomial Curves 1.4 Parametric Polynomial Curves If N=M=K, we need to determine 3(N+1) coefficients Equivalently we need 3(N+1) independent conditions Noting that the curves for x, y and z are independent, we can define each independently in an identical manner We will use the form where p can be any of x, y, z
18
CS 480/680 18Chapter 9 -- Hierarchical Models Why Polynomials Why Polynomials Easy to evaluate Easy to evaluate Continuous and differentiable everywhere Continuous and differentiable everywhere Must worry about continuity at join points including continuity of derivatives Must worry about continuity at join points including continuity of derivatives p(u) q(u) join point p(1) = q(0) but p’(1) q’(0)
19
CS 480/680 19Chapter 9 -- Hierarchical Models Cubic Parametric Polynomials Cubic Parametric Polynomials N=M=L=3, gives balance between ease of evaluation and flexibility in design N=M=L=3, gives balance between ease of evaluation and flexibility in design Four coefficients to determine for each of x, y and z Four coefficients to determine for each of x, y and z Seek four independent conditions for various values of u resulting in 4 equations in 4 unknowns for each of x, y and z Seek four independent conditions for various values of u resulting in 4 equations in 4 unknowns for each of x, y and z Conditions are a mixture of continuity requirements at the join points and conditions for fitting the data Conditions are a mixture of continuity requirements at the join points and conditions for fitting the data
20
CS 480/680 20Chapter 9 -- Hierarchical Models Cubic Polynomial Surfaces Cubic Polynomial Surfaces p(u,v)=[x(u,v), y(u,v), z(u,v)] T where p is any of x, y or z Need 48 coefficients ( 3 independent sets of 16) to determine a surface patch
21
CS 480/680 21Chapter 9 -- Hierarchical Models 3. Parametric and Cubic Polynomial Curves Matrix-Vector Form Matrix-Vector Form define then
22
CS 480/680 22Chapter 9 -- Hierarchical Models Cubic Polynomial Surfaces Cubic Polynomial Surfaces p(u,v)=[x(u,v), y(u,v), z(u,v)] T where p is any of x, y or z Need 48 coefficients ( 3 independent sets of 16) to determine a surface patch
23
CS 480/680 23Chapter 9 -- Hierarchical Models Matrix-Vector Form Matrix-Vector Form define then
24
CS 480/680 24Chapter 9 -- Hierarchical Models 4. Interpolation Given four data (control) points p0, p1,p2, p3 determine cubic p(u) which passes through them Must find c0,c1,c2, c3 p0p0 p1p1 p2p2 p3p3
25
CS 480/680 25Chapter 9 -- Hierarchical Models Interpolation Equations Interpolation Equations apply the interpolating conditions at u=0, 1/3, 2/3, 1 p 0 =p(0)=c 0 p 1 =p(1/3)=c 0 +(1/3)c 1 +(1/3) 2 c 2 +(1/3) 3 c 2 p 2 =p(2/3)=c 0 +(2/3)c 1 +(2/3) 2 c 2 +(2/3) 3 c 2 p 3 =p(1)=c 0 +c 1 +c 2 +c 2 or in matrix form with p = [p 0 p 1 p 2 p 3 ] T p=Ac
26
CS 480/680 26Chapter 9 -- Hierarchical Models Interpolation Matrix Interpolation Matrix Solving for c we find the interpolation matrix c=MIpc=MIp Note that M I does not depend on input data and can be used for each segment in x, y, and z
27
CS 480/680 27Chapter 9 -- Hierarchical Models Interpolating Multiple Segments Interpolating Multiple Segments use p = [p 0 p 1 p 2 p 3 ] T use p = [p 3 p 4 p 5 p 6 ] T Get continuity at join points but not continuity of derivatives
28
CS 480/680 28Chapter 9 -- Hierarchical Models 4.1 Blending Functions 4.1 Blending Functions Rewriting the equation for p(u) p(u)=uTc=uTMIp = b(u)Tp where b(u) = [b0(u) b1(u) b2(u) b3(u)]T is an array of blending polynomials such that p(u) = b0(u)p0+ b1(u)p1+ b2(u)p2+ b3(u)p3 b0(u) = -4.5(u-1/3)(u-2/3)(u-1) b1(u) = 13.5u (u-2/3)(u-1) b2(u) = -13.5u (u-1/3)(u-1) b3(u) = 4.5u (u-1/3)(u-2/3)
29
CS 480/680 29Chapter 9 -- Hierarchical Models Blending Functions Blending Functions These functions are not smooth These functions are not smooth Hence the interpolation polynomial is not smooth Hence the interpolation polynomial is not smooth
30
CS 480/680 30Chapter 9 -- Hierarchical Models 4.2 The Cubic Interpolating Patch 4.2 The Cubic Interpolating Patch Need 16 conditions to determine the 16 coefficients cij Choose at u,v = 0, 1/3, 2/3, 1
31
CS 480/680 31Chapter 9 -- Hierarchical Models Matrix Form Matrix Form Define v = [1 v v 2 v 3 ] T C = [c ij ] P = [p ij ] p(u,v) = u T Cv If we observe that for constant u (v), we obtain interpolating curve in v (u), we can show p(u,v) = u T M I PM I T v C=M I PM I
32
CS 480/680 32Chapter 9 -- Hierarchical Models Blending Patches Blending Patches Each b i (u)b j (v) is a blending patch Shows that we can build and analyze surfaces from our knowledge of curves
33
CS 480/680 33Chapter 9 -- Hierarchical Models 5. Hermite Curves and Surfaces Other Types of Curves and Surfaces Other Types of Curves and Surfaces How can we get around the limitations of the interpolating form How can we get around the limitations of the interpolating form Lack of smoothness Lack of smoothness Discontinuous derivatives at join points Discontinuous derivatives at join points We have four conditions (for cubics) that we can apply to each segment We have four conditions (for cubics) that we can apply to each segment Use them other than for interpolation Use them other than for interpolation Need only come close to the data Need only come close to the data
34
CS 480/680 34Chapter 9 -- Hierarchical Models 5.1 The Hermite Form 5.1 The Hermite Form p(0)p(1) p’(0) p’(1) Use two interpolating conditions and two derivative conditions per segment Ensures continuity and first derivative continuity between segments
35
CS 480/680 35Chapter 9 -- Hierarchical Models Equations Equations Interpolating conditions are the same at ends p(0) = p0 = c0 p(1) = p3 = c0+c1+c2+c3 Differentiating we find p’(u) = c1+2uc2+3u2c3 Evaluating at end points p’(0) = p’0 = c1 p’(1) = p’3 = c1+2c2+3c3
36
CS 480/680 36Chapter 9 -- Hierarchical Models Matrix Form Matrix Form Solving, we find c=MHq where MH is the Hermite matrix
37
CS 480/680 37Chapter 9 -- Hierarchical Models Blending Polynomials Blending Polynomials p(u) = b(u)Tq Although these functions are smooth, the Hermite form is not used directly in Computer Graphics and CAD because we usually have control points but not derivatives However, the Hermite form is the basis of the Bezier form
38
CS 480/680 38Chapter 9 -- Hierarchical Models 5.2 Geometric and Parametric Continuity 5.2 Geometric and Parametric Continuity We can require the derivatives of x, y,and z to each be continuous at join points (parametric continuity) We can require the derivatives of x, y,and z to each be continuous at join points (parametric continuity) Alternately, we can only require that the tangents of the resulting curve be continuous (geometry continuity) Alternately, we can only require that the tangents of the resulting curve be continuous (geometry continuity) The latter gives more flexibility as we have need satisfy only two conditions rather than three at each join point The latter gives more flexibility as we have need satisfy only two conditions rather than three at each join point
39
CS 480/680 39Chapter 9 -- Hierarchical Models Example Example Here the p and q have the same tangents at the ends of the segment but different derivatives Here the p and q have the same tangents at the ends of the segment but different derivatives Generate different Hermite curves Generate different Hermite curves This techniques is used in drawing applications This techniques is used in drawing applications
40
CS 480/680 40Chapter 9 -- Hierarchical Models Higher Dimensional Approximations Higher Dimensional Approximations The techniques for both interpolating and Hermite curves can be used with higher dimensional parametric polynomials The techniques for both interpolating and Hermite curves can be used with higher dimensional parametric polynomials For interpolating form, the resulting matrix becomes increasingly more ill-conditioned and the resulting curves less smooth and more prone to numerical errors For interpolating form, the resulting matrix becomes increasingly more ill-conditioned and the resulting curves less smooth and more prone to numerical errors In both cases, there is more work in rendering the resulting polynomial curves and surfaces In both cases, there is more work in rendering the resulting polynomial curves and surfaces
41
CS 480/680 41Chapter 9 -- Hierarchical Models 6. Bezier Curves and Surfaces Bezier’s Idea Bezier’s Idea In graphics and CAD, we do not usually have derivative data In graphics and CAD, we do not usually have derivative data Bezier suggested using the same 4 data points as with the cubic interpolating curve to approximate the derivatives in the Hermite form Bezier suggested using the same 4 data points as with the cubic interpolating curve to approximate the derivatives in the Hermite form
42
CS 480/680 42Chapter 9 -- Hierarchical Models 6.1 Bezier Curves 6.1 Bezier Curves Approximating Derivatives Approximating Derivatives p0p0 p1p1 p2p2 p3p3 p 1 located at u=1/3 p 2 located at u=2/3 slope p’(0) slope p’(1) u
43
CS 480/680 43Chapter 9 -- Hierarchical Models
44
CS 480/680 44Chapter 9 -- Hierarchical Models 6.2 Bezier Surface Patches 6.2 Bezier Surface Patches
45
CS 480/680 45Chapter 9 -- Hierarchical Models 7. Cubic B-Splines
46
CS 480/680 46Chapter 9 -- Hierarchical Models 7.1 The Cubic B-Spline Curve 7.1 The Cubic B-Spline Curve
47
CS 480/680 47Chapter 9 -- Hierarchical Models 7.2 B-Splines and Bases 7.2 B-Splines and Bases
48
CS 480/680 48Chapter 9 -- Hierarchical Models 7.3 Spline Surfaces 7.3 Spline Surfaces
49
CS 480/680 49Chapter 9 -- Hierarchical Models 8. General B-Splines
50
CS 480/680 50Chapter 9 -- Hierarchical Models 8.1 Recursively Defined B-Splines 8.1 Recursively Defined B-Splines
51
CS 480/680 51Chapter 9 -- Hierarchical Models 8.2 Uniform Splines 8.2 Uniform Splines
52
CS 480/680 52Chapter 9 -- Hierarchical Models 8.3 Nonuniform B-Splines 8.3 Nonuniform B-Splines
53
CS 480/680 53Chapter 9 -- Hierarchical Models 8.4 NURBS 8.4 NURBS
54
CS 480/680 54Chapter 9 -- Hierarchical Models 9. Rendering of Curves and Surfaces
55
CS 480/680 55Chapter 9 -- Hierarchical Models 9.1 Polynomial Evaluation Methods 9.1 Polynomial Evaluation Methods
56
CS 480/680 56Chapter 9 -- Hierarchical Models 9.2 Recursive Subdivision of Bezier Polynomials 9.2 Recursive Subdivision of Bezier Polynomials
57
CS 480/680 57Chapter 9 -- Hierarchical Models 9.3 Rendering of Other Polynomial Curves by Subdivision 9.3 Rendering of Other Polynomial Curves by Subdivision
58
CS 480/680 58Chapter 9 -- Hierarchical Models 9.4 Subdivision of Bezier Surfaces 9.4 Subdivision of Bezier Surfaces
59
CS 480/680 59Chapter 9 -- Hierarchical Models 10. The Utah Teapot
60
CS 480/680 60Chapter 9 -- Hierarchical Models 11. Algebraic Surfaces
61
CS 480/680 61Chapter 9 -- Hierarchical Models 11.1 Quadrics 11.1 Quadrics
62
CS 480/680 62Chapter 9 -- Hierarchical Models 11.2 Rendering of Surfaces by Ray Casting 11.2 Rendering of Surfaces by Ray Casting
63
CS 480/680 63Chapter 9 -- Hierarchical Models 11.3 Subdivision Curves and Surfaces 11.3 Subdivision Curves and Surfaces
64
CS 480/680 64Chapter 9 -- Hierarchical Models 12. Curves and Surfaces in OpenGL
65
CS 480/680 65Chapter 9 -- Hierarchical Models 12.1 Bezier Curves 12.1 Bezier Curves
66
CS 480/680 66Chapter 9 -- Hierarchical Models 12.2 Bezier Surfaces 12.2 Bezier Surfaces
67
CS 480/680 67Chapter 9 -- Hierarchical Models 12.3 Displaying the Teapot 12.3 Displaying the Teapot
68
CS 480/680 68Chapter 9 -- Hierarchical Models 12.4 NURBS Functions 12.4 NURBS Functions
69
CS 480/680 69Chapter 9 -- Hierarchical Models 12.5 Quadrics 12.5 Quadrics
70
CS 480/680 70Chapter 9 -- Hierarchical Models
71
CS 480/680 71Chapter 9 -- Hierarchical Models
72
CS 480/680 72Chapter 9 -- Hierarchical Models 13. Summary and Notes
73
CS 480/680 73Chapter 9 -- Hierarchical Models 14. Suggested Readings
74
CS 480/680 74Chapter 9 -- Hierarchical Models Exercises -- Due next class
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.