Presentation is loading. Please wait.

Presentation is loading. Please wait.

2005-10-24 Chapter 4 Representations of Curves and Surfaces.

Similar presentations


Presentation on theme: "2005-10-24 Chapter 4 Representations of Curves and Surfaces."— Presentation transcript:

1 2005-10-24 Chapter 4 Representations of Curves and Surfaces

2 2005-10-24 4.1 Parametric Representation and Continuity Conditions of Curves and Surfaces 4.1.1 Parametric Representation of Curves and Surfaces a spline is a flexible strip used to produce a smooth curve through a designated set of points.

3 2005-10-24 spline curve : piecewise cubic polynomial function whose first and second derivatives are continuous across the various curve sections spline surface : can be described with two sets of orthogonal spline curves

4 2005-10-24 Applications of splines CG to design curve and surface shapes to digitize drawings for computer storage to specify animation paths for the objects or the camera in a scene CAD to design automobile bodies, aircraft and spacecraft surfaces, and ship hulls

5 2005-10-24 a spline description in 2D space x = x(u), y = y(u) u ∈ [0, 1] A point function on the spline in 2D space can be expressed as P(u) = [x(u), y(u)] a spline description in 3D space x = x(u), y = y(u), z = z(u) u ∈ [0, 1] A point function on the spline in 3D space can be expressed as P(u)= [x(u), y(u), z(u)]

6 2005-10-24 As for a surface, the parametric equation of the 2D surface is represented by the form x = x(u, w), y = y(u, w) u, w ∈ [0, 1] A point function on the surface can be expressed as P(u, w) = [x(u, w), y(u, w)] The parametric equation of the 3D surface is x = x(u, w), y = y(u, w), z = z(u, w) u, w ∈ [0, 1] A point function on the 3D surface is P(u, w) = [x(u, w), y(u, w), z(u, w)]

7 2005-10-24 4.1.2 Interpolation and Approximation Splines Interpolation curves are commonly used to digitize drawings or to specify animation paths. Approximation curves are primarily used as design tools to structure object surfaces

8 2005-10-24 Figure 4-1 A set of six control points interpolated with piecewise continuous polynomial sections. Figure 4-2 A set of six control points approximated with piecewise continuous polynomial sections.

9 2005-10-24 A spline curve and control points Relations ? The convex polygon boundary that encloses a set of control points is called the convex hull.

10 2005-10-24 4.1.3 Continuity Conditions To ensure a smooth transition from one section of a piecewise parametric curve to the next, we can impose various continuity conditions at the connection points. Parametric continuity conditions: If each section of a spline is described with a set of parametric coordinate functions of the form x = x(u), y = y(u), z = z(u), u1  u  u2

11 2005-10-24 Zero-order parametric continuity, described as C 0 continuity, means simply that the curves meet. [That is, the values of x, y, and z evaluated at u, for the first curve section are equal, respectively, to the values of x, y, and z evaluated at u, for the next curve section. ] First-order parametric continuity: C 1 Second-order parametric continuity: C 2 Higher-order parametric continuity: C n

12 2005-10-24 Figure 4-6 Piecewise construction of a curve by joining two curve segments using different orders of continuity: (a) zero-order continuity only, (b) first-order continuity, and (c) second-order continuity.

13 2005-10-24 Geometric Continuity Conditions Zero-order geometric continuity, described as G 0 continuity, is the same as zero-order parametric continuity. That is, the two curves sections must have the same coordinate position at the boundary point. First-order geometric continuity, or G1 continuity, means that the parametric first derivatives are proportional at the intersection of two successive sections. If we denote* the parametric position on the curve as P(u), the direction of the tangent vector P'(u), but not necessarily its magnitude, will be the same for two successive curve sections at their joining point under G1 continuity. Second-order geometric continuity, or G2 continuity, means that both the first and second parametric derivatives of the two curve sections are proportional at their boundary. Under G2 continuity, curvatures of two curve sections will match at the joining position.

14 2005-10-24 4.2 Hermite Curves 4.2.1 Spline Specifications There are three equivalent methods for specifying a particular spline representation: (1)We can state the set of boundary conditions that are imposed on the spline; (2) we can state the matrix that characterizes the spline; (3) we can state the set of blending functions (or basis functions) that determine how specified geometric constraints on the curve are combined to calculate positions along the curve path.

