Exploration Discussion

Brian_1234
Exploration_Matrix.pdf

EXPLORATION OF MATRIX ALGEBRA AND

DETERMINANTS

Introduction Computer Graphics Areas and Volumes Check Understanding Discuss! References

C������� G������� Note: If equations don't render correctly when initially viewed, refresh your browser page and wait for it to load completely before visiting any of the tabs.

Linear transformations play an important role in computer graphics, especially in the animation of a figure in a two- or three-dimensional coordinate system. Here, we explore the two-dimensional case, in which we have an isosceles triangle representing an arrowhead described by the vector

coordinates, .

The top of this triangle represents the point of the arrowhead, currently pointing straight upward as shown in Figure 2.1.1.

[ ],  [ ],  and [ ] −1 −1

0 0

1 −1

Listen

Fig. 2.1.1 (generated from): Wolfram Alpha: Computational Knowledge Engine. (2009). Retrieved March 26, 2016, from https://www.wolframalpha.com

Figure 2.1.1: Graph of arrowhead described by the vector coordinates,

The arrowhead can be represented by a matrix with these vectors as its columns,

The order of the columns is not important, and the vertices are all that is needed to reconstruct the arrowhead. We will move the arrowhead around by performing linear transformations on its vertices. Properties of linear transformations tell us that lines between the original vertices will be transformed to lines between the resulting vertices, so our transformed object will still be an arrowhead (possibly stretched, projected, or otherwise moved around). This means that we only need to know what a linear transformation does to the vertices in the matrix A to know what it does to the whole arrowhead, which we can reconstruct from the transformed vertices.

[ ],  [ ],  and [ ]. −1 1

1 −1

0 0

A = [ ]. −1   1   0 −1   −1      0

Let's say we want to enlarge the arrowhead so that it is three times as tall and two times as wide. This means we want to find a matrix T such that TA represents the enlarged arrowhead.

Fig. 2.1.2 (generated from): Wolfram Alpha: Computational Knowledge Engine. (2009). Retrieved March 26, 2016, from https://www.wolframalpha.com

Figure 2.1.2: Graph of the original arrowhead represented by the matrix, A, and the enlarged arrowhead represented by the transformed

matrix, TA.

The matrix T represents a linear transformation that takes x to 2x and y to

3y, that is,

The matrix for this transformation is

What does T do to the vertices represented by the matrix A?

T[ ] = [ ]. x

y

2x

3y

T   =  [ ]. 2  0 0 3

TA = [ ] [ ] = [ ]. 2  0 0 3

−1  1 0 −1 −1   0

−2  2 0 −3  −3  0

Notice that the columns of this matrix are the vertices of the transformed arrowhead in Figure 2.1.2.

Great! Now, lets try translating the original arrowhead up 5 units. Such a simple transformation ought to be linear, too, right? Not quite.

If we attempt to find a matrix T such that

we find that this won't work (try it!).

Since there is no matrix that works, and there is a one-to-one correspondence between linear transformations and matrices, there can't be a linear transformation that performs the desired translation. At least, not as we have set it up thus far.

Programmers would be pretty distraught if they had to give up linear algebra to perform translations, which are everywhere in computer graphics animations. Luckily, they don't have to! the method of homogeneous coordinates makes translations linear. Homogeneous coordinates are used extensively in computer graphics for all linear transformations in order to be able to include translations.

In homogeneous coordinates, each vector originally represented with two coordinates is represented in three coordinates by appending

a 1 to it. So we'll replace the original matrix A representing the arrowhead by:

The linear transformation needed to

enlarge the arrowhead as we did before will now be represented by the matrix:

Everything is the same as before except we have added the seemingly superfluous extra row to A, and extra row and column to the linear transformation matrix T.

T  [ ] =  [ ], x

y

  x   y + 5

A = . ⎡⎢⎣−1 1 0 −1 −1  0 1 1 1

⎤⎥⎦T = ,  where now TA = . ⎡⎢⎣2  0  0 0 3 0 0 0 1

⎤⎥⎦ ⎡⎢⎣−2    2   0 −3 −3  0 1 1 1

⎤⎥⎦

E������ ₂.₁.₁: T���������� �� ₅ ����� ����� ����������� ����������� But now let's examine the translation in which we move the arrowhead up 5 units. What we want is a linear transformation matrix T

that has the following effect:

In homogeneous coordinates, this can be represented by the matrix

so

our translation is now linear! The translated coordinates are given by the transformed matrix:

Note that the last row of a transformation matrix T in homogeneous coordinates will

always be a row of zeros with a 1 at the end, so that the matrix containing the coordinates will always have its last row consisting entirely of 1's.

E������ ₂.₁.₂: C�������� ��������������� �� ���������� ����������� Let's now use homogeneous coordinates to perform a trickier animation. We'll start with a matrix B representing the arrowhead starting with its tip at the point (1,1) and we want to rotate it so that it is aimed at an object located at position (–2, 4) as shown in Figure 2.1.3 below.

T = . ⎡⎢⎣x

y

1

⎤⎥⎦ ⎡⎢⎣ x

y + 5 1

⎤⎥⎦T = , ⎡⎢⎣1   0  0 0  1   5 0 0 1

⎤⎥⎦TA = = . ⎡⎢⎣1   0  0 0  1 5 0  0 1

⎤⎥⎦⎡⎢⎣−1  1  0 −1  −1  0 1 1 1

⎤⎥⎦ ⎡⎢⎣−1  1  0 4 4 5 1 1 1

⎤⎥⎦

Fig. 2.1.3 (generated from): Wolfram Alpha: Computational Knowledge Engine. (2009). Retrieved March 26, 2016, from https://www.wolframalpha.com

Figure 2.1.3: Rotating the arrowhead with its tip at (1,1) to aim it at an object centered at (-2,4).

To do this, we will need to compose three linear transformations. This technique is shown in the following video.

Video 2.1.1: Computing Linear Transformations using Homogeneous Coordinates

Video by Dr. Lisa Korf: Computing Linear Transformations [© CCCOnline]

Video 2.1.1 Transcript: Computing Linear Transformations

As you may have concluded by now, homogeneous coordinates are an indispensable tool in computer graphics. Click on the Check Your Understanding tab to test yourself on what you've learned.

Introduction Computer Graphics Areas and Volumes Check Understanding Discuss! References

0:00 / 12:34