Courses‎ > ‎Computer Graphics‎ > ‎Dyrland-Weaver‎ > ‎


  • You must include a makefile for each assignment!
    • The makefile should invoke whatever is needed to compile and/or run your program. 
    • When I type make, I expect to have your program generate and display an image.
      • If you cannot get the image to display (either programmatically or via the display command line program), then your program should print the name of the image file created.
    • The image created should thoroughly test the assignment.
  • Every assignment (unless otherwise noted) will require both a github submission and an image gallery submission. Full credit will require both.
    • The gallery submission does not have to be the same as the test image generated when your code is tested.
  • All github submissions should be submodules in the correct period directory for the assignment. Please see the resources page for help on linking your own repository as a submodule.
    • You should maintain separate repositories for each assignment.
    • Submodule naming schema:
      • lastF0f1 
        • e.g. dyrland-weaverJo or konstantinovichSa or brooksPe
      • When working with a partner
        • lastF0f1_lastF0f1
        • e.g. brooksPe_dyrland-weaverJo
        • The first name should always be the earlier name alphabetically 
  • NEVER EVER EVER add image files to github
    • Adding image files will result in deductions
    • I will include a useful .gitignore file at the root of each assignment repository, if you want, copy it and rename it to .gitignore in your repo.
  • Gallery submissions should be made here:

Work 02: Enter the matrix

posted Feb 13, 2019, 6:50 AM by JonAlf Dyrland-Weaver   [ updated Feb 15, 2019, 11:58 AM ]

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:
  • General Matrix stuff
    • matrix multiplication
    • 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)
  • Create a main function/method that demonstrates all the of matrix routines you wrote, and generates an image using the edge matrix structure. Upload the image to the gallery page.
READ THROUGH ALL THE SOURCE FILES. Detailed instructions are provided as comments. 

Here is an example of output, including a correct matrix multiplication:
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 

github clone link:

Work 01: Because it's time, you'll make a line.

posted Feb 6, 2019, 9:22 AM by JonAlf Dyrland-Weaver

Due: Monday Morning (2/11)

You will write your own line algorithm!
  1. First decide what you will be programming in for this assignment. You can use any language you'd like, but you must write your own line algorithm (do not use any built in function that may exist for your language of choice).
  2. Code Bresenham's line algorithm!
    • Start with octant 1.
    • Add the other octants one at a time, you'll have a much easier time debugging doing that.
      • Trust me, I've done this a few times.
  3. Test your algorithm by calling your draw_line routine multiple times.
    • Don't forget to upload an image to the gallery!
Follow these guidelines in your submission
  • Upload your code to gihub
  • Upload an image to the gallery
  • Include a makefile that will create an image using your code.
    • Your code should result in displaying an image that tests all octants, including slopes of 0, 1, -1 and undefended. 
    • If you cannot run the display command, then save an image and print out the name of the image being saved.
    • This image does not need to be the same as your gallery image.
If your are using my frameworks you only need to modify the following files:
  • c
    • draw_c
    • main_c
  • python
github clone link:

Work 0: Imagine all the pixels...

posted Jan 31, 2019, 7:02 AM by JonAlf Dyrland-Weaver

Time for your first computer generated image:

  • Create a program that generates a valid ppm image file, it should be at least 500x500, but also don't make it too big (remember, each pixel is stored as up to 9 bytes - 3 for each color value - so a 1000x1000 image could be 9MB large, they get big fast).
  • Upload your code, as a submodule, to the appropriate place on github.
  • Convert your image to a png and upload it to the ML6 gallery website:
    • For help with converting, you should install ImageMagick
      • on ubuntu, apt-get install imagemagick will work
      • on mac: 
        • First install XQuartz form here:
        •  (if you have homebrew installed): brew install imagemagick --with-x11 will work ( the --with-x11 flag is very necessary, and I've already spent the hours yelling at the internet trying to figure out what was wrong.)
        • If you're more of a macports kind of person: port install imagemagick
      • on windows... installing ubuntu and running apt-get install imagemagick will work (I've been told imagemagick works on cygwin)
      • for more detailed instructions (including building and installing it on your own):
      • You can also log into any stuy machine remotely, and run convert on them.
      • Once you've installed image magic, you can convert with the following command:
        • convert <source> <destination>
        • The destination format will be automatically set based on the file extension
        • example: convert foo.ppm foo.png
  • You must submit your code via github and upload an image!
  • Did you remember to include a makefile?

github clone link:

1-3 of 3