Presentation is loading. Please wait.

Presentation is loading. Please wait.

College of Computer and Information Science, Northeastern UniversityApril 12, 20151 CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2007 Lecture.

Similar presentations


Presentation on theme: "College of Computer and Information Science, Northeastern UniversityApril 12, 20151 CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2007 Lecture."— Presentation transcript:

1 College of Computer and Information Science, Northeastern UniversityApril 12, 20151 CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2007 Lecture 6 – February 26, 2007

2 College of Computer and Information Science, Northeastern UniversityApril 12, 20152 Today’s Topics Bezier Curves and Splines --------------------------- Parametric Bicubic Surfaces Quadrics

3 College of Computer and Information Science, Northeastern UniversityApril 12, 20153 Curves A curve is the continuous image of an interval in n-space. Implicit f(x, y) = 0 x 2 + y 2 – R 2 = 0 Parametric (x(t), y(t)) = P(t) P(t) = tA + (1-t)B A B Generative proc  (x, y)

4 College of Computer and Information Science, Northeastern UniversityApril 12, 20154 Curve Fitting We want a curve that passes through control points. How do we create a good curve? What makes a good curve?

5 College of Computer and Information Science, Northeastern UniversityApril 12, 20155 Axis Independence If we rotate the set of control points, we should get the rotated curve.

6 Local Control

7 College of Computer and Information Science, Northeastern UniversityApril 12, 20157 Variation Diminishing Never crosses a straight line more than the polygon crosses it.

8 College of Computer and Information Science, Northeastern UniversityApril 12, 20158 Continuity C 0 continuity C 1 continuity C 2 continuity G 2 continuity Not C 2 continuity

9 College of Computer and Information Science, Northeastern UniversityApril 12, 20159 How do we Fit Curves? Lagrange Interpolating Polynomial from mathworld The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through the n points, (x 1, y 1 ), (x 2, y 2 ), …, (x n, y n ), and is given by

10 College of Computer and Information Science, Northeastern UniversityApril 12, 201510 Example 1

11 College of Computer and Information Science, Northeastern UniversityApril 12, 201511 Polynomial Fit P(x) = -.5x(x-2)(x-3)(x-4)

12 College of Computer and Information Science, Northeastern UniversityApril 12, 201512 Piecewise Fit P a (x) = 4.1249 x (x - 1.7273) 0  x  1.5 P b (x) = 5.4 x (x - 1.7273) 1.5  x  2 P c (x) = 0 2  x  4

13 College of Computer and Information Science, Northeastern UniversityApril 12, 201513 Spline Curves

14 College of Computer and Information Science, Northeastern UniversityApril 12, 201514 Splines and Spline Ducks Marine Drafting Weights http://www.frets.com/FRETSPages/Luthier/TipsTricks/DraftingWeights/draftweights.html

15 College of Computer and Information Science, Northeastern UniversityApril 12, 201515 Drawing Spline Today (esc)

16 College of Computer and Information Science, Northeastern UniversityApril 12, 201516 Hermite Cubics p q Dp Dq P(t) = at 3 + bt 2 +ct +d P(0) = p P(1) = q P'(0) = Dp P'(1) = Dq

17 College of Computer and Information Science, Northeastern UniversityApril 12, 201517 Hermite Coefficients P(t) = at 3 + bt 2 +ct +d P(0) = p P(1) = q P'(0) = Dp P'(1) = Dq For each coordinate, we have 4 linear equations in 4 unknowns

18 College of Computer and Information Science, Northeastern UniversityApril 12, 201518 Boundary Constraint Matrix

19 College of Computer and Information Science, Northeastern UniversityApril 12, 201519 Hermite Matrix MHMH GHGH

20 College of Computer and Information Science, Northeastern UniversityApril 12, 201520 Hermite Blending Functions

21 College of Computer and Information Science, Northeastern UniversityApril 12, 201521 Splines of Hermite Cubics a C 1 spline of Hermite curves a G 1 but not C 1 spline of Hermite curves The vectors shown are 1/3 the length of the tangent vectors.

22 College of Computer and Information Science, Northeastern UniversityApril 12, 201522 Computing the Tangent Vectors Catmull-Rom Spline p1 p1 p2 p2 p3 p3 p4 p4 p 5 P(0) = p 3 P(1) = p 4 P'(0) = ½ (p 4 - p 2 ) P'(1) = ½ (p 5 - p 3 )

