setLayout(new BorderLayout());
Canvas3D c = new Canvas3D(null);
add("Center", c);
Viewer viewer = new Viewer(c);
Vector3d viewpoint = new Vector3d(0.0,0.0,2.41);
//初始观察点位置
Transform3D t = new Transform3D();
t.set(viewpoint);
ViewingPlatform v = new ViewingPlatform( );
v.getViewPlatformTransform().setTransform(t);
u = new SimpleUniverse(v,viewer);
u.getViewingPlatform();
ViewingPlatform viewingPlatform = u.getViewingPlatform();
OrbitBehavior orbit = new OrbitBehavior(c, OrbitBehavior.REVERSE_ALL);
BoundingSphere bounds =
new BoundiBoundingSpherengSphere(new Point3d(0.0, 0.0, 0.0), 100.0);
orbit.setSchedulingBounds(bounds);
viewingPlatform.setViewPlatformBehavior(orbit);
….
Public class HelloUniverse extends Applet {
private SimpleUniverse u = null;
public BranchGroup createSceneGraph() {
BranchGroup objRoot = new BranchGroup();
….
return objRoot;
}
public void init() {
Canvas3D c = new Canvas3D(config);
add("Center", c);
….
u.addBranchGraph(scene);
}
….
}