.To facilitate this relationship the Primitiveclass is derived
.To facilitate this relationship the Primitiveclass is derived from Group. The Java 3D scenegraph, however, can only have Leaf-derived geometric objects as leaf nodes, and many operations, such as picking for mouse-based selection, are performed on Shape3D-derived objects. This lack of compatibility between Shape3Dobjects and Primitiveobjects is something that Sun will address with future releases of Java 3D. Additionally, it is not generally possible to derive a class from Primitivebecause the class is not designed to be extensible. For example Primitive.java contains the following code: static final int SPHERE = 0×01; static final int CYLINDER = 0×02; static final int CONE = 0×04; static final int BOX = 0×08; This extremely non-object-oriented approach to differentiating between instances of objects derived from Primitiveessentially makes it impossible for application developers to safely create new Primitive-derived classes. In general, classes at the top of a class hierarchy should not have knowledge of derived classes. Example code for all of the Primitive-derived classes is defined in the Sun ConicWorld Java 3D demo directory. The ConicWorld demo creates a variety of Primitiveobjects with various lighting, material, and texture attributes. The following subsections describe the simple geometric Primitivesdefined in com.sun.j3d.utils.geometry. 8.2.1 Box java.lang.Object | +–javax.media.j3d.SceneGraphObject | +–javax.media.j3d.Node | +–javax.media.j3d.Group | +–com.sun.j3d.utils.geometry.Primitive | +–com.sun.j3d.utils.geometry.Box Box defines a simple six-sided cube, illustrated in figure 8.2. Unfortunately for Swing developers this name conflicts with the Swing class javax.swing.Boxso if your application uses Swing you should reference the Java 3D class explicitly, as in the following: com.sun.j3d.utils.geometry.Box box = new com.sun.j3d.utils.geometry.Box( 0.5f, 0.5f, 0.5f, null); 110
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services