Select Page

# 2M

## Part 2M: Manipulation of Matrices 2

Chris introduces Part M in this :30 video by refering back to the board with an “L” on each side.

*******************************************************

A PDF of a text file of the commands of this Part, Part M, is available at this link:

Quorum Commands Section 2 Part M – PDF

The list of all the Quorum Matrix Commands is linked here again for your convenience:

Quorum Matrix Commands

********************************************************

Having more than one image allows brightness values for objects to be added together. How could you assure that the same positions were being added together? Let’s try some matrix manipulation to give us an idea of what could be done.

Later in this section we will try some image manipulations in Afterglow Access.

If you use the same Quorum Box as the previous part, you can use the matrices you have already defined, just delete the rest of the code you typed in from the previous part. Or just open a new Quorum Box:

Quorum Box

Make sure the first command is:

##### use Libraries.Compute.Matrix

******************

### A) Shift Command

To practice with these commands,use any matrix you already have defined in your Quorum box.  Output the original matrix, and then a “space”  before using the new command to change the matrix. You want to compare the changed matrix to the original.  Please use the “say” command if that is more convenient.

Below is an example for the Shift command:

##### output m1:Shift(2,3,0.0):ToText()

Compare the two matrices. Did it do what you imagined? Comment in your journal.

What did Shift do?

We first specified the number of rows to shift down by, then the number of columns to shift over by, and the last number told Quorum what number to fill in the new rows and columns with.

Let’s define the output of the Shift as a new matrix. See if you can remember before looking at the example that follows.

##### output m1s:ToText()

***************

The first 38 seconds introduces the Flip commands.

### B) FLIP Command

Afterglow Access has the ability to flip vertical or horizontal.

Do you remembering trying those options when looking at the Display Settings on Afterglow Access (AgA)? If not, go to the Display Settings, scroll to the bottom, and try the options there.

Now try Flip with any of the the matrices you have defined above.

If you use the example below, make sure you use the name of your matrix! Again, follow the video for more detailed instructions if you would like.

##### output m1:FlipVertical():ToText()

Examine the flipped matrix. How did it change? Record in your journal.

Now try to flip it in the horizontal direction. Recall, this command will use the matrix m1 you defined previously, not the ‘FlipVertical’ matrix you made when you used that command – unless you saved it as a new matrix.

##### output m1:FlipHorizontal():ToText()

Examine the new matrix. How is it different from the vertical flip?

Also relate it to the image orientation activity you did with the “L”. Can you show each other the “L” flipped vertically and horizontally? Are you correct?

*******************************

Chris introduces the Reshape command in the first part of this 3:19 video. Then you can follow his step by step instructions, or skip to the instructions below the video.

### 3. RESHAPE Command

This command allows you to move the matrix down any number of rows from the first row, and then move it over any number of columns from the first column. Study the example code below and discuss what you think will happen before trying it.

##### output m1:Reshape(2,3,7,7,10):ToText()

In this case, you shifted the original matrix down two rows and over three columns: it is now a 7 x 7 matrix.

• The new rows and columns have been filled in with the value of 10.0, and will just drop the part of the original matrix that has been shifted out.

********************************

Chris introduces the idea of Transpose in the first 1:10. Then you can follow his step by step instructions, or skip to the instructions below the video.

### 4. TRANSPOSE Command

What do you think happens here? Let’s try it:

##### output m1:Transpose():ToText()

Examine the new matrix. Describe what took place. Is it what you expected? Record your answer in tyour journal.

********************************

Chris introduces the idea of Rotate in the first 29 seconds. Then you can follow his step by step instructions, or skip to the instructions below the video.

### 5. ROTATE Command

This does exactly what you think, either to the left or right. How many degrees does a ‘rotate’ mean? Try it and enter your answer into your journal.