import java.applet.Applet; import java.awt.*; import com.sun.j3d.utils.geometry.ColorCube; import com.sun.j3d.utils.universe.SimpleUniverse; import javax.media.j3d.*; import javax.vecmath.*; public class Kuup4 extends Applet { public Kuup4() { setLayout(new BorderLayout()); Canvas3D c = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); add(c, BorderLayout.CENTER); BranchGroup juur = new BranchGroup(); Transform3D tr1=new Transform3D(); tr1.rotX(Math.PI*2/3); tr1.setTranslation(new Vector3d(0.5, 0, 0)); TransformGroup tg1=new TransformGroup(tr1); juur.addChild(tg1); tg1.addChild(new ColorCube(0.2)); juur.addChild(new ColorCube(0.1)); juur.compile(); SimpleUniverse u = new SimpleUniverse(c); u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(juur); } public static void main(String[] args) { Frame f=new Frame("Keeratud kuup"); f.add(new Kuup4()); f.setSize(300, 300); f.setVisible(true); } }