Hi,
I'd like to define a trajectory through 3D space and visualize the scene
(with 3D terrain, wind vectors, clouds...) from the perspective of an
observer moving along that trajectory. A hint from Bill via Steve
suggested ProjectionControl.setMatrix.
Am I correct in assuming that the nature of that matrix is that of
javax.vecmath.Matrix4d? I was able to rotate the display using
Matrix4d.rotX (with the side effect of zooming in also) but the display
returned to its default orientation as soon as I clicked on it with the
mouse.
What exactly is the nature of this matrix? How would you recommend
modifying the matrix to effect a rotation, translation, or zoom? In
other words, how can I programmatically control the same effects that
are already tied to the mouse?
Here's the method I'm testing with:
public static void doRotation(DisplayImpl display)
throws Exception
{
ProjectionControlJ3D pc = new ProjectionControlJ3D(display);
double[] m = pc.getMatrix();
Matrix4d matrix = new Matrix4d(m);
double angle = 1.0;
matrix.rotX(angle);
// there ought to be a Matrix4d method to do this?
int k = 0;
for(int row=0;row<4;row++){
for(int col=0;col<4;col++){
m[k++] = matrix.getElement(row,col);
}
}
pc.setMatrix(m);
}
Thanks,
Doug
--
*----------------------------------------------------------------------*
| Doug Lindholm, Software Engineer | E-mail: lind@xxxxxxxx |
| Research Applications Program | Phone: 303-497-8374 |
| National Center for Atmospheric Research | |
| P.O. Box 3000 | There's no place |
| Boulder, Colorado 80307-3000 | like $HOME |
*----------------------------------------------------------------------*