Matt Fowles's Graphics Lab 6


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.
req1.png
(0,0,0) -> (75,75)
(0,0,1) -> (70,70)
(0,1,0) -> (75,25)
(0,1,1) -> (70,30)
(1,0,0) -> (25,75)
(1,0,1) -> (30,70)
(1,1,0) -> (25,25)
(1,1,1) -> (30,30)



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
req1.png
Moved COP
req1cop.png



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
req1.png
Moved COP
req1rotate.png



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
req2.png
Flyby image
flyby.gif



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);
newAPI.png


Last modified 2003-10-07 22:15 EST