23 College of Computer and Information Science, Northeastern UniversityApril 12, 201523 Cardinal Spline The Catmull-Rom spline P(0) = p 3 P(1) = p 4 P'(0) = ½ (p 4 - p 2 ) P'(1) = ½ (p 5 - p 3 ) is a special case of the Cardinal spline P(0) = p 3 P(1) = p 4 P'(0) = (1 - t)(p 4 - p 2 ) P'(1) = (1 - t)(p 5 - p 3 ) 0 ≤ t ≤ 1 is the tension.

24 College of Computer and Information Science, Northeastern UniversityApril 12, 201524 Drawing Hermite Cubics How many points should we draw? Will the points be evenly distributed if we use a constant increment on t ? We actually draw Bezier cubics.

25 College of Computer and Information Science, Northeastern UniversityApril 12, 201525 General Bezier Curves

26 College of Computer and Information Science, Northeastern UniversityApril 12, 201526 Low Order Bezier Curves p0p0 n = 0 b 0,0 (t) = 1 B(t) = p 0 b 0,0 (t) = p 0 0 ≤ t ≤ 1 p0p0 n = 1 b 0,1 (t) = 1 - t b 1,1 (t) = t B(t) = (1 - t) p 0 + t p 1 0 ≤ t ≤ 1 p1p1 p0p0 n = 2b 0,2 (t) = (1 - t) 2 b 1,2 (t) = 2t (1 - t) b 2,2 (t) = t 2 B(t) = (1 - t) 2 p 0 + 2t (1 - t)p 1 + t 2 p 2 0 ≤ t ≤ 1 p1p1 p2p2

27 College of Computer and Information Science, Northeastern UniversityApril 12, 201527 Bezier Curves Bezier Arch p q r s n = 3b 0,3 (t) = (1 - t) 3 b 1,3 (t) = 3t (1 - t) 2 b 2,3 (t) = 3t 2 (1 - t) b 2,3 (t) = t 3 B(t) = (1 - t) 3 p + 3t (1 - t) 2 q + 3t 2 (1 - t)r + t 3 s 0 ≤ t ≤ 1

28 College of Computer and Information Science, Northeastern UniversityApril 12, 201528 Bezier Matrix MBMB B(t) = (1 - t) 3 p + 3t (1 - t) 2 q + 3t 2 (1 - t)r + t 3 s 0 ≤ t ≤ 1 B(t) = a t 3 + bt 2 + ct + d 0 ≤ t ≤ 1 GBGB

29 College of Computer and Information Science, Northeastern UniversityApril 12, 201529 Geometry Vector

30 College of Computer and Information Science, Northeastern UniversityApril 12, 201530 Properties of Bezier Curves

31 College of Computer and Information Science, Northeastern UniversityApril 12, 201531 Geometry of Bezier Arches p q r s Pick a t between 0 and 1 and go t of the way along each edge. B(t)B(t) Join the endpoints and do it again.

32 College of Computer and Information Science, Northeastern UniversityApril 12, 201532 Geometry of Bezier Arches p q r s We only use t = 1/2. pqrs = B(1/2) pq qr rs pqr qrs

