![]() |
Lab 3: Transformations
|
Download the code Codeblocks Transformations Project. You will need to copy over your shapes (Cylinder, Disk, WiredCylinder, WiredDisk, WiredGeometryBase) from the last lab and place them into the Geometry folder. If you didn't create all of them in the last lab, make the missing ones now. Note, the Geometry folder already contains the GeometryBase, Cube, and WiredCube classes. There are also several new classes in the project:
Animation: In order to animate the scene, 4 things have been added to main.cpp:
animateAngle
declared at the top of main used to keep track of the current angle of rotation.
glutIdleFunc(idle)
has been added to main() to identify the "idle" callback function, i.e. the function
which is called repeatedly at some rate as long as processor cycles are available.
mv = mv*RotateY(animateAngle)
in the display method to implement the actual rotation, in this case around Y. It is
applied after the xyz rotations the user sets using the x, y, z key presses.
If you don't want animation, just comment these out.
Run the code. Assuming your shapes from the last lab are ok, you should see an image of three shapes, which you can rotate as before:
In class, we will go over how the modeling matrices work. Practice modifying the transformations in the display method so that the shapes are oriented differently relative to each other.
The goal of this lab is for you to use transformations to design and build an object (e.g. car, robot, house, etc) constructed by transforming and composing the primitive shapes (disk, cube, cylinder). Feel free to add additional primitive shapes, e.g. a cone is easy to add since it is identical to the disk but with the center raised. Your object should make use of the transformations in a non-trivial way. Include some kind of moving component (e.g. a rotating wheel, arm, etc). Follow these steps:
By the beginning of lab, on Tuesday, Oct 7 have ready your object drawing and scene graph sketch.
Demonstrate your finished program in lab no later than 5pm on Thursday, Oct 9. Also generate an image showing your object. Zip together the image and your codeblocks project (please delete the bin and obj folders) and submit via WISE.