Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Graphics Lecture 36 CURVES II Taqdees A. Siddiqi

Similar presentations


Presentation on theme: "Computer Graphics Lecture 36 CURVES II Taqdees A. Siddiqi"— Presentation transcript:

1 Computer Graphics Lecture 36 CURVES II Taqdees A. Siddiqi cs602@vu.edu.pk

2 CURVES II Taqdees A. Siddiqi cs602@vu.edu.pk

3 RECAP of last lecture: Parametric Equations of a Curve

4 A parametric curve is one whose defining equations are given in terms of a single, common, independent variable called the parametric variable.

5

6 for example, x(u) = au2 + bu + c, and similarly for y(u) and z(u). It is important to understand that each of these is an independent expression

7 Each point on a curve is defined by a vector p (figure 1).
The components of this vector are x(u), y(u), and z(u). we express this as

8 which says that the vector p is a function of the parametric variable u.

9 There is a lot of information in equation 2
There is a lot of information in equation 2. when we expand it into component form, it becomes

10 define each component by a single, common parametric variable, and
make sure that each point on the curve corresponds to a unique value of the parametric variable.

11 Plane Curves

12 To define plane curves, we use parametric functions that are second-degree polynomials:

13

14 where the a, b, and c terms are constant coefficients.
We can combine x(u), y(u), z(u), and their respective coefficients into an equivalent, more concise, vector equation:

15

16 We allow the parametric variable to take on values only in the interval

17 To one of the end points we assign u = 0, and to the other u = 1
To one of the end points we assign u = 0, and to the other u = 1. To the intermediate point, we arbitrarily assign u = 0.5. We can write these points as

18 P0 = [x0 y z0] P0.5 = [x0.5 y z0.5] …(6) P1 = [x1 y z1]

19 x0 = cx x0.5 = 0.25ax + 0.5bx + cx …(7) x1 = ax + bx + cx with similar equations for y, and z.

20 Figure 2: A plane curve defined by three points

21 Next we solve these three equations in three unknowns for ax, bx, and cx, finding
ax = 2x0 - 4x x1 bx = -3x0 + 4x x1 …(8) cx = x0

22 Substituting this result in to equation 4 yields
x(u) = (2x0 - 4x x1 ) u2 + (-3x0 + 4x x1) u + x …(9)

23 Again, there are equivalent expressions for y(u) and z(u).
We rewrite equation 9 as follows:

24 x(u) = (2u2 – 3u + 1) x0 + (-4u2 + 4u)x0.5 + (2u2 – u) x1 …(10)

25 P(u) = (2u2 – 3u + 1) P0 + (-4u2 + 4u)P0.5 + (2u2 – u) P1 …(11)

26 Equation 5 is the algebraic form and equation 11 is the geometric form
Equation 5 is the algebraic form and equation 11 is the geometric form. Each of these equations can be written more compactly with matrices

27 So now we rewrite equation 5 using the following substitutions:

28

29

30 And finally we obtain

31 Remember that A is actually a matrix of vectors, so that

32 The nine terms on the right are called the algebraic coefficients.
Next, we convert equation 11 into matrix form. The right-hand side looks like the product of two matrices

33 and This means that

34 Using the following substitutions

35 and

36

37 This is the matrix version of the geometric form.
Because it is the same curve in algebraic form, p(u)=UA, or geometric form, p(u)=FP, we can write

38 The F matrix is itself the product of two other matrices

39 The matrix on the left we recognize as U, and we can denote the other matrix as

40 This means that

41 Using this we substitute appropriately to find

42 Pre-multiplying each side of this equation by 1/U yields

43 Or

44 Space Curves

45 A space curve is not confined to a plane
A space curve is not confined to a plane. It is free to twist through space.

46 To define a space curve we must use parametric functions that are cubic polynomials. For x(u) we write: Equation (1)

47 we combine the x(u), y(u) and z(u) expressions into a single vector equation :

48 If a = 0, then his equation is identical to Equation discussed in plane curves

49 To define a specific curve in space, we use the same approach as we did for a plane curve. This time, though, there are 12 coefficients to be determined

50 We specify four points through which we want the curve to pass, which provides all the information we need to determine a, b, c, and d. Which four points?

51 we can have the four points we need: Points at

52 it turns out to be advantageous to use two intermediate points that we assign parametric values of

53 So we now have the four points we need.
x y z P1 P1/3 P0 P2/3

54 which we can rewrite as the more convenient p1, p2, p3, and p4 (Figure 1).

55 Substituting each of the values of the parametric variable into Equation 1, we obtain the following four equations in four unknowns:

56 Equation (3)

57 Now we can express ax, bx, cx and dx in terms of x1, x2, x3 and x4
Now we can express ax, bx, cx and dx in terms of x1, x2, x3 and x4. After doing the necessary algebra, we obtain

58 Equation (4)

59 We substitute these results into Equation 1, producing

60 Equation (5)

61 Rewriting Equation 5 as follows:

62 Using equivalent expressions for y(u) and z(u), we can summarize them with a single vector equation:

63 Equation (7)

64 This means that, given four point assigned successive values of u (in this case at u=0, 1/3, 2/3 & 1), equation 7 produces a curve that starts at p1, passes through p2 and p3, and ends at p4.

65 Now let’s take one more step towards a more compact notation
Now let’s take one more step towards a more compact notation. Using the four parametric functions appearing in Equation 7, we define a new matrix, where

66 Equation (8)

67 And then define a matrix P containing the control points,
so that Equation (9)

68 The matrix G is the product of two other matrices, U and N:
Equation (10)

69 Where And Equation (11)

70 (Note that N is another example of a basis transformation matrix.)
Now we let

71 Equation (12)

72 Using matrices, Equation 2 becomes

73 To convert the information in the A matrix into that required for the P matrix, we do some simple matrix algebra, using Equations 9, 10 and 13. First we have

74 And then Equation (14) And then Equation (15)

75 Or more simply Equation (16)

76 Computer Graphics Lecture 36


Download ppt "Computer Graphics Lecture 36 CURVES II Taqdees A. Siddiqi"

Similar presentations


Ads by Google