For this lab we were supposed to set up most of the
matrix manipulation functions and what not, to make the rest of our
life easier later. Fortunately for me, I got very bored about two
summers ago and coded up a general matrix algebra class. What can I
say, I was bored.
This left me to spend much of my time designing and creating the actual
render pipeline...
Who did you work with on this assignment, and what tasks did each of you do?
mu
Describe the mechanism you developed for handling the global transformation parameters and matrix.
The global transformation matrix is stored on a stack
of matrices. New matrices are pushed before sub calls, and popped
afterwards. Really this is not functionally different then the method
of implicitly using the callstack for this, that Prof. Maxwell
suggested. I am not entirely sure what is mean by "global
transformation parameters" so I will stop commenting here.
Describe the mechanism you developed for handling the viewing pipeline parameters and transformation matrix.
My transformation matrices use a global stack to do
much of their work. Simply pushing a new matrix on, when appropriate
and popping it when done. The viewing pipeline is handled remarkably
similarly to the method suggested in class, as you can see from the
following example:
StartGraphicsObject();
addGraphicsObject(unitOct);
addScale2D(1.5,.7);
addTranslate2D(-2.5,-.35);
addGraphicsObject(unitSquare);
addScale2D(.2,.5);
addTranslate2D(-2,.35);
addGraphicsObject(unitSquare);
addScale2D(.2,.5);
addTranslate2D(-2,-.85);
addGraphicsObject(unitSquare);
addScale2D(2,.4);
addTranslate2D(-3.5,.85);
addGraphicsObject(unitSquare);
addScale2D(2,.4);
addTranslate2D(-3.5,-1.25);
addGraphicsObject(unitSquare);
GraphicsObject *starShip = EndGraphicsObject();
I opted to have the user get an actual pointer rather than an id. I did
this because I felt that it might allow a developer to implement an
interesting hack or workaround that I had never thought of. I would of
course, feel no responsibility for maintaining back compatibility if
she tried to manipulate the internals without using my magic functions.
The view window and conversion of coordinates is the responsibility of
the environment class and could be controled as follows:
Env2D env(-4,4,-4,4,200,200);
Draw(starShip, &env);
Once you had the code in place, what was the process and how difficult was it to modify the view window and the position of the Enterprise?
Nearly trivial. The difference between the following
images was one ascii character worth of code.
|
|
|
|
|
|
||||
If you extended this assignment in any way, describe what you did and how you did it. Include pictures, or links to pictures that show what you did.
Not really. I suppose that much of what I have done will save me time on the next lab though ;-)Last modified 2003-10-07 22:15 EST