33 drawArch(P, Q, R, S){ if (ArchSize(P, Q, R, S) <=.5 ) Dot(P); else{ PQ = (P + Q)/2; QR = (Q + R)/2; RS = (R + S)/2; PQR = (PQ + QR)/2; QRS = (QR + RS)/2; PQRS = (PQR + QRS)/2 drawArch(P, PQ, PQR, PQRS); drawArch(PQRS, QRS, RS, S); }

34 College of Computer and Information Science, Northeastern UniversityApril 12, 201534 Putting it All Together Bezier Archer and Catmull-Rom Splines

35 College of Computer and Information Science, Northeastern UniversityApril 12, 201535 Time for a Break

36 College of Computer and Information Science, Northeastern UniversityApril 12, 201536 Surface Patch P(u,v) 0  u, v  1 A patch is the continuous image of a square in n-space.

37 College of Computer and Information Science, Northeastern UniversityApril 12, 201537 Bezier Patch Geometry

38 College of Computer and Information Science, Northeastern UniversityApril 12, 201538 Bezier Patch P 00 P 10 P 01 P 02 P 03 P 11 P 12 P 13 P 20 P 30 P 21 P 22 P 23 P 31 P 32 P 33

39 College of Computer and Information Science, Northeastern UniversityApril 12, 201539 Bezier Patch Computation

40 College of Computer and Information Science, Northeastern UniversityApril 12, 201540 Bezier Patch P 00 P 10 P 01 P 02 P 03 P 11 P 12 P 13 P 20 P 30 P 21 P 22 P 23 P 31 P 32 P 33 Q(0,v) Q(1,v) Q(u,0) Q(u,1)

41 College of Computer and Information Science, Northeastern UniversityApril 12, 201541 Bezier Patch P 00 P 10 P 01 P 02 P 03 P 11 P 12 P 13 P 20 P 30 P 21 P 22 P 23 P 31 P 32 P 33 Q u (0,0) = 3(P 10 – P 00 ) Q v (0,0) = 3(P 01 – P 00 ) Q uv (0,0) = 9(P 00 – P 01 – P 10 + P 11 )

42 College of Computer and Information Science, Northeastern UniversityApril 12, 201542 Properties of Bezier Surfaces A Bézier patch transforms in the same way as its control points under all affine transformations All u = constant and v = constant lines in the patch are Bézier curves. A Bézier patch lies completely within the convex hull of its control points. The corner points in the patch are the four corner control points. A Bézier surface does not in general pass through its other control points.

43 College of Computer and Information Science, Northeastern UniversityApril 12, 201543 Rendering Bezier Patches with a mesh Chris Bently - Rendering Bezier Patches 3. Use these derived points as the control points for new Bezier curves running in the v direction 1. Consider each row of control points as defining 4 separate Bezier curves: Q 0 (u) … Q 3 (u) 2. For some value of u, say 0.1, for each Bezier curve, calculate Q 0 (u) … Q 3 (u). 4. Generate edges and polygons from grid of surface points.

44 College of Computer and Information Science, Northeastern UniversityApril 12, 201544 Subdividing Bezier Patch P 00 P 10 P 01 P 02 P 03 P 11 P 12 P 13 P 20 P 30 P 21 P 22 P 23 P 31 P 32 P 33 Subdivide until the control points are coplanar.

45 College of Computer and Information Science, Northeastern UniversityApril 12, 201545 Blending Bezier Patches

46 Teapot Data double teapot_data[][] = { { -80.00, 0.00, 30.00, -80.00, -44.80, 30.00, -44.80, -80.00, 30.00, 0.00, -80.00, 30.00, -80.00, 0.00, 12.00, -80.00, -44.80, 12.00, -44.80, -80.00, 12.00, 0.00, -80.00, 12.00, -60.00, 0.00, 3.00, -60.00, -33.60, 3.00, -33.60, -60.00, 3.00, 0.00, -60.00, 3.00, -60.00, 0.00, 0.00, -60.00, -33.60, 0.00, -33.60, -60.00, 0.00, 0.00, -60.00, 0.00, }, …

47 College of Computer and Information Science, Northeastern UniversityApril 12, 201547 Bezier Patch Continuity If these sets of control points are colinear, the surface will have G 1 continuity.

48 College of Computer and Information Science, Northeastern UniversityApril 12, 201548 Quadric Surfaces ellipsoidelliptic cylinder

49 College of Computer and Information Science, Northeastern UniversityApril 12, 201549 Quadric Surfaces 1-sheet hyperboloid 2-sheet hyperboloid

50 College of Computer and Information Science, Northeastern UniversityApril 12, 201550 Quadric Surfaces cones

51 College of Computer and Information Science, Northeastern UniversityApril 12, 201551 elliptic parabaloid hyperbolic parabaloid

52 College of Computer and Information Science, Northeastern UniversityApril 12, 201552 Quadric Surfaces hyperbolic cylinder parabolic cylinder

53 College of Computer and Information Science, Northeastern UniversityApril 12, 201553 General Quadrics in General Position

54 College of Computer and Information Science, Northeastern UniversityApril 12, 201554 General Quadric Equation Ray Equations

55 College of Computer and Information Science, Northeastern UniversityApril 12, 201555 Ray Quadric Intersection Quadratic Coefficients A = a*xd*xd + b*yd*yd + c*zd*zd + 2[d*xd*yd + e*yd*zd + f*xd*zd B = 2*[a*x0*xd + b*y0*yd + c*z0*zd + d*(x0*yd + xd*y0 ) + e*(y0*zd + yd*z0 ) + f*(x0*zd + xd*z0 ) + g*xd + h*yd + j*zd] C = a*x0*x0 + b*y0*y0 + c*z0*z0 + 2*[d*x0*y0 + e*y0*z0 + f*x0*z0 + g*x0 + h*y0 + j*z0] + k

56 College of Computer and Information Science, Northeastern UniversityApril 12, 201556 Quadric Normals Normalize N and change its sign if necessary.

57 College of Computer and Information Science, Northeastern UniversityApril 12, 201557 MyCylinders

58 College of Computer and Information Science, Northeastern UniversityApril 12, 201558 Student Images

59 College of Computer and Information Science, Northeastern UniversityApril 12, 201559 Student Images


Download ppt "College of Computer and Information Science, Northeastern UniversityApril 12, 20151 CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2007 Lecture."

Similar presentations


Ads by Google