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.

Re: Custom auto rotation

Hi Bill,

 Hibbard wrote:
Hi Ugo,


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)).

...

/*
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));


Try reversing the order of the multiply:

  display.getProjectionControl()
   .setMatrix(display.multiply_matrix(matrix, mult));

That should move the Z-axis rotation to a different
coordinate system.

If that doesn't solve the problem, please let us know
what it does.

Hmm, how shall I explain what it does?

It does E.X.A.C.T.L.Y. what I wanted!

Thanks a lot!

Ugo
PS.: the original code was in Test57

Cheers,
Bill


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: