Figure 1. Specifying geometry and appearance of Shape3D objects
Shape3D myShape = new Shape3D ();
// Constructs and initializes an object with default parameters of geometry and
// appearance as null. At the same time, centre is set to be at the origin (0,0,0).
Shape3D myShape1 = new Shape3D (myGeometry1);
// Constructs an object with geometry given by myGeometry1 and a null appearance.
Shape3D myShape2 = new Shape3D(myGeometry2, myAppearance2);
// Constructs and initialized an object with geometry given by Geometry2 and appearance given
// by myAppearance2.
component of this class hold the geometric data for the 3D object to be created, while the
appearance component defines physical properties like color and line styles.
After its definition, a Shape3D class can be instantiated to create one or several Shape3D
objects. These objects are usually added as child nodes to a BranchGroup, TransformGroup
or any appropriate group node. The node components of the Shape3D object include objects
under the Geometry and Appearance classes. The latter is optional, but will most likely
Figure 2 shows the structure of a created Shape3D object and its components under a
TransformGroup. The corresponding code segment is shown in Figure 3. Specifically, in
Figure 2. A Shape3D object and its components