Hi,

HAroldo Pereira wrote:

>     BranchGroup createViewGraph(SimpleUniverse u, Canvas3D c3d, int num) {
>         BranchGroup viewRoot = new BranchGroup();
>
>         TransformGroup offTg = new TransformGroup();
>         offTg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
>         viewRoot.addChild(offTg);
>
>         TransformGroup offTg2 = new TransformGroup();
>         offTg2.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
>         offTg.addChild(offTg2);
>
>         // use same view distance as main view
>         Viewer viewer = u.getViewer();
>         double viewDistance = viewer.getView().getFieldOfView();
>         // Calculate the distance from the to the imageplate.
>         viewDistance = 1.0/Math.tan(viewDistance/2.0);
>
>         Transform3D offset = new Transform3D();

  offset.setTranslation(new Vector3d(0, 0, viewDistance));
  offTg2.setTransform(offset);

        if (num == 0) {   // VIEWPOINT 2 : LEFT VIEW
            offset.rotY(Math.PI/2);
            offTg.setTransform(offset);
        }
        else {           // VIEWPOINT 3 : RIGHT VIEW
            offset.rotY(-Math.PI/2);
            offTg.setTransform(offset);
        }

>         PhysicalBody physicalBody = new PhysicalBody();
>         PhysicalEnvironment physicalEnvironment = new PhysicalEnvironment();
>         ViewPlatform viewPlatform = new ViewPlatform();
>         offTg2.addChild(viewPlatform);
>
>         View view = new View();
>         view.addCanvas3D(c3d);
>         view.setPhysicalBody(physicalBody);
>         view.setPhysicalEnvironment(physicalEnvironment);
>         view.attachViewPlatform(viewPlatform);
>
>         return viewRoot;
>     }

Thats how it should be. You simply forgot to move out of the cube.

and you should better rotate around the Y-Axis if you want views from left and
right. (and btw: 90 degrees is PI/2 ;-)

Best Regards,

Andreas

===========================================================================
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".

Reply via email to