Courses‎ > ‎Computer Graphics‎ > ‎Konstantinovich‎ > ‎

2019-02-13 02Matrix

posted Feb 13, 2019, 11:48 AM by Konstantinovich Samuel   [ updated Feb 28, 2019, 6:06 AM ]
There is no spoon.

This will be due Monday, 2/25

Implement the following features but you cannot trivialize the problem by using a structure that already exists in the language you choose:
  • Create a repo: mks66-matrix
  • General Matrix stuff
    • matrix multiplication  (you may assume a 4by4 times a 4byN)
    • creation of an identity matrix
    • displaying a matrix in a reasonable manner
  • Graphics matrix stuff
    • add a point to an edge matrix
    • add an edge to an edge matrix (should call your add point routine)
    • go through an edge matrix and draw the lines stored in the matrix (should call your draw line routine)
    • output and display an image file
  • Demonstrate your multiply works using the following: (do not reset the values of A and B after each operation)
    • A = {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}
    • B = {{11,12,13,14},{15,16,17,18},{19,20,21,22},{23,24,25,26}}
    • mult(A,B)
    • print A
    • print B
    • mult(B,A)  
    • print A
    • print B
    • mult(IDENT,A)
    • print A
  • Upload an image to the gallery page.

READ THROUGH ALL THE SOURCE FILES. Detailed instructions are provided as comments. 


Here is an example of what would happen if you added 2 points and multiplied:
Testing add_edge. Adding (1, 2, 3), (4, 5, 6) m2 = 
1.00 4.00 
2.00 5.00 
3.00 6.00 
1.00 1.00 

Testing ident. m1 =
1.00 0.00 0.00 0.00 
0.00 1.00 0.00 0.00 
0.00 0.00 1.00 0.00 
0.00 0.00 0.00 1.00 

Testing Matrix mult. m1 * m2 =
1.00 4.00 
2.00 5.00 
3.00 6.00 
1.00 1.00 

Testing Matrix mult. m1 =
1.00 4.00 7.00 10.00 
2.00 5.00 8.00 11.00 
3.00 6.00 9.00 12.00 
1.00 1.00 1.00 1.00 

Testing Matrix mult. m1 * m2 =
40.00 76.00 
47.00 92.00 
54.00 108.00 
7.00 16.00 

Comments