15 2005-10-24 Suppose we have the following parametric cubic polynomial representation for the x coordinate along the path of a spline section: x(u) = a x u 3 + b x u 2 + c x u + d x, 0  u  1 (4-10) From the boundary conditions, we can obtain the matrix that characterizes this spline curve by first rewriting Eq. 4-10 as the matrix product

16 2005-10-24 x(u)=[ u 3 u 2 u 1 ] =U ∙ C (4-11) U is the row matrix of powers of parameter u, and C is the coefficient* column matrix. Using Eq4-11 we can obtain Eq4-12. C=M spline ∙ M geom (4-12)

17 2005-10-24 Thus,we can substitute the matrix representation for C into Eq4-11 to obtain x(u)=U∙ M spline ∙ M geom (4-13) Finally, we can expand Eq. 4-13 to obtain a polynomial representation for coordinate x in terms of the geometric constraint parameters x(u)= (4-14)

18 2005-10-24 4.2.2 Cubic Spline Interpolation Methods Characteristics of cubic polynomials: Compared to higher-order polynomials, cubic splines require less calculations and memory and they are more stable. Compared to lower-order polynomials, cubic splines are more flexible for modeling arbitrary curve shapes.

19 2005-10-24 Given (n+1) control points:p 0, p 1, ……, p n p k =(x k,y k,z k ) k=0,1,2,……,n Figure 4-8 A piecewise continuous cubic-spline interpolation of n + 1 control points.

20 2005-10-24 Between each pair of control points,we have x(u)=a x∙ u 3 +b x ∙ u 2 +c x ∙ u+d x y(u)=a y ∙ u 3 +b y ∙ u 2 +c y ∙ u+d y ( 0<u<1)(4-15) z(u)=a z ∙ u 3 +b z ∙ u 2 +c z ∙ u+d z Or p(u)= a ∙ u 3 +b ∙ u 2 +c ∙ u+d Problem?? how to obtain the values of four coefficients a,b,c,and d?

21 2005-10-24 4.2.3 Hermite Interpolation A Hemite spline ( named after the French mathematician Charles Hermite ) is an interpolating piecewise cubic polynomial with a specified tangent at each control point.

22 2005-10-24 Figure 4-9 Parametric point function P(u) for a Hermite curve section between control point p k and p k+1.

23 2005-10-24 Given control point(p k,p k+1 ),and parametric derivatives D p k,D p k+1. we can have P(0) = p k P(1) = p k+1 P′(0) = D p k (4-16) P′(1) = D p k+1

24 2005-10-24 We can write the vector equivalent of Eqs. 4-15 for this Hermite-curve section as P(u) = au 3 + bu 2 +cu + d, 0  u  1 (4-17) where the x component of P is x(u) = a x u 3 + b x u 2 + c x u + d x, and similarly for the y and z components. The matrix equivalent of Eq. 4-17 is (4-18)

25 2005-10-24 And the derivative of the point function can be expressed as (4-19)

26 2005-10-24 Substituting endpoint values 0 and 1 for parameter u into the previous two equations, we can express the Hermite boundary conditions 4-16 in the matrix form: (4-20)

27 2005-10-24 Solving this equation for the polynomial coefficients, we have (4-21)

28 2005-10-24 Thus,we can write in terms of the boundary conditions as (4-22) Finally, we can obtain the polynomial form: P(u) = p k (2u 3 – 3u 2 + 1) + p k+1 (-2u 3 + 3u 2 ) + D p k (u3 – 2u 2 + u) + D p k+1 (u 3 – u 2 ) =p k H 0 (u) + p k+1 H 1 (u) + D p k H 2 (u) + D p k+1 H 3 (u) (4-23)

29 2005-10-24 The polynomials H k (u) for k = 0, 1, 2, 3 are referred to as blending functions. Figure 4-10 The Hermite blending functions.

30 2005-10-24 An example Given the coordinates of three points P 0 (4,4), p 1 (24,4), p 2 (36,3) respectively, and their slopes D 0 (8.832,5.547), D 1 (8.832,-5.547),D 2 (8.832,5.547),generate a cubic Hermit spline, compute the coordinates of points the spline when u=0, 0.25, 05, 0.75 and 1, and plot the curve.

