Assignment 05
Meggie Ladlow

Required Image 1: ./hms 2.36 0.0 1
1. To maintain the model of images that I wanted to draw, I used
a linked list where the nodes were Element structs. Each Element struct
had a void pointer to the next struct in the list, and a void pointer to
the current Element. I used an enumerated ObjectType struct(I'm not sure
exactly what this creation is called) to keep track of the type of the
current Element.
The main body of the drawing function is a while loop that iterates
through the linked list of Elements. Inside the while loop there is a
switch statement that is based off of the type of Element as given by the
enumerated type statement. For each case, the object to be drawn is
xformed by the LTM, GTM, and VTM in that order. Then, each point in
the Element is divided by the homogenous coordinate. Finally, there
is a call to the object's draw function.
Matrices can be drawn one of two ways. To set the LTM back to the
identity matrix, use the enumerated type ObjIdentity. Otherwise, just add
the matrix to the linked list. It will be multiplied to the LTM inside of
the while loop when the linked list comes to a Element with enumerated
type ObjMatrix.
Color can be changed by adding an Element of enumerated type ObjColor.
When there is an ObjModule, Module_draw calls itself recusively, passing
the original VTM as the VTM and the product of the current LTM and the
original GTM as the GTM.

2. This is the image I created for the lab. To create this image, I used
many polygons comprised of various points. There is a scene comprised of
various parts. And here is a graph thing. Because I don't want to talk
about it.
Code
model.c
horse_model.c
Scene
- rotate(cos(pi/6), sin(pi/6))
- scale(1.25, 1.25)
- translate(250, 165)
- addModule(SpecialHorse)
- identity()
- rotate(cos(pi/6), sin(pi/6))
- scale(-1.0, 1.0)
- translate(175, 180)
- addModule(SpecialHorse)
- identity()
- rotate(cos(pi/6), sin(pi/6))
- translate(325, 280)
- addModule(SpecialHorse)
- identity()
- scale(1.25, 1.25)
- translate(350, 350)
- addModule(BodySpecialBackLeg)
- identity()
- scale(-1.0, 1.0)
- translate(450, 350)
- addModule(BodySpecialBackLeg)
- identity()
- translate(400, 300)
- addModule(BodySpecialBackLeg)
- identity()
- scale(1.25, 1.25)
- translate(150, 325)
- addModule(Body)
- identity()
- scale(-1.0, 1.0)
- translate(100, 375)
- addModule(Body)
- identity()
- translate(200, 375)
- addModule(Body)
- identity()
SpecialHorse
- translate(-17.0, -15.0)
- addModule(Neck)
- translate(3.5, 21.0)
- addModule(SpecialFrontLeg)
- translate(27.0, 2.0)
- addModule(UpperBackleg)
- addModule(BackwardsBackLeg)
- translate(5.0, -11.0)
- addModule(Tail)
BodySpecialBackLeg
- translate(-17.0, -15.0)
- addModule(Neck)
- translate(3.5, 23.0)
- addModule(UpperFrontLeg)
- addModule(SpecialFrontLeg)
- translate(27.0, 0.0)
- addModule(UpperBackLeg)
- addModule(SpecialBackLeg)
- translate(5.0, -11.0)
- addModule(Tail)
Body
- addColor(HorseBrown)
- scale(1.0, -1.0)
- addPolygon()
- identity()
- translate(-17.0, -15.0)
- addModule(Neck)
- translate(35.5, 12.0)
- addModule(Tail)
Neck
- addColor(HorseBrown)
- scale(1.0, -1.0)
- addPolygon()
- identity()
- translate(-10.0, 3.0)
- addModule(Head)
Head
- addColor(HorseBrown)
- scale(1.25, -1.25)
- addPolygon()
- identity()
UpperFrontLeg
- addColor(HorseBrown)
- scale(1.0, -1.25)
- addPolygon()
- identity()
- translate(0.0, 8.75)
- addModule(LowerLeg)
SpecialFrontLeg
- addColor(HorseBrown)
- scale(1.0, -1.25)
- rotate(cos(pi/2), sin(pi/2))
- addPolygon()
- identity()
- translate(-8.0, 0)
- addModule(LowerLeg)
UpperBackLeg
- addColor(HorseBrown)
- scale(1.0, -1.25)
- addPolygon()
- identity()
- translate(0, 8.75)
- addModule(LowerLeg)
SpecialBackLeg
- addColor(HorseBrown)
- scale(1.0, -1.25)
- rotate(cos(pi/4), sin(pi/4))
- addPolygon()
- identity()
- translate(-6.0, 6.0)
- addModule(LowerLeg)
BackwardsBackLeg
- addColor(HorseBrown)
- scale(1.0, -1.25)
- translate(3.0, -3.0)
- addPolygon()
- identity()
- translate(1.0, 5.75)
- rotate(cos(-pi/8), sin(-pi/8))
- addModule(LowerLeg)
LowerLeg
- addColor(HorseBrown)
- scale(1.0, -1.25)
- addPolygon()
- identity()
- translate(0, 8.75)
- addModule(Hoof)
Hoof
- addColor(HoofColor)
- scale(1.0, -1.0)
- addPolygon()
- identity()
Tail
- addColor(HoofColor)
- scale(0.75, -1.0)
- addPolygon()
- identity()