OrbitBehaviorInterim provides the mouse navigation capabilities of "com.sun.j3d.utils.behaviors.vp.OrbitBehavior" for a standard VirtualUniverse inclusive SimpleUniverse and for any AWT Component inclusive Canvas3D and JCanvas3D. ConfiguredUniverse is not supported.

Since Version 2.0 navigation in parallel projection mode and clipping distances update are available.
Since Version 2.1 changes of the TransformGroup's transform component are no longer supported.

This implementation might serve as an interim version until a Java 3D core utility is available.

Author: August Lammersdorf, www.InteractiveMesh.com/org
Version: 2.1
Date: 2007/10/19


Viewing properties

All viewing related properties which OrbitBehaviorInterim is operating on have to be set only on its instance. The TransformGroup's transform component is concerned as well as the View's field of view if a View object is set. This guarantees a consistent state for manual navigation and programmed viewpoint setting. A Viewpoint can be considered as a combination existing of a transformation, a center of rotation, a field of view, the projection mode, and/or any viewing related attribute of a ViewPlatform, a View, and a Canvas3D object. Java 3D doesn't provide a specific Viewpoint class. Therefore a Viewpoint can be arbitrarily designed to meet the desired cross objects capabilities. If a synchronized parallel and perspective navigation is needed a Viewpoint has to provide at least a transformation, a center of rotation identical with the center of view, and a field of view to ensure the same view.

Parallel and perspective navigation

According to the nature of parallel projection the scene doesn't change its size as it does in perspective projection mode when zooming ( = translation (!) along the z-axis) is applied. Implementing this perspective effect in parallel projection requires a kind of scaling in proportion to the z-translation.

There is a need for a reference point beside the ViewPlatform's position to measure changes of z-translations. Since OrbitBehavior/Interim supports a center of rotation and because the view is mostly directed to it, this point is choosen for the parallel projection implementation. To achieve a nearly identical navigation behavior in parallel and perspective projection mode the scaling is calculated in a fixed proportion to the distance from the ViewPlatform's position to the center of rotation. The fixed scaling factor depends on the current (perspective) field of view and the default (parallel) screen scaling (physical screen width / 2.0). This parallel scaling is used for setting the screen scaling per View.setScreenScale(double scale) (scale policy is View.SCALE_EXPLICIT).

From this follows that the perspective navigation is synchronizing the parallel navigation. The view stays 'stable' whenever the projection mode is switched from perspective to parallel and back again. The parallel navigation works fine as long as the ViewPlatform doesn't move through the center of rotation resulting in a zero or negative distance.

Unfortunatedly, this synchronization has a drawback. If in parallel projection mode a new rotation center is set without centering the view to it, the view will jump more or less. The reasons are that the ViewPlatform stays in place and the distance to the center of rotation (most likely) changes. This jumping can be avoided by setting the 'pure parallel flag'. In consequence a jumping may arise when the mode is switched to perspective projection. This flag should be set whenever the parallel projection mode is the standard mode of the application.

Clipping update

If this scene is zoomed (parallel or perspective projection mode) the front and back clip distances of the View object are updated immediately. Depending on the scene bounds and the roation center these distances are calculated to achieve minimal clipping extent and optimized back/front ratio.


Release notes.

Version 2.1 - 2007/10/19

New Features

New Methods
Version 2.0 - 2007/10/14

New Features New Constructors New Methods
Version 1.1 - 2007/06/26

Bugs New Methods + some minor improvements

Version 1.0 - 2007/05/28