31 2005-10-24 Sloution: A Hermite spline can be described as: P(u) =p k H 0 (u) + p k+1 H 1 (u) + D p k H 2 (u) + D p k+1 H 3 (u) Where H 0 (u)=2u 3 -3u 2 +1 H 1 (u)=-2u 3 +3u 2 H 2 (u)=u 3 -2u 2 +u H 3 (u)=u 3 -u 2 For the line p 0 p 1: p 0 =[4 4] D 0 =[8.832 5.547] p 1 =[24 4] D 1 =[8.832 -5.547] At u=0 and u=1,we have p(0)=p 0 =[4 4] p(1)=p 1 =[24 4]

32 2005-10-24 At u=0.5, we have H 0 (0.5)=2*0.5 3 -3*0.5 2 +1=0.5 H 1 (0.5)=-2*0.5 3 +3*0.5 2 =0.5 H 2 (0.5)=0.5 3 -2*0.5 2 +0.5=0.125 H 3 (0.5)=0.5 3 -0.5 2 =-0.125 Therefore, we obtain p(0.5)=0.5[4 4] + 0.5[24 4] + 0.125[8.832 5.547] - 0.125[8.832 -5.547] =[14 5.386]

33 2005-10-24 Similarly: At u=0.25, p(0.25)=[7.953 5.04] At u=0.75, p(0.75)=[20.04 5.04]

34 2005-10-24 Problem: How to input the value of slopes? So, we have a modified method.

35 2005-10-24 4.2.4 Cardinal Splines As with Hermite splines, cardinal splines are interpolating piecewise cubics with specified endpoint tangents at the boundary of each curve section. The difference is that we do not have to give the values for the endpoint tangents. For a cardinal spline, the value for the slope at a control point is calculated from the coordinates of the two adjacent control points.

36 2005-10-24 Figure 4-11 Parametric point function P(u) for a cardinal-spline section between control points p k and p k+1. Figure 4-12 Tangent vectors at the endpoints of a cardinal-spline section are proportional to the chords formed with neighboring control points (dashed lines).

37 2005-10-24 the four control points from pk-1, to pk+1, are used to set the boundary conditions for the cardinal spline section as P(0) = p k P(1) = p k+1 P′(0) =1/2(1 – t)(p k+1 – p k-1 ) (4-24) P′(1) = 1/2(1 – t)(p k+2 – p k ) Figure 4-13 Effect of the tension parameter on the shape of a cardinal spline section.

38 2005-10-24 Let s=1/2(1-t) where the cardinal matrix is

39 2005-10-24 Figure 4-14 The cardinal blending functions for t = 0 and s = 0.5

40 2005-10-24 Expanding matrix equation 4-25 into polynomial form, we have P(u) = p k-1 (– su 3 + 2su 2 – su) + p k [(2 – s)u 3 + (s –3)u 2 + 1]+ p k+1 [(s – 2)u 3 + (3 – 2s)u 2 + su)] + p k+2 (su 3 – su 2 ) = p k-1 CAR 0 (u) + p k CAR 1 (u) + p k+1 CAR 2 (u) +p k+2 CAR 3 (u) Pass through all control points.

41 2005-10-24 4.3 Bezier Curves and Surfaces Approximation method Design Renault automobile bodies Advantage: highly useful and convenient for curve and surface design easy to implement

42 2005-10-24 4.3.1 Bezier Curves Suppose we are given n + 1 control-point positions: p k = (x k, y k, z k ), k = 0,1,2,……,n. Bezier polynomial function : 0≤u ≤1

43 2005-10-24 Bernstein polynomials: the C(n, k) are the binomial coefficients: 3 points : a parabola 4 points : a cubic Bezier Curve

44 2005-10-24 Figure 4-15 Examples of two-dimensional Bezier curves generated from three, four, and five control points. Dashed lines connect the control-point positions.

45 2005-10-24 4.3.4 Cubic Bezier Curves 4 control points (p 0,p 1,p 2,p 3 ): 0≤u ≤1 Where

46 2005-10-24 Bezier blending function:

47 2005-10-24 At u=0, B 1,3 =B 2,3 =B 3,3 =0, B 0,3 =1 At u=1, B 0,3 =B 1,3 =B 2,3 =0, B 3,3 =1

48 2005-10-24 We know B 1,3 (u)=3u-6u 2 +3u 3 → B′ 1,3 (u)=3-12u+9u 2 Let B′ 1,3 (u)=0, so we have 3-12u+9u 2 =0 So, when u=1/3, B 1,3 (u) have the maximum. Similarly, when u=2/3, B 2,3 (u) have the maximum.

