Restoring cube to startup orientation

Figuring I'm not the only one who wants to be able to return the VisAD
display cube to it's original position, size, and orientation, here's
how to do it.

   double[] pcMatrix;
   .....
   di = new DisplayImplJ3D("display1");
   pc = di.getProjectionControl();
   pcMatrix = pc.getMatrix();

and then whenever you want to have the cube reset, just:

   pc.setMatrix(pcMatrix);

(In my application, this was the action for a button in the  GUI 
so the user could return to a set view.)

Also, if you'd like to force the cube to be a different size, you can
rescale it; right after the "pc.getMatrix()" call, do this:

   pcMatrix[0] = scale;
   pcMatrix[5] = scale;
   pcMatrix[10] = scale;

where a value of .9 scales it to occupy 90% of the size of the display
window.

--
Tom Whittaker  (tomw@xxxxxxxxxxxxx)
University of Wisconsin-Madison
Space Science and Engineering Center
Phone/Voicemail: 608/262-2759  
Fax: 608/263-6738

  • 1999 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: