Tutorial Assignment 2: Moving forward

Please excuse the delay in getting Assignment 2 on-line.  On Friday I looked over the results of Assignment 1.  Ten  teams have checked in their work.  There is a pleasing variety in the results; there is a range of subject matter, and a range of difficulty.  Some of the applications are impressive!  It’s clear that there is a wide range of experience levels in Java programming, and familiarity with 3D graphics.  For this reason I’ve decided to postpone moving on the Assignment 2 this week.  I’m renaming it as Assignment 3 and have prepared a different Assignment 2 for this week.  We’ll get back to  Assignment 3 as soon as we’ve worked through the new Assignment 2, which I now want to describe.

Assignment 2 is a continuation of Assignment 1.  I’ve created a new class named simply Assignment and checked it in in the package named util.   Your Assignment2 class should be a sub-class of Assignment, which has a number of methods to make your applications more useful and convenient.  The extensions center around three main features:

  • flexible setup of JRViewer,
  • support for creating inspection panels (to control the parameters of your class), and
  • use of web browser to display on-line documentation.

Consult the class gunn.Assignment2 to see how I adapted gunn.Assignment1 to use these features.  Study in particular how gunn.Assignment2 overrides the following methods from Assignment.  (Notethe safest way to implement these methods in eclipseis via the menu item “Source->Override/Implement Methods”.)

  • getContent():  this SceneGraphComponent is used as the content of the JRViewer. You must implement this method, as it is declared abstract in Assignment.
  • getDocumentationFile(): This String gives the name of the file containing the on-line documentation for the class.  I’ve generated html files and put them in the subpackage gunn.html. In the case the String is “html/Assignment2.html”.
  • getInspector(): This java.awt.Component contains GUI to interact with the parameters which behavior of this class.  If you don’t override this method, you’ll get a default inspector based on Java beans technology; if you don’t want any inspector, overwrite getInspector() and return null explicitly.
  • display(): This method activates the assignment, invokes an instance of JRViewer (which you can customize by overriding the method setupJRViewer()), registers the inspector panel, and sets up the keystroke shortcut ‘h’ to activate the display of the on-line documentation.  My Assignment2 invokes this method in its main() method.

Summing up, here’s the next assignment follows.

Assignment 2

  1. Re-write Assignment1 to be a subclass of util.Assignment (name the result Assignment2, leaving Assignment1 unchanged).
  2. For those whose original assignment consisted of one shape or one surface: extend the mathematical content so that it depends on a real parameter in a non-trivial way. For example, implement a family of polyhedra or a family of surfaces.  This is a prerequisite [Voraussetzung] for the next point:
  3. Implement the inherited method getInspector() to include at least one slider.  Use the value of this slider to control a movement in the content of your class.  For example, the angle of a rotation or length of a translation.  More interesting of course are movements which change the geometry you are displaying.  You can, for example, use this value to control the truncation of the vertices of a polyhedron; to move among a family of surfaces (such from a catenoid to a helicoid); or to control any of the appearance parameters in your program — the possibilities are only limited by your imagination.  I encourage you to include other controls (non-sliders) for other types of parameters (integer, boolean, Color …).  As usual, consult gunn.Assignment2.
  4. Generate on-line documentation, preferably a html file located in a sub-package of your package named html. In this documentation file.  Of course, you can write in German if you wish!The file should contain, in whichever language you write, the following:
    1. Give a description of the mathematical content of your class, focusing on the features which you have implemented.
    2. Then, give a description of how to use your application.  A screenshot of the running application can be a big help here.
    3. Finally, conclude with a brief description directions of further work, if you were to work on it further.  You can also use this section to describe any difficulties you encountered in implementing your ideas.
  5. Steal this program! I encourage you to follow the example contained in gunn.Assigmnent2 as much as possible. Copy and paste from gunn.Assignment2 as much as you wish; every minute you save at this level is a minute you can use to customize the result according to your own wishes.  The same goes for the html documentation file.

 

4 thoughts on “Tutorial Assignment 2: Moving forward

  1. This comment is directed at Assignment2 of Gregor Hendel and Jim-Felix Lobsien. Good work! I was wondering myself how one could extend Assignment1 to include all 6 possible movements of the Rubix Cube. It’s clear you’ve solved that problem. I’d like to read a description of how you did that. (I looked at the code but couldn’t quite follow all the steps). May I suggest that you edit your html file to include a section called Implementation Details, (put it between the Introduction and the Usage section) and there describe how you adjust the scene graph so that different groups of little cubes can be rotated together? (While you’re at it, change the link on your names in the html file to be an e-mail popup for you, not me.) I like the idea of an implementation section so much, I’m going to do the same for gunn.Assignment2 also.

  2. I worked on this problem yesterday with Stefan Sechelmann’s help. We discovered the same problem which is addressed by your comment: deadlock can arise when using Timers and Runnables which are executed on the same thread as the JOGLViewer (the AWT event thread). We fixed the Rubix Cube Assignment2 so that it executes the shuffle on its own thread, and I have checked that in to SVN. Note we had to put the whole shuffle process into one runnable; otherwise the separate moves were executed essentially simultaneously, making for interesting arrangements of the 27 sub-cubes.

    • Hi Charles,

      thanks a lot, the Jogl-viewer now correctly draws the animation. We’ve also adjusted our documentation and included a section covering the implementational details.

      best regards, gregor

Leave a Reply