49 2005-10-24 Figure 4-19 The four Bezier blending functions for cubic curves (n = 3).

50 2005-10-24 The algorithm: Begin x=x 0,y=y 0 move to (x,y)// 移动到 (x 0,y 0) for u=0 to 1 step ∆u x=B 0,3 (u)*x 0 + B 1,3 (u)*x 1 + B 2,3 (u)*x 2 + B 3,3 (u)*x 3 y=B 0,3 (u)*y 0 + B 1,3 (u)*y 1 + B 2,3 (u)*y 2 + B 3,3 (u)*y 3 line to (x,y) end for end

51 2005-10-24 For an example: Construct a cubic Bezier Curve with four points p1(0,0,0), p2(1,1,1), p3(2,-1,-1), P4(3,0,0), and compute the values of coordinates at u=0, 1/3, 2/3, 1 Solution:

52 2005-10-24 Where At u=0, p(0)=p 1 =[0 0 0] At u=1, p(0)=p 4 =[3 0 0]

53 2005-10-24 At u=1/3 B 0,3 (1/3)=(1-1/3) 3 =8/27 B 1,3 (1/3)=3×1/3(1-1/3) 3 =4/9 B 2,3 (1/3)=3×(1/3) 2 (1-1/3)=2/9 B 3,3 (1/3)=1/27 Thus: P(1/3)=8/27[0 0 0]+2/9[1 1 1]+4/9[2 -1 -1]+1/27[3 0 0] =[1 2/9 2/9] At u=2/3 B 0,3 (2/3)=1/27,B 1,3 (2/3)=2/9,B 2,3 (2/3)=4/9,B 3,3 (2/3)=8/27 Thus: P(2/3)=1/27[0 0 0]+2/9[1 1 1]+4/9[2 -1 -1]+8/27[3 0 0] =[2 -2/9 -2/9]

54 2005-10-24 4.3.2 Properties of Bezier Curves (1) a Bezier curve is that it always passes through the first and last control points. (2) the slope at the beginning of the curve is along the line joining the first two control points, and the slope at the end of the curve is along the line joining the last two endpoints.

55 2005-10-24 B′ 0,3 (u)=-3+6u-3u 2 B′ 1,3 (u)=3-12u+9u 2 B′ 2,3 (u)=6u-9u 2 B′ 3,3 (u)=3u 2 At u=0, B′ 0,3 (0)=3,B′ 1,3 (0)=3, B′ 2,3 (0)=0,B′ 3,3 (0)=0 p′(0)=-3p 0 +3p 1 =3(p 1 -p 0 )

56 2005-10-24 At u=1, B′ 0,3 (1)=0, B′ 1,3 (1)=0, B′ 2,3 (1)=-3, B′ 3,3 (1)=3 p′(1)=-3p 2 +3p 3 =3(p 3 -p 2 ) (3) Similarly, the parametric second derivatives of a Bezier curve at the endpoints are determined by the three adjacent control point. (4) any Bezier curve is that it lies within the convex hull (convex polygon boundary) of the control points.

57 2005-10-24 Problem ? How to link smoothly 2 cubic Bezier curves?

58 2005-10-24 4.3.3 Smooth Transition of Cubic Bezier Curves Figure 4-18 Piecewise approximation curve formed with two Bezier sections. Zero- order and first-order continuity are attained between curve sections by setting p' 0 = p 2 and by making points p 1, p 2, and p' 1 collinear.

59 2005-10-24 Two curves: the first section : p 0, p 1, p 2, p 3 the second section : Q 0, Q 1, Q 2, Q 3 p 3 and Q 0 are the same points. (1) To obtain C' continuity between curve section. for the first section, at u=1 p'(1)=3(p 3 -p 2 ) for the first section, at u=0 p'(0)=3(Q 1 -Q 0 )

60 2005-10-24 Let p'(1) = p'(0) If C‘ continuity, then 3(p 3 -p 2 )=3(Q 1 -Q 0 ) Result: p 2, p 3, Q 0, Q 1 collinear. p 3, Q 0 middle point. (1) To obtain C ″ continuity between curve section. for the first section, at u=1 p ″ (1)=6(p 3 -2p 2 +p 1 ) for the first section, at u=0 p ″ (0)=6(Q 2 +Q 0 -2Q 1 )

