NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Robert Here is how I do something similar: private double [] pcMatrix; ProjectionControl projControl = localDisplay.getProjectionControl(); pcMatrix = projControl.getMatrix(); /** * Change point of view of a VisAD display, * using user's input angles (unit = degree). * Preserves initial scaling and aspect ratios. View from * "southwest" has azimuth of 225 and decAngle say 45 or so. * * @param azimuth azimuth from "north," clockwise, 0 to 360 * @param decAngle tilt angle down from upward vertical. 0-180 * */ private void rotateView(double azimuth, double decAngle) { // 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 = navDisplay.getDisplay().make_matrix (0.0, 0.0, zAngle, 1.0, 0.0, 0.0, 0.0); double [] combo = navDisplay.getDisplay().multiply_matrix (aziMatrix, pcMatrix); // rotate in x double [] decMatrix = navDisplay.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 = navDisplay.getDisplay().multiply_matrix (decMatrix, combo); projControl.setMatrix(combo2); } catch (Exception exp) { System.out.println(" rotate view got "+exp); } } Stuart Wier UCAR Unidata Program wier@xxxxxxxxxxxxxxxx P.O. Box 3000 http://www.unidata.ucar.edu/staff/wier Boulder, CO 80307
visad
archives: