Posted: Mon Oct 6

Due: Friday 10/10 10:00am

Educational Programming

  1. Write code to work with transformation matrices:
    • create a translation matrix
    • create a scale matrix
    • create a rotation matrix about the x-axis
    • create a rotation matrix about the y-axis
    • create a rotation matrix about the z-axis
    • Note: Trig functions usually take radians as parameters, but you should assume degree input. Check the trig functions is your language and make sure to convert from angles if needed.
  2. Modify your main routine so that it keeps track of:
    • A single edge matrix
    • A single master transformation matrix
  3. Create a parser that will interpret a script to be used to draw an image.
    • Each command is a single word without spaces in it, and if it takes arguments, the line after will contain the arguments, separated by spaces. For example, a line of the file might look like this:
      line
      0 0 0 100 100 0
      
    • Here is the full list of commands:
      • line: add a line to the point matrix - takes 6 arguments (x0, y0, z0, x1, y1, z1)
      • ident: set the transform matrix to the identity matrix
      • scale: create a scale matrix, then multiply the transform matrix by the scale matrix - takes 3 arguments (sx, sy, sz)
      • move: create a translation matrix, then multiply the transform matrix by the translation matrix - takes 3 arguments (tx, ty, tz)
      • rotate: create a rotation matrix, then multiply the transform matrix by the rotation matrix - takes 2 arguments (axis theta)
      • apply: apply the current transformation matrix to the edge matrix
      • display: clear the screen, draw the lines of the point matrix to the screen, display the screen
      • save: clear the screen, draw the lines of the point matrix to the screen/frame save the screen/frame to a file - takes 1 argument (file name)
    • The included script tests the various transformations, it should be used when I run make. You still need to create your own image and submit it to the gallery. Please include your script code only when you upload code to the gallery, this way it will be easy for others to try out your pictures!
  4. Makefile specifications:
    • If you look at skill 1, you will see that a 4 involves having multiple targets that may not be directly related to building your project. One initial suggestion is to have a clean target that gets rid of unwanted temporary compiler/interpreter byproducts. In addition, you must have the following targets:
      • The default target should run (and appropriately compile etc.) the test script that I have provided.
      • custom: This target should run your program like the default target, but should use your custom image script instead.