- All Implemented Interfaces:
public class Transform3Dextends TransformA transform that encodes a 3D view of an exhibit and the projection of that view onto a 2D view plane. This class inherits the window-to-viewport transformation from its superclass, and adds a 3D viewing transformation.
The projection is defined by three unit vectors: ViewDirection, ImagePlaneYDirection, and ImagePlaneXDirection. The ViewDirection is determined by the viewpoint that is specified for the view; ViewDirection is a unit vector that points in the direction from the viewpoint towards (0,0,0). The ViewDirection determines the viewing plane, which is a plane through (0,0,0) normal to the view direction. The ImagePlaneYDirection vector is obtained by projecting a "view up" vector onto the viewing plane, and then normalizing the projection. Initially, the view up vector is (0,0,1) or, if (0,0,1) almost normal to the view plane, (0,1,0). When the viewpoint is modified, the new ImagePlaneYDirection is obtained by using the previous ImagePlaneYDirection as the view up vector, if possible. After the ViewDirection and ImagePlaneYDirection are determined, the ImagePlaneXDirection is simply the cross product of these two vectors.
The transform also has an associated "focalLength" which is set to the distance of the viewpoint from the origin, and a clipDistance, which is set to 25% of the focal length.
A Transform3D fires a ChangeEvent when any part of the data that determines a 3D view is changed, such as the viewpoint.
(Note that in the default view, the yz-plane projects onto the screen, and the x-axis is perpendicular to the screen. Nevertheless, the screen is thought of as being the xy-plane.) TODO: Possibly add support for using a point other than (0,0,0) as the view reference point; check how clip distance and focal length should be changed when viewpoint is changed.