/** * Positions and reorients the ViewingPlatform to its "home" transform. * @since Java 3D 1.3 */ public void goHome() { if (targetTG != null && homeTransform != null) targetTG.setTransform(homeTransform); } }
public void setRadius(final float radius) { this.radius = radius; scale.set(radius); scaleTG.setTransform(scale); }
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()); } });
@Override public void readObject( DataInput in ) throws IOException { super.readObject( in ); Transform3D trans = new Transform3D(); double[] matrix = new double[16]; for(int i=0; i<16; i++) matrix[i] = in.readDouble(); trans.set( matrix ); ((TransformGroup)node).setTransform( trans ); }
public void setCenter(final Point3f center) { this.center.set(center); final Vector3f translateV = new Vector3f(center); translate.set(translateV); translateTG.setTransform(translate); }
@Override protected void endAction(Sensor s) { super.endAction(s) ; viewPlatformToVworld.normalize() ; targetTG.setTransform(viewPlatformToVworld) ; if (rotationCoords == HEAD) { view.setUserHeadToVworldEnable(false) ; } }
public void setPosition(final float x, final float y) { this.x = x; this.y = y; final Transform3D p = new Transform3D(); p.setTranslation(new Vector3f(x, y, 0.0f)); positionTG.setTransform(p); }
@Override protected void endAction(Sensor s) { super.endAction(s) ; viewPlatformToVworld.normalize() ; targetTG.setTransform(viewPlatformToVworld) ; if (rotationCoords == HEAD) { view.setUserHeadToVworldEnable(false) ; } if (s != null && readAction6D == ECHO) { eventAgent.addSensorReadListener(s, echoReadListener6D) ; } }
/** * Rotate the univere so that the user looks in the negative direction of the * z-axis. */ public void rotateToNegativeXY() { fireTransformationStarted(); getRotationTG().setTransform(new Transform3D()); fireTransformationFinished(); }
TransformGroup viewingTransformGroup = simpleUniv.getViewingPlatform().getViewPlatformTransform(); Transform3D viewingTransform = new Transform3D(); Point3d eye = viewersLocation; Point3d center = gazePoint; Vector3d up = new Vector3d(0,1,0); //assumes +y-axis points up viewingTransform.lookAt(eye, center, up); viewingTransform.invert(); viewingTransformGroup.setTransform(viewingTransform);
/** Set the transforms for zoom, pan, and rotation. */ public void setGlobalTransform(final GlobalTransform transform) { final MultiTransformGroup group = getViewingPlatform().getMultiTransformGroup(); final int num = group.getNumTransforms(); if (transform.transforms == null || transform.transforms.length != num) throw new RuntimeException( "Internal 3D Viewer error"); for (int i = 0; i < num; i++) group.getTransformGroup(i).setTransform(transform.transforms[i]); waitForNextFrame(); fireTransformationUpdated(); }
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);
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);
/** * Rotate the univere so that the user looks in the positive direction of the * z-axis. */ public void rotateToPositiveXY() { fireTransformationStarted(); getRotationTG().setTransform(new Transform3D()); waitForNextFrame(); rotateUniverse(new Vector3d(0, 1, 0), Math.PI); }
/** * Rotate the univere so that the user looks in the negative direction of the * y-axis. */ public void rotateToNegativeXZ() { fireTransformationStarted(); getRotationTG().setTransform(new Transform3D()); waitForNextFrame(); rotateUniverse(new Vector3d(1, 0, 0), Math.PI / 2); }
/** * Rotate the univere so that the user looks in the positive direction of the * y-axis. */ public void rotateToPositiveXZ() { fireTransformationStarted(); getRotationTG().setTransform(new Transform3D()); waitForNextFrame(); rotateUniverse(new Vector3d(0, 1, 0), -Math.PI / 2); }
/** * Rotate the univere so that the user looks in the positive direction of the * x-axis. */ public void rotateToPositiveYZ() { fireTransformationStarted(); getRotationTG().setTransform(new Transform3D()); waitForNextFrame(); rotateUniverse(new Vector3d(1, 0, 0), -Math.PI / 2); }
/** * Rotate the univere so that the user looks in the negative direction of the * x-axis. */ public void rotateToNegativeYZ() { fireTransformationStarted(); getRotationTG().setTransform(new Transform3D()); waitForNextFrame(); rotateUniverse(new Vector3d(0, 1, 0), Math.PI / 2); }
public void setLength(final float l) { this.length = l; lineShape.setGeometry(createLineGeometry()); textShape.setGeometry(createTextGeometry()); final Transform3D d = new Transform3D(); d.setTranslation(new Vector3f(length / 2, -length / 2, 0.0f)); textTG.setTransform(d); }
private static final void setGlobalTransform(final Image3DUniverse u, final GlobalTransform transform) { u.getGlobalTransform(old); if (equals(old, transform)) return; final MultiTransformGroup group = u.getViewingPlatform().getMultiTransformGroup(); final int num = group.getNumTransforms(); for (int i = 0; i < num; i++) group.getTransformGroup(i).setTransform(transform.transforms[i]); u.fireTransformationUpdated(); }