167

Transforming shapes
TransformGroup example code

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

  • Create a 3D transform for scaling by 1.5 in X, Y, and Z
    Transform3D myTrans3D = new Transform3D( );
    myTrans3D.set( 1.5 );

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