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 Kuup5a extends Applet { public Kuup5a() { setLayout(new BorderLayout()); Canvas3D c = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); add(c, BorderLayout.CENTER); BranchGroup juur = new BranchGroup(); TransformGroup tg1=new TransformGroup(); tg1.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); Transform3D suund=new Transform3D(); // suund.rotZ(Math.PI/2); //keerab ümber z-telje Alpha a=new Alpha(-1, Alpha.INCREASING_ENABLE | Alpha.DECREASING_ENABLE , 0, 2000, 2000, 2000, 0, 2000, 2000, 0); float[] ajad={0, 0.7f, 1}; Point3f[] punktid={ new Point3f(0, 0, 0), new Point3f(1, 0, 0), new Point3f(0, 1, 0) }; Quat4f[] qd={ new Quat4f(0, 0, 0, 1), //ümber x, y ning z-telje. Viimane näitab, kuidas arvestatase. new Quat4f(0, 0, 1, 1), new Quat4f(0, 0, 0, 1) }; RotPosPathInterpolator liigutaja1= new RotPosPathInterpolator(a, tg1, suund, ajad, qd, punktid); liigutaja1.setSchedulingBounds(new BoundingSphere()); juur.addChild(tg1); tg1.addChild(liigutaja1); tg1.addChild(new ColorCube(0.2)); juur.compile(); SimpleUniverse u = new SimpleUniverse(c); u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(juur); } public static void main(String[] args) { Frame f=new Frame("Liikuv ka keerav kuup"); f.add(new Kuup5a()); f.setSize(300, 300); f.setVisible(true); } }