Assignment 3

Fall 2013

CS 582 – GEOMETRIC MODELING

September 19, 2013

Due Date:

Thursday, October 3 at the start of class.

Submission Information:

Per instructions in the Programming Assignments information in the course web page. A short report in hard copy is required. The source and byte code files should be submitted using

submit -user cs582 -tag 582_3 A3.java otherSourceFiles classFiles

Goals:

The main goal of this exercise is to build a simple system in which you can add 3D objects to a scene and display them.

Description:

Write a Java application that provides facilities for defining simple 3-D objects as assemblies of blocks and displays them by using the SimpleViewer class, which can be found in the class account examples. The program initializes a Swing frame for the GUI and a SimpleViewer frame (window) for displaying 3-D objects. Then, it lets you add objects to the display, or erase it. The display frame also shows the xyz or “lab” coordinate system. (This will be useful later, when we move objects around.) The example DemoViewer in the class account shows how to use the SimpleViewer class.

The GUI frame is similar to that of Assignment 2. It now has four menus: File, View, Transform and Object. File and Transform are the same as in Assignment 2. (In fact, Transform is not used in this assignment, but will be needed for later ones.)

Object has a submenu, Block. Clicking on Block produces a frame that asks for a Name for the new block plus Xsize, Ysize and Zsize, the x, y and z dimensions of the block. A block is assumed to be aligned with the principal xyz axes, and to have its lower, back, left corner at the origin. In other words, a block in standard position is in the first octant. Name is the String name to be given to the Block; as before, it has a maximum length of 16 characters and cannot be reused.

The Print menu of Assignment 2 now becomes View, and has two submenus: Display and Erase. Clicking on Display brings up a frame that asks for a Name. If the name is that of a previously-defined Object, then this Object is added to the SimpleViewer display frame (and hence to the associated scene graph). An Object is displayed by showing all of its edges. (To make life easier we don’t do anything fancy like hidden line removal.) The example SphereMenu in the class account shows how to add objects to a scene graph. The lab coordinate system is always displayed. We assume that the user is nice and only defines Objects that fit in the visible region used by the SimpleViewer. (We’ll do a better job in a later assignment.)

Erase clears the display, except for the lab coordinate system. Note that Erase is a purely graphical command that has no effect on the data base of Objects. Thus, for example, if I have defined an Object called A, and I am displaying it, Erase will remove A‘s image from the screen. But if later I invoke Display with A as the argument, the Object A wil appear again on the screen. Nothing is erased until Erase is explicitly called.

Print Friendly, PDF & Email