61 2005-10-24 If C ″ continuity, then Q 2 -p 1 )=2(Q 1 -p 2 ) Result: Q 2 p 1 and Q 1 p 2 平行. Q 2 p 1 长度是 Q 1 p 2 长度的2倍.

62 2005-10-24 4.3.5 Bezier Surfaces Two sets of orthogonal* Bezier curves can be used to design an object surface by specifying an input mesh of control points. with p j,k specifying the location of the (m + 1) by (n + 1) control points.

63 2005-10-24 Figure 4-21 A composite Bezier surface constructed with two Bezier sections, joined at the indicated boundary line. The dashed lines connect specified control points. First-order continuity is established by making the ratio of length L1 to length L2 contrast for each collinear line of control points across the boundary between the surface sections.

64 2005-10-24 4.4 B-Spline Curves and Surfaces the most widely used class of approximating splines. two advantages : (1) the degree of a B-spline polynomial can be set independently of the number of control points (2) B-splines allow local control over the shape of a spline curve or surface The trade-off is that B-splines are more complex than Bezier splines

65 2005-10-24 Figure 4-22 A closed, periodic, piecewise, cubic B- spline constructed with cyclic specification of the six control points.

66 2005-10-24 4.4.1 B-Splines Curves Suppose we have n+1 points p k (x k,y k,z k ) k=0,1,2,……,n u ∈ [0,1] Where

67 2005-10-24 4.4.2 Cubic B-Splines n=3, we have 4 control points:p 0,p 1,p 2,p 3 when n=3,k=0

68 2005-10-24 when n=3,k=1 when n=3,k=2 when n=3,k=3

69 2005-10-24 So, we have where

70 2005-10-24 For an example Construct cubic B-Splines curves with 5 points p 0 (1,0), p 1 (0,2), p 2 (2,3), p 3 (5,2.5), p 4 (6,1) and compute the values of coordinates at u=0, 1/2, 1, draw the curve. solution:

71 2005-10-24

72 At u=0 F 0,3 (0)=1/6, F 1,3 (0)=4/6 F 2,3 (0)=1/6, F 3,3 (0)=1/6 At u=1 F 0,3 (1)=0, F 1,3 (1)=1/6 F 2,3 (1)=4/6, F 3,3 (1)=1/6 At u=0.5 F 0,3 (0.5)=0.021, F 1,3 (0.5)=0.479 F 2,3 (0.5)=0.479, F 3,3 (0.5)=0.021

73 2005-10-24 For p 0 p 1 p 2 p 3

74 2005-10-24 Similarly, for p 1 p 2 p 3 p 4 p(0)=[2.17 2.75] p(1)=[4.67 2.33] p(0)=[3.479 2.698] The drawing is omitted.

75 2005-10-24 The algorithm: Begin x=F 0,3 (0)*x 0 + F 1,3 (0)*x 1 + F 2,3 (0)*x 2 + F 3,3 (0)*x 3 y=F 0,3 (0)*y 0 + F 1,3 (0)*y 1 + F 2,3 (0)*y 2 + F 3,3 (0)*y 3 move to (x,y) for k=0 to n-3 for u=0 to 1 step ∆u x=F 0,3 (u)*x k + F 1,3 (u)*x k+1 + F 2,3 (u)*x k+2 + F 3,3 (u)*x k+3 y=F 0,3 (u)*y k + F 1,3 (u)*y k+1 + F 2,3 (u)*y k+2 + F 3,3 (u)*y k+3 line to (x,y) end for end

76 2005-10-24 4.4.3 Properties of B-Spline Curves (1)often, a B-Spline curve doesn’t pass through the start or end point. p(0)=1/6p 0 +4/6p 1 +1/6p 2 p(1)=1/6p 1 +4/6p 2 +1/6p 3 (2)Sections of B-Spline curve are smoothly and consecultively connected.

77 2005-10-24 4.4.4 B-Spline Surfaces B-spline surfaces exhibit the same properties as those of their component B-spline curves.

78 2005-10-24 Figure 4-23 A prototype helicopter, designed and modeled by Daniel Langlois of SOFTUIAGE, Inc., Montreal, using 180,000 B-spline surface patches. The scene was then rendered using ray tracing, bump mapping, and reflection mapping. (Coudesy silicon Graphics, Inc.)


Download ppt "2005-10-24 Chapter 4 Representations of Curves and Surfaces."

Similar presentations


Ads by Google