An ArcBall creates a sphere around the 3-D scene and enables the user to click on the sphere’s surface and drag it around, thus causing the scene to rotate.
Use an ArcBall instead of a Call List command to place the scene in an ArcBall. Scenes that are attached to an ArcBall automatically respond to clicks and drags of the mouse. Custom programming is not needed. However, rotations made in the arcball are not saved. (Technically, the ArcBall is surrounded by an implicit Push Matrix and Pop Matrix block, so the movements are gone after it returns. See Using the Matrix Stack for details of pushing and popping.)
For example, examine the script from Primitives Example. Change the single line
scene << CallList(shape); // send the display list to the scene
scene << ArcBall(shape,2); // send the display list to an arcball
This displays the script with an associated arcball with diameter 2. When you run the script and the window appears, right-click and select Show ArcBall > Always from the menu that appears.
Note: ArcBall comes from an article by Shoemake (1994) found in Graphics Gems IV, published by Academic Press.
You can also set the display state of the ArcBall in JSL using the Show ArcBall command.
scene << Show Arcball(state)
Figure 13.9 Showing the Arc Ball