The bulk of this lab was focused on creating 3D
perspective projections. Although for us the bulk of our time was spent
debugging. After we got everything working, we massively overhauled our
code to make the API more streamlined and intuitive, and to use OOP to
encapsulate memory management. We also removed extra classes from our
previous labs. Also, while we used to (poorly) attempt to line clip,
everything is now point-clipped.
Who did you work with on this assignment, and what tasks did each of you do?
Most of the time was spent working on computers
that were adjacent. Thus a "break down" of the parts is not really
possible. We also spent most of the debugging time working together.
What are the (x,y) values for the eight corners of the cube in the first required image?
Although it took some bug hunting to get us there,
we managed to get the required images looking like we had expected. We
had almost everything working, but it appeared that we weren't actually
viewing our cube from the point that we should have been. It seemed
that everything was shifted for certain values, and other values simply
produced weirdness. We discovered that we weren't normalizing our
points before drawing them; upon fixing this error, everything worked
beautifully. On a bonus note, our alpha blending and filling managed to
come along for free.
|
How does modifying the distance between the COP and the VRP affect the appearance of the cube in the first required
Modifying the distance between the center of
project and the view reference point changes the field of view and the
depth of field. When the distance is increased both the field of view
and the depth of field decrease, leading to a smaller section of the
scene, being visible, with a more flattened appearance.
Required Image |
Moved COP |
How does modifying the direction of VUP modify the appearance of the cube in the first required?
Changing VUP rotates the image as a whole. Since there
is a new concept of up, this makes sense.
Required Image |
Moved COP |
How does modifying the size of the view window modify the appearance of the cube in the first required image?
Making the view window larger makes more of the scene
visible, while shrinking the size of individual items on the image.
Making the view window smaller does the opposite.
What extensions did you do for this assignment, how did you do them, and how well did they work?
We implemented both arbitrary perspective
transformation as well as implementing everything within the context of
our hierarchical modeling system.
The arbitrary transforms were accomplished by applying a shear matrix
to force the COP onto the axis. It works well and was really not
difficult once we remember what a shear matrix looks like.
The modeling system had to be upgraded to allow for three-dimensional
matrices and points, but other than that, it was pretty easy. We took
this time to switch the internal linked list of the modeling system to
the format that Prof. Maxwell suggested.
We also have a few nifty images...
Required Image 2 |
Flyby image |
What does the new API look like?
GraphicsObjects are now embedded into objects, so the user no longer has to worry about the internal list structure. The user is still responsible for making certain that GraphicsObjects which are embedded in each other are not prematurely deleted, but this is the way of C.We also changed color, filledness, and alpha value to be things that are embedded into the list itself. So if an object does not specify a color for itself, the scene in which it is placed can specify that color for it. When an embedded object is drawn, the current drawing state information is saved and then restored after the call.
For example, the following code produces the following image...
GraphicsObject scene; scene.setColor(Color(255,0,0)); scene.addGraphicsObject(&cube); scene.addTranslate3D(-1.2,0,0); scene.setColor(Color(0,0,255)); scene.addGraphicsObject(&cube); GraphicsObject moo; moo.setColor(Color(0,255,0)); moo.addGraphicsObject(&scene); moo.addTranslate3D(0,-1.2,0); moo.addGraphicsObject(&cube); |
Last modified 2003-10-07 22:15 EST