Java Reference
In-Depth Information
retrieved. This is done in lines 4 and 5, where the arrays pt and ptw give the local
and global coordinates. Subsequently, Lines 6 and 10 check for the mouse being on
the front face, and the global coordinates of the controls are calculated in lines 7, 12
and 15.
To identify or find out the identity number of the control being picked, the global
coordinates of the controls have to be compared with the values in the original
setup. The latter can be obtained from the former using a series of linear geometric
transformation based on the hierarchy structure that defines the virtual laboratory
in terms of instruments and controls.
In the code fragment in Figure 26, the functions whichObject and isObject are for the
purpose of finding the identity of the control picked from comparing global coordinates.
These two functions are given in Figure 27. Specifically, in the whichObject method, an
appropriate integer that identifies a specific control in the scene is returned if any of the
if statements is correct. The values of x and y correspond to the global coordinates of the
center of the picked object, which is placed along the z axis.
This chapter has discussed the use of picking behavior class for the purpose of picking
objects of interest. Using simple utility classes such as PickRotationBehavior, PickTrans-
lateBehavior, and PickZoomBehavior is straightforward, although the picking behavior
may not be flexible enough for most applications. The use of a variety of picking shapes,
such as PickRay, PickConeRay, PickCylinder, and PickBounds, to customize the picking
behavior is then discussed, followed by an example involving the controls in 3D instru-
ment panels.
Barrilleaux, J. (2001). 3D user interfaces with Java 3D . Manning Publications.
Emoto, M., Narlo, J., Kaneko, O., Komori, A., Iima, M., Yamaguchi, S., & Sudo, S. (2001).
3D real-time monitoring system for LHD plasma heating experiment. Fusion Engineering
and Design , 56 , 1017-1021.
Nakano, H., Sato, Y., Matsuo, S., & Ishimasa, T. (2000). Development of 3D Visualiza-
tion system for the study of physical properties of quasicrystals. Materials Science and
Engineering , 542-547.
Search WWH ::

Custom Search