pla.setCoordinates(0, plaPts); Shape3D plShape = new Shape3D(pla, app); TransformGroup objRotate = new TransformGroup(); objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRotate.addChild(plShape);
TransformGroup objRotate = new TransformGroup(); objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRotate.addChild(plShape);
TransformGroup objRotate = new TransformGroup(); objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRotate.addChild(plShape);
Shape3D plShape = new Shape3D(pla, app); TransformGroup objRotate = new TransformGroup();
sh.setAppearance(app); sh.setPickable(true); TransformGroup objRotate = new TransformGroup(); objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRotate.addChild(sh);
st.stripify(ginfo); TransformGroup objRotate = new TransformGroup(); objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRotate.addChild(sh);
@Override protected org.scijava.java3d.SceneGraphObject createNode() { return new TransformGroup(); }
private void attachCone(float size) { Cone cone = new Cone(size, size* 2); // The group for rotation arrowheadRotationGroup = new TransformGroup(); arrowheadRotationGroup. setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); arrowheadRotationGroup.addChild(cone); // The group for positioning the cone arrowheadPositionGroup = new TransformGroup(); arrowheadPositionGroup. setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); arrowheadPositionGroup.addChild(arrowheadRotationGroup); super.addChild(arrowheadPositionGroup); }
TransformGroup modelGroup = new TransformGroup(); modelGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); modelGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); JButton resetButton = new JButton(); resetButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { modelGroup.setTransform( new Transform3D()); } });
TransformGroup modelGroupReset = new TransformGroup(); TransformGroup modelGroup = new TransformGroup(); modelGroupReset.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); modelGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); modelGroupReset.addChild(modelGroup); JButton resetButton = new JButton(); resetButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Transform3D t3d = new Transform3D(); modelGroup.getTransform(t3d); t3d.invert(); modelGroupReset.setTransform(t3d); } });
TransformGroup obj = new TransformGroup(); Scene s = null; ObjectFile f = new ObjectFile (); f.setFlags (ObjectFile.RESIZE | ObjectFile.TRIANGULATE | ObjectFile.STRIPIFY); try{ s = f.load (obj_path+model+"\\"+model+".obj"); }catch(Exception ex) { ex.printStackTrace(); } obj.addChild(s.getSceneGroup()); obj.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
/** * Creates a PickMouseBehavior given current canvas, root of the tree to * operate on, and the bounds. */ public PickMouseBehavior(Canvas3D canvas, BranchGroup root, Bounds bounds){ super(); currGrp = new TransformGroup(); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); root.addChild(currGrp); pickCanvas = new PickCanvas(canvas, root); }
/** * Creates a PickMouseBehavior given current canvas, root of the tree to * operate on, and the bounds. */ public PickMouseBehavior(Canvas3D canvas, BranchGroup root, Bounds bounds){ super(); currGrp = new TransformGroup(); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); root.addChild(currGrp); pickScene = new PickObject(canvas, root); }
/** * Creates a PickMouseBehavior given current canvas, root of the tree to * operate on, and the bounds. */ public PickMouseBehavior(Canvas3D canvas, BranchGroup root, Bounds bounds){ super(); currGrp = new TransformGroup(); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); root.addChild(currGrp); pickCanvas = new PickCanvas(canvas, root); }
TransformGroup translate(Node node,Vector3f vector){ Transform3D transform3D = new Transform3D(); transform3D.setTranslation(vector); TransformGroup transformGroup = new TransformGroup(); transformGroup.setTransform(transform3D); transformGroup.addChild(node); return transformGroup; } for(int i=0;vec[i];i++) translate(Your_Object,new Vector3f(x,y,vec[i]); //do this while you still have elements in your vector. //you may want to set a value, let's say 2500 that indicates that you ran out of objects //in that case, you will have for(int i=0;vec[i]!=2500;i++)
PlatformGeometry pg = new PlatformGeometry(); TransformGroup objScale = new TransformGroup(); Transform3D t3d = new Transform3D(); t3d.setTranslation(new Vector3f(0f, 0f, -1f)); objScale.setTransform(t3d); Text2D text = new Text2D("Text to display", Cell.BLACK, "Verdana", 18, 1); objScale.addChild(text); pg.addChild(objScale); simpleUniverse.getViewingPlatform().setPlatformGeometry(pg);
// The transform group that moves the cube TransformGroup tgThatMovesTheCube = new TransformGroup(); tgThatMovesTheCube .addChild(new ColorCube(0.4)); // The transform group that "attaches" the sphere to the cube: TransformGroup tgThatAttachesTheSphere = new TransformGroup(); tgThatAttachesTheSphere.addChild(new Sphere(...)); // The transform of this transform group: It is a transform // that moves the sphere (from its original position) to // one side of the cube (at its original position) Transform3D attachingTransform = new Transform3D(); attachingTransform.setTranslation(new Vector3f(1,0,0)); tgThatAttachesTheSphere.setTransform(attachingTransform); // Attach the transformed (!) sphere to the same TG as the cube: tgThatMovesTheCube.addChild(tgThatAttachesTheSphere);
TransformGroup moveGroup = new TransformGroup(); Transform3D move = new Transform3D(); move.setTranslation(new Vector3f(0.0f, 0.0f, -10.0f)); //^^ set the Vector3f to where you want the object to be moveGroup.setTransform(move); moveGroup.addChild(YOUR_OBJECT);
TransformGroup getNewBox(float hpos) { Cuboid box = new Cuboid(0.03f, 0.03f, 0.03f, cubeAppearance); TransformGroup tg = new TransformGroup(); Transform3D transform = new Transform3D(); Vector3f vector = new Vector3f(0f, hposf, 0f); transform.setTranslation(vector); tg.addChild(box); tg.setTransform(transform); return tg; } { rootGroup.addChild(getNewBox(0f); rootGroup.addChild(getNewBox(0.3f); rootGroup.addChild(getNewBox(0.6f); rootGroup.addChild(getNewBox(0.9f); }
public void addVertex(Image3DUniverse univ, Color3f color, float x, float y, float z) { BranchGroup bg = new BranchGroup(); bg.setCapability(BranchGroup.ALLOW_DETACH); TransformGroup tg = new TransformGroup(); Transform3D t3d = new Transform3D(); t3d.setTranslation(new Vector3f(x, y, z)); tg.setTransform(t3d); bg.addChild(tg); Appearance app = new Appearance(); ColoringAttributes cattr = new ColoringAttributes(); cattr.setColor(color); app.setColoringAttributes(cattr); tg.addChild(new Sphere(0.1f, app)); univ.getScene().addChild(bg); }