Java Reference
In-Depth Information
As an example, Appendix F gives the code segment for the knob class, which can be
invoked to create a knob of arbitrary size, position, and orientation relative to an attached
instrument face. Specifically, a knob is defined by five parameters: its radius, length,
number of segments, mark color and face texture. The knob class belongs to Transform-
Group node in the scene graph, with geometry-based on the use of TriangleFanArray. The
color of the knob is set by using TexCoordGeneration. The position and orientation of the
knob on the face of the instrument panel can be changed using the methods setRotationX,
setRotationY, setRotationZ, setPosition. In order that the knob can be turned, PickTool is
set to an appropriate capability.
custom behavIor
After defining and creating the numerous geometry objects for the 3D experiment, it is
necessary to specify how the user can interact with these objects for the purpose of car-
rying out the experiment. As an example, the position of a control button may need to be
changed after being pressed by the user.
The proper functioning of the instruments and their responses depend on many behavior
objects. The important ones are described below and the corresponding code segments are
given in Appendices G and H.
1.
Navigatingbehavior:
Since only one viewpoint is provided in the 3D laboratory, a
SimpleUniverse object is used. This will reduce the time and effort needed to create
the view branch graph significantly. Through the use of the NavigatingBehavior class
provided in Appendix G, the user will be able to explore the virtual laboratory as if
walking around in a real laboratory while carrying out the experiment.
2.
Collisiondetection:
This is based on using a cylinder of height 1.7m and diameter
0.3m in width to model a human body.
3.
Picking behavior:
The PickingBehavior object given in Appendix H enables the
user to turn a knob, press a button, and drag a slider or a connector. As can be seen,
the code segment for realizing the various picking behavior is quite lengthy, illus-
trating the fact that interaction is very often more difficult and time consuming to
develop.
4.
Door operating behavior:
This is for the opening and closing of the door to the
virtual laboratory. It is implemented through the use of both interaction and anima-
tion techniques.
5.
Outdoorbehavior:
An outdoor scene with an island, some sea waves, and flying
planes is included to give a more dynamic feel of being in a real laboratory. This
scene can be viewed through the two windows in the 3D world and is implemented
using standard scale and position interpolators.
Search WWH ::

Custom Search