Exercise 6 : Color Cube Display
         
You will define at least 3 Java Classes that will display a ColorCube in
a Canvas3D and allow the user to look at it from different viewpoints.
         
Extend a Canvas3D class => Board3D
         
That class will contain all the Java3D Virtual Universe stuff and will
  be added to a JPanel inside a JFrame.
         
Extend a JFrame Class => ApplicationFrame
         
This class will use a a Board3D object and 1 + 6 (7) JButtons. A press
  of a button will change the view point of the scene by rotating it with
a  parametrable angle    around one of the 3 axes. A button should
  allow the user to go back to the default view. 
         
     
 
Tips :
         
         
default viewpoint : at the center of the Local, looking at -z
         
other tip : rotation of a shape :
             Transform3D t3d = new Transform3D();
        t3d.rotX(Math.PI/6);
        TransformGroup tg = new TransformGroup();
        tg.setTransform(t3d);
        tg.addChild(new ColorCube());
        racine.addChild(tg);
         
       Orientation :
         
Remember that default java coordinate systems are not usual...
         
By default, Java 3D coordinate systems are right-handed, with the orientation
     semantics being that +y is the local gravitational up, +x is horizontal
  to the    right, and +z is directly toward the viewer. The default units
 are meters. 
         
 How to get a good GraphicsConfiguration to construct a Canvas3D ?
         
GraphicsEnvironment local = GraphicsEnvironment.getLocalGraphicsEnvironment();
         
// there could be more than one screen
       GraphicsDevice screen = local.getDefaultScreenDevice();
       GraphicsConfigTemplate3D gcTemplate = new GraphicsConfigTemplate3D();
       GraphicsConfiguration configuration = screen.getBestConfiguration(gcTemplate);
     
         
// Board3D extends Canvas3D and call its 'super' constructor
       
       mainCanvas3D = new Board3D(configuration);
       mainCanvas3D.setSize(200,200);
         
How to do all the stuff before being able to see anything
            // Create the VU
            vu = new VirtualUniverse();
    
            // Create Locale
            locale = new Locale(vu);
    
            // Create Branch Group
            viewBG = new BranchGroup();
    
            // Create Transform Group
            viewTG = new TransformGroup();
            viewTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    
            // Create View Platform
            viewPlatform = new ViewPlatform();
    
            // Create View
            view = new View();
    
            // Create Physical Body
            physicalBody = new PhysicalBody();
    
            // Create Physical Environment
            physicalEnvironment = new PhysicalEnvironment();
    
       // Create Board (Canvas 3D)
            board = ??? (your implementation)
    
            // attach nodes together
    
            view.setPhysicalBody(physicalBody);
    
            view.setPhysicalEnvironment(physicalEnvironment);
    
            view.addCanvas3D(board);
    
            view.attachViewPlatform(viewPlatform);
    
            viewTG.addChild(viewPlatform);
    
            viewBG.addChild(viewTG);
    
            addBranchGraph(viewBG);
    
    This will construct a new VirtualUniverse and all the Java3D stuff 
needed  to view 3D scenes. You can then add the board (Canvas3D) to your
JPanel which  is added to a  JFrame.
    
    To add content we must create first the ColorCube then add it to the
scenegraph   via the addBranchGraph method of the Locale class.
    
    At first you won't see anything as the cube is centered at position 0,0,0
  and so is the view. The inside of the cube won't be drawn due to back face
  culling. So you must first move the view (or the cube). I'll move the view
  back 5 metres here.
    
        Transform3D viewPos = new Transform3D();
        viewPos.set(new Vector3D(0, 0, 5));
        viewTG.setTransform(viewPos);