import java.applet.Applet; import java.awt.*; import com.sun.j3d.utils.geometry.*; import com.sun.j3d.utils.universe.SimpleUniverse; import javax.media.j3d.*; import javax.vecmath.*; public class Silinder extends Applet { public Silinder() { 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); //keeramine tr1.setTranslation(new Vector3d(0, 0, -1)); TransformGroup tg1=new TransformGroup(tr1); juur.addChild(tg1); Cylinder s1=new Cylinder(0.2f, 1.2f); //raadius, pikkus s1.setAppearance(new Appearance()); tg1.addChild(s1); juur.compile(); SimpleUniverse u = new SimpleUniverse(c); u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(juur); } public static void main(String[] args) { Frame f=new Frame("Kaks kuupi"); f.add(new Silinder()); f.setSize(300, 300); f.setVisible(true); } }