Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
John- In addition to Curtis's suggestions, look at ProjectionControlJ3D.setOrthoView() for predefined views of each cube face. Also, here's some code we use to move to any view: /** * Change point of view of a 3D VisAD display, * using user's input angles (unit = degree): * For example, a view from the * southwest has azimuth of 225 and decAngle say 20 to 70 or so. * Preserves initial scaling and aspect ratios. * * @param azimuth azimuth from "north," clockwise, 0 to 360 * @param decAngle tilt angle down from upward vertical. 0-180 * */ public void rotateView(double azimuth, double decAngle) { if (getDisplayMode() != MODE_3D) return; // trap input bad values - not necessary since trig // functions handle values outside of 0-360 properly. // rotation around z axis, made from user's "azimuth" double zAngle = 180.0 - azimuth; try { // rotate in z double[] aziMatrix = getDisplay().make_matrix(0.0, 0.0, zAngle, 1.0, 0.0, 0.0, 0.0);double[] combo getDisplay().multiply_matrix(aziMatrix, getProjectionMatrix());
// rotate in x double[] decMatrix = getDisplay().make_matrix(decAngle, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0); // total rotation matrix is computed and applied double[] combo2 getDisplay().multiply_matrix(decMatrix, combo); setProjectionMatrix(combo2); } catch (Exception exp) { System.out.println(" rotate view got " + exp); getProjectionMatrix() and setProjectionMatrix() are just wrappers around ProjectionControl.getMatrix() and PC.setMatrix(). Don John Osborne wrote:
Is it possible to change the orientation of a 3D display programatically? I want the user, for example, to be able to view just the xy face of a 3D plot (or any other face as well). I also want the user to be able specify the orientation of the plot axes in 3-space and add the ability to wobble or rock a plot. I have been poking around in the VisAD JavaDoc but haven't found anything that seem to do this. TIAJohn Osborne NOAA/PMEL
-- ************************************************************* Don Murray UCAR Unidata Program dmurray@xxxxxxxxxxxxxxxx P.O. Box 3000 (303) 497-8628 Boulder, CO 80307 http://www.unidata.ucar.edu/staff/donm *************************************************************
visad
archives: