Custom auto rotation

Hello all,

First we need a bit of maths background to understand my problem.

I have a 3D display which originally is in the default position. Imagine a vector (u,v,w) which is perpendicular to the xy-plane - that is, is also parallel to the display's own z-axis. Now, I rotate the display and this vector changes (with respect to the original vector, which I'm calling (x,y,z)).

The "problem" is that I have a cute little button which says "Auto Rotate" and is supposed to auto-rotate the display around a fixed axis (the *display's* z axis, in my case).

The code to do this is:

// get the proj. control matrix
double[] matrix = display.getProjectionControl().getMatrix();

// the rotation matrix
double[] mult = display.make_matrix(
  rotX,
  rotY,
  rotZ,
  scale,
  transX,
  transY,
  transZ);

/*
where everything is zero, except rotZ = 1.0 and scale = 1.0
This is what rotates the display; when in a loop -> auto rotation:
*/
display.getProjectionControl()
  .setMatrix(display.multiply_matrix(mult, matrix));

The result of this is rotation around the original z-axis and not the display's z (called here the w axis).

What I first need to do, is to use the projection matrix to apply a transformation from (x,y,z) to (u,v,w)

(Proj.Matrix (3 x 3)) X (0,0,1) = (new rotation vector) = (x',y',z')

and then use x',y' and z' in my mult matrix above. Isn't that right?

if (true){

  Is there a way to do this in VisAD? (I mean, without using JAMA.)
  Has anyone done that?

}else
What am I doing wrong? (I mean, apart from programming gimmicks to impress the public, rather than doing all the work pilling up on my desk ;-)

Thanks in advance.

Ugo


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