Publication date: 07/08/2024

ArcBall

Sometimes you want a scene to rotate based on the movements of the mouse. The Surface Plot platform in JMP is an example of a 3-D scene that rotates based on mouse movements.

An ArcBall creates a sphere around the 3-D scene and enables the user to click the sphere’s surface and drag it around, thus causing the scene to rotate.

Use an ArcBall function instead of a Call List function 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 Use the Matrix Stack for more information about 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

so that it reads

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.

This sets the display so that the ArcBall is always showing. Click and drag on the ArcBall to rotate the scene. The right-click menu with Background Color, Use Hardware Acceleration, and Show ArcBall is always available, whether the scene is displayed through a platform, in a journal, or through JSL.

Note: The ArcBall does not have to be showing to react to mouse commands. It is shown here for display purposes only.

You can also set the display state of the ArcBall in JSL using the Show ArcBall message.

scene << Show Arcball(state)

where state is During Drag, Always, or Never.

Figure 13.9 Showing the Arc Ball 

Showing the Arc Ball

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).