165

Transforming shapes
TransformGroup example code

  • Build a shape, as before
    Shape3D myShape = new Shape3D( myGeom, myAppear );

  • Create a 3D transform for a Z-axis rotation by 30 degrees (0.52 radians)
    Transform3D myTrans3D = new Transform3D( );
    myTrans3D.rotZ( 0.52 ); // 30 degrees

  • Create a transform group, set the transform, and add the shape
    TransformGroup myGroup = new TransformGroup( );
    myGroup.setTransform( myTrans3D );
    myGroup.addChild( myShape );