Assignment 4

Fall 2013

CS 582 – GEOMETRIC MODELING

October 10, 2013

Due Date:

Tuesday, October 22 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_4 A4.java otherSourceFiles classFiles

Goals:

The goals of this exercise are to

  • Modify the SimpleViewer class to make it more useful.
  • Build a rudimentary modeling system that lets you define primitive blocks, move them, and group them.
  • Build an interesting object of your choice.

Description:

This assignment has 3 parts. The first involves extending the SimpleViewer class so that it can display objects of arbitrary size and at arbitrary locations. The easiest way to do this is to add a TransformGroup node to SimpleViewer (the source code for SimpleViewer is available in the class account) and to compute a transform to be applied to the object we want to display so as to position and scale it to fit in the standard viewing region used by Java3D’s SimpleUniverse. We pass to SimpleViewer a sphere (defined by its center and radius, where the center is a Point3d and the radius is a double), and use it to compute a suitable scaling and translation. The application that uses the viewer (in our case, the application is the modeling system) has to have facilities for computing an enclosing sphere for any scene it wants to display. This is the sphere passed to the viewer whenever a display is requested. Note that the sphere (and the scaling and translation transforms associated with it) have to be recomputed whenever a new object is added to the scene being displayed. Note also that the lab coordinate system is always part of the displayed scene.

The second part puts together work done under assignments 2 and 3. Now we want to write a Java application to build primitives and apply transforms to them. We also want to group objects. (We can think of object groups as unions of previously defined ones, but we will not attempt to compute the true edges of the unions.) Later on we will use these facilities to build scenes in the final assignment.

The GUI frame is similar to that of Assignment 3. It has four menus: File, View, Transform and Object. File and Transform are the same as in Assignment 2, but we now restrict the argument of Transform to multiples of 90 degrees. As a result, our objects will have only surfaces that are normal to the principal axes.

Object now has three submenus. The submenu Block is as before, but there are two new ones, Move and Group. Move asks for the names of previously defined Object and Transform, plus a name for a new (moved) object. The semantics is NewObject = Transform ( OldObject ). Group is similar, in that it asks for the names of two old and one new object and has semantics NewObject = OldObject1 + OldObject2. (Here + is just an aggregation operator.) Note that Object arguments for both Transforms and Groups may be primitives, moved objects, or groups of objects.

The View, Display and Erase menus are as before, but use the new viewer, and therefore are not restricted to objects that fit (approximately) in a 0.8 units sphere centered at the origin.

We display groups simply by showing all the edges of the constituent objects. This is not pretty but it is easy.

The third part of the assignment is for you to construct an interesting object of your choice. Although our modeling system does not have the ability of computing Boolean operations or even the edges of unions, if you place the primitives carefully you still can build visually pleasing objects. We will have a contest for the “coolest” object built by the class. Submit with your report an image of your object. In addition, email me a jpeg of your object so that I can show it in class, and we will vote to decide which is the “best”. There is an important award but it’s a surprise.

Print Friendly, PDF & Email