Docsity

Assignment 3 Report - Computer Graphics | CS 411, Assignments of Computer Graphics

Toggle sidebar
bg1
Alex Holtz
CS 411
Assignment 3 Report
Tuesday, March 11, 2003
This purpose of this program was to gain insight into graphic 2D transforms via matrices.
We did this by duplicating the transforms that is normally handled entirely by the
OpenGL library with the help of a matrix library called SVL (Simple Vector Library).
As before, I use special include headers to support my development under Mac OS X and
also maintain compatibility when bringing the code to another platform.
However, in order to use SVL for this assignment I had to specially compile it for OS X
and learn how to add include header and library search paths to my IDE which I had
never done before. Those steps probably took me almost as long as the assignment itself
because I had some difficulty compiling SVL at first.
Drawing the two line segments with OpenGL was very easy, but duplicating the math
behind it involved understanding that OpenGL post-multiplies the transform matrix, this
means that ALL transform operations have to be executed in reverse order. I first tried
separating the transforms into distinct sections, one for the base segment and one for the
arm segment. However, this produced erroneous results and I had to go back and look at
what it was I was doing out of order.
The only other difficulty in reproducing the matrix transforms by hand was making the
connection that SVL’s Rotate functions required the angle in radians. A simple enough
conversion but it took me awhile to realize that was the problem.
Once I passed those hurdles I was able to duplicate the transforms done by OpenGL and
produce the two blue dots at the endpoints of the arm link, those dots are then used to
calculate the collision of the falling balls with the line segment.
The following is sample output of my program.
pf2

Partial preview of the text

Download Assignment 3 Report - Computer Graphics | CS 411 and more Assignments Computer Graphics in PDF only on Docsity!

Alex Holtz CS 411 Assignment 3 Report Tuesday, March 11, 2003 This purpose of this program was to gain insight into graphic 2D transforms via matrices. We did this by duplicating the transforms that is normally handled entirely by the OpenGL library with the help of a matrix library called SVL (Simple Vector Library). As before, I use special include headers to support my development under Mac OS X and also maintain compatibility when bringing the code to another platform. However, in order to use SVL for this assignment I had to specially compile it for OS X and learn how to add include header and library search paths to my IDE which I had never done before. Those steps probably took me almost as long as the assignment itself because I had some difficulty compiling SVL at first. Drawing the two line segments with OpenGL was very easy, but duplicating the math behind it involved understanding that OpenGL post-multiplies the transform matrix, this means that ALL transform operations have to be executed in reverse order. I first tried separating the transforms into distinct sections, one for the base segment and one for the arm segment. However, this produced erroneous results and I had to go back and look at what it was I was doing out of order. The only other difficulty in reproducing the matrix transforms by hand was making the connection that SVL’s Rotate functions required the angle in radians. A simple enough conversion but it took me awhile to realize that was the problem. Once I passed those hurdles I was able to duplicate the transforms done by OpenGL and produce the two blue dots at the endpoints of the arm link, those dots are then used to calculate the collision of the falling balls with the line segment. The following is sample output of my program.