Try this
public void setViewpoint(int showAllAxis) {
Transform3D viewTrans = new Transform3D();
Point3d eyePos = new Point3d(center);
Vector3d up = new Vector3d();
switch( showAllAxis ) {
case 0 :
eyePos.x += eyeDist;
up.y = 1;
break;
case 1 :
eyePos.y += eyeDist;
up.z = -1;
break;
case 2 :
eyePos.z += eyeDist;
up.y = 1;
break;
case 3 :
eyePos.x -= eyeDist;
up.y = 1;
break;
case 4 :
eyePos.x += (2d*eyeDist)/3d;
eyePos.y += eyeDist/3d;
eyePos.z += eyeDist/3d;
//up.x = -0.66;
up.y = 0.66;
up.z = -0.33;
break;
case 5 :
eyePos.z -= eyeDist;
up.y = 1;
break;
}
viewTrans.lookAt( eyePos, center, up );
viewTrans.invert();
jumpTransformGroup.setTransform(viewTrans);
}
At 03:52 AM 9/6/2002 -0600, you wrote:
>I am new to Java 3D and have a simple problem to solve - that I can't!
>All I'm trying to do is change the view position around the origin by
>clicking buttons, so I change from the default (+ve Z) front view, to the
>side, back, top and bottom views.
>
>I can transform the view using the Transform3D:
>
> Transform3D t3d = new Transform3D();
> simpleU.getViewingPlatform().getViewPlatformTransform().getTransform(t3d);
> float[] transformMatrixView = new float[16];
> t3d.get(transformMatrixView);
> float x = transformMatrixView[3];
> float y = transformMatrixView[7];
> float z = transformMatrixView[11];
>
> transformMatrixView[3] = x+0.5f;
> transformMatrixView[7] = y+0.5f;
> transformMatrixView[11] = z+0.5f;
>
> t3d.set(transformMatrixView);
> simpleU.getViewingPlatform().getViewPlatformTransform().setTransform(t3d);
>
>This works, BUT i also need to rotate the view in order to see the object
>in the origin.
>
>I have tried using:
>
>t3d.rotX(Math.toRadians(180));
>
>But everything just dissappears from view with any value of rotation.
>
>PLEASE help.
>
>TIA
>
>Andrew
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JAVA3D-INTEREST". For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
********************
Jack S. Gundrum
Visualization Group
Research Support
Academic Services and Emerging Technology Systems
Information Technology Services
Penn State University
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".