Every assignment (unless otherwise noted) will require both a github submission and an image gallery submission. Full credit will require both.
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.
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.
posted Mar 24, 2017, 6:15 AM by JonAlf Dyrland-Weaver
[
updated
]
DUE: 8am Thursday 3/30
We will now begin to add 3d shapes (as points only) to our already simmering graphics stew.
You must do the following things:
Write correct, functioning code.
Create a script file
Upload a new picture to the gallery
add the following commands to the parser
clear: clears the edge matrix of all points
box: adds a rectangular prism (box) to the edge matrix - takes 6 parameters (x, y, z, width, height, depth)
sphere: adds a sphere to the edge matrix - takes 4 parameters (x, y, z, radius)
torus: adds a torus to the edge matrix - takes 5 parameters (x, y, z, radius1, radius2)
radius1 is the radius of the circle that makes up the torus
radius2 is the full radius of the torus (the translation factor). You can think of this as the distance from the center of the torus to the center of any circular slice of the torus.
posted Mar 2, 2017, 8:02 AM by JonAlf Dyrland-Weaver
[
updated Mar 2, 2017, 8:43 AM
]
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: The trig functions in python and c take radians as parameters, but you should assume degree input, make sure to convert or things won't look right.
Modify your main routine so that it keeps track of
A single edge matrix
A single master transformation matrix
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 arguemnts (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: draw the lines of the point matrix to the screen, display the screen
save: draw the lines of the point matrix to the screen/frame save the screen/frame to a file - takes 1 argument (file name)
posted Feb 17, 2017, 5:54 AM by JonAlf Dyrland-Weaver
[
updated Feb 27, 2017, 8:16 AM
]
This will be due 8am Wednesday, 3/1.
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
scalar matrix multiplication
matrix 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.
posted Feb 9, 2017, 11:14 AM by JonAlf Dyrland-Weaver
[
updated Feb 15, 2017, 7:47 AM
]
DUE: 8am Thursday 2/16
You will write your own line algorithm!
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).
In order to save an image in a non ppm format, or display the image, you must have imagemagick installed
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.
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 with a “make run” target
The make run target should run your code (compile if necessary)
Your code should result in displaying an image that tests all octants, including 0, 1, -1 and undefended slopes. If you cannot run the display command, then save an image and print out the name of the image being saved.
This image may not be the same as your gallery image, that is ok.
If your are using my frameworks you only need to modify the following files:
posted Feb 3, 2017, 6:40 AM by JonAlf Dyrland-Weaver
[
updated Feb 3, 2017, 12:18 PM
]
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 3 bytes - one for each color value - so a 1000x1000 image will be 8MB large, they get big fast).
Upload your code, as a submodule, to the appropriate place on github.
(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)