Computer Graphics Lecture 36 CURVES II Taqdees A. Siddiqi cs602@vu.edu.pk
CURVES II Taqdees A. Siddiqi cs602@vu.edu.pk
RECAP of last lecture: Parametric Equations of a Curve
A parametric curve is one whose defining equations are given in terms of a single, common, independent variable called the parametric variable.
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
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
which says that the vector p is a function of the parametric variable u.
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
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.
Plane Curves
To define plane curves, we use parametric functions that are second-degree polynomials:
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:
We allow the parametric variable to take on values only in the interval
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
P0 = [x0 y0 z0] P0.5 = [x0.5 y0.5 z0.5] …(6) P1 = [x1 y1 z1]
x0 = cx x0.5 = 0.25ax + 0.5bx + cx …(7) x1 = ax + bx + cx with similar equations for y, and z.
Figure 2: A plane curve defined by three points
Next we solve these three equations in three unknowns for ax, bx, and cx, finding ax = 2x0 - 4x0.5 + 2x1 bx = -3x0 + 4x0.5 + x1 …(8) cx = x0
Substituting this result in to equation 4 yields x(u) = (2x0 - 4x0.5 + 2x1 ) u2 + (-3x0 + 4x0.5 - x1) u + x0 …(9)
Again, there are equivalent expressions for y(u) and z(u). We rewrite equation 9 as follows:
x(u) = (2u2 – 3u + 1) x0 + (-4u2 + 4u)x0.5 + (2u2 – u) x1 …(10)
P(u) = (2u2 – 3u + 1) P0 + (-4u2 + 4u)P0.5 + (2u2 – u) P1 …(11)
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
So now we rewrite equation 5 using the following substitutions:
And finally we obtain
Remember that A is actually a matrix of vectors, so that
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
and This means that
Using the following substitutions
and
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
The F matrix is itself the product of two other matrices
The matrix on the left we recognize as U, and we can denote the other matrix as
This means that
Using this we substitute appropriately to find
Pre-multiplying each side of this equation by 1/U yields
Or
Space Curves
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.
To define a space curve we must use parametric functions that are cubic polynomials. For x(u) we write: Equation (1)
we combine the x(u), y(u) and z(u) expressions into a single vector equation :
If a = 0, then his equation is identical to Equation discussed in plane curves
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
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?
we can have the four points we need: Points at
it turns out to be advantageous to use two intermediate points that we assign parametric values of
So we now have the four points we need. x y z P1 P1/3 P0 P2/3
which we can rewrite as the more convenient p1, p2, p3, and p4 (Figure 1).
Substituting each of the values of the parametric variable into Equation 1, we obtain the following four equations in four unknowns:
Equation (3)
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
Equation (4)
We substitute these results into Equation 1, producing
Equation (5)
Rewriting Equation 5 as follows:
Using equivalent expressions for y(u) and z(u), we can summarize them with a single vector equation:
Equation (7)
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.
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
Equation (8)
And then define a matrix P containing the control points, so that Equation (9)
The matrix G is the product of two other matrices, U and N: Equation (10)
Where And Equation (11)
(Note that N is another example of a basis transformation matrix.) Now we let
Equation (12)
Using matrices, Equation 2 becomes
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
And then Equation (14) And then Equation (15)
Or more simply Equation (16)
Computer Graphics Lecture 36