Can Canvas3D rotate like Objects in TransformGroup

By Using MouseRotate , we can rotate objects in TransformGroup, but how can we make the Canvas3D rotate together? Thus if rotated, a circle drawn in the Canvas3D appear to be a oval to the man . will you please help me?

The Canvas3D it self can’t be rotated in the manner. I think what you want it to rotate the view. The view simple contains a TransformGroup and hence can be rotated in the same manner as everything else. Just look around at the classes View and ViewPlatform.

Kev

If I rotate the view, it seems that Canvas3D and man’s View both rotate, and the position between them is not changed. This is not what I want. I mean if there is a way to make the result that Canvas3D rotate together with the objects in scene while the view dosen’t rotate relatively.Then if rotated, a circle drawn in the Canvas3D appear to be a oval to the man

In that case, I don’t think there is… what might possible be able to do something with AffineTransform(s) and the Graphics2D of Canvas3D.

Kev

There is no way? Please help me to think out some method to rotate the Canvas3D. Thanks!

I do like this:

MouseRotate behavior=new MouseRotate();

u.getLocale().removeBranchGraph(u.getViewingPlatform()); // u — SimpleIniverse

behavior.setTransformGroup(u.getViewingPlatform().getViewPlatformTransform());

behavior.setSchedulingBounds(bounds);

u.getViewingPlatform().addChild(behavior);

u.getLocale().addBranchGraph(u.getViewingPlatform());

By doing this , I can rotate the view. Then the object in TransformGroup rotate relatively.Because Canvas3D is associated with ViewPlatform, so Canvas3D rotate with the view? then to the view Canvas3D doesn’t rotate unlike objects in TransformGroup. How can I solve this to make Canvas3D rotate relatively to view?

I’m a bit confused here, or possibly you are, I’m not sure. That’s how confused I am.

The Canvas3D is the rectangular component in your application that displays the 3D view. This is equivalent to, for example, a television screen.

The View is the element of the 3D world that lets us see it - in the example this could be thought of as a camera plugged into the television screen.

What you seem to be asking is how you could keep the camera pointed one way and rotate the television, but I don’t think that is what you mean. It is easiest to think of the view as your entry point into the world and not distinguish it from your Canvas3d.

Are you asking how to rotate an object in the scene and have the ViewPlatform rotate with the object?

As you say: Are you asking how to rotate an object in the scene and have the ViewPlatform rotate with the object?
If I do so, the object in the scene seems not to rotate because the WiewPlatform rotate together. Do you think so?

what I am asking is how I could keep the View (camera)pointed one way and rotate the Canvas3D (television),or rotate the View while keeping the Canva3D stay. Thus the object in the scene and Canvas3D seem to rotate together. Therefore, if I rotate the scene, then draw a circle on J3DGraphics2D of the Canvas3D, it looks like an oval (In fact, it is a circle. ). Like this:
J3DGraphics2D draw=c.getGraphics2D(); // c-- Canvas3D
draw.drawOval(10,10,50,50);
// In fact a circle, but it looks like an oval if Canvas3D( or J3DGraphics2D) can be rotated.

I am anxious to know how I can do this. I need your help! Thanks!!!

Right, I think I have worked it out now.

No. You can’t rotate the actual Canvas in the application any more than you can rotate a JButton or any other user interface component.

It may be possible to create a custom Canvas3D component that only draws ever second vertical column to create the impression of having twisted the canvas itself, but that would be way outside my skills. I’m not sure if it’s feasible in Java3D but certainly another way you might try is to offscreen render the scene to a texture on an on-screen object within a second scene that can then be rotated as you want.

I’m still not really sure what you’re trying to get to, but if you want to manipulate graphics contexts you can use:

Graphics.setTransform()

You may need to create a transform that fits what you want to do.

Kev