|
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.
That class will contain all the Java3D Virtual Universe stuff and will be added to a JPanel inside a JFrame.
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.
![]() |
Transform3D t3d = new Transform3D();
t3d.rotX(Math.PI/6);
TransformGroup tg = new TransformGroup();
tg.setTransform(t3d);
tg.addChild(new ColorCube());
racine.addChild(tg);
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.
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);
|
| See the "Links" link above to find out the sources of the proposed informations Pascal Vuylsteker / eScience / Computer Science / ANU |
Last modified: 20/4/2004
TOC - Print |
Send your comments at : <Hugh.Fisher@anu.edu.au> |