Transform3D getCurrentChildLocalToVworld(HashKey key) { if (!inSharedGroup) { return childLocalToVworld[0][childLocalToVworldIndex[0][NodeRetained.CURRENT_LOCAL_TO_VWORLD]]; } else { int i = key.equals(localToVworldKeys, 0, localToVworldKeys.length); if(i>= 0) { return childLocalToVworld[i] [childLocalToVworldIndex[i][NodeRetained.CURRENT_LOCAL_TO_VWORLD]]; } } return new Transform3D(); }
SensorBinding(Sensor sensor) { this.sensor = sensor ; buttons = new int[sensor.getSensorButtonCount()] ; read = new Transform3D() ; }
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()); } });
private void getCoexistenceToViewPlatform(CanvasInfo ci) { if (ci.updateCoeToViewPlatform) { if (verbose) System.err.println("updating CoeToViewPlatform") ; if (ci.coeToViewPlatform == null) ci.coeToViewPlatform = new Transform3D() ; getViewPlatformToCoexistence(ci) ; ci.coeToViewPlatform.invert(ci.viewPlatformToCoe) ; ci.updateCoeToViewPlatform = false ; if (verbose) t3dPrint(ci.coeToViewPlatform, "coeToVp") ; } }
/** * Sets the texture transform object used to transform texture * coordinates. A copy of the specified Transform3D object is * stored in this TextureAttributes object. * @param transform the new transform object */ final void setTextureTransform(Transform3D transform) { this.transform.set(transform); sendMessage(TRANSFORM_CHANGED, new Transform3D(transform), null); }
/** Creates a transform with the 4 given vectors: X, Y, Z and translation of origin. */ static public Transform3D createTransform(final Vector3d[] o) { return new Transform3D(new Matrix4d( // X Y Z Trans o[0].x, o[1].x, o[2].x, o[3].x, o[0].y, o[1].y, o[2].y, o[3].y, o[0].z, o[1].z, o[2].z, o[3].z, 0, 0, 0, 1)); }
@Override public void writeObject( DataOutput out ) throws IOException { super.writeObject( out ); Transform3D trans = new Transform3D(); ((TransformGroup)node).getTransform( trans ); double[] matrix = new double[16]; trans.get( matrix ); for(int i=0; i<16; i++) out.writeDouble( matrix[i] ); }
@Override public void transformationUpdated(final Matrix4f mat) { univ.fireTransformationStarted(); c.setTransform(new Transform3D(mat)); univ.fireTransformationFinished(); }
public void setTranslation(final float dx, final float dy, final float dz) { final Transform3D t = new Transform3D(); t.setTranslation(new Vector3f(dx, dy, dz)); setTransform(t); }
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 public void oked(final Matrix4f mat) { final Transform3D t = new Transform3D(mat); final float[] v = new float[16]; t.get(v); univ.setUseToFront(useToFront); record(APPLY_TRANSFORM, affine2string(v)); }
/** * Stores the matrix which transforms this VoltexGroup to the image plate in * the specified Transform3D. * * @param toImagePlate */ public void volumeToImagePlate(final Transform3D toImagePlate) { final Transform3D toVWorld = new Transform3D(); renderer.getVolumeNode().getLocalToVworld(toVWorld); toImagePlate.mul(toVWorld); }
boolean intersect(Transform3D thisLocalToVworld, Bounds targetBound) { Bounds transBound = (Bounds) targetBound.clone(); Transform3D t3d = new Transform3D(); t3d.invert(thisLocalToVworld); transBound.transform(t3d); return intersect(transBound); }
public static void setTransform(final String transform) { final Image3DUniverse univ = getUniv(); if (univ != null && univ.getSelected() != null) { final String[] s = ij.util.Tools.split(transform); final float[] m = new float[s.length]; for (int i = 0; i < s.length; i++) { m[i] = Float.parseFloat(s[i]); } univ.getSelected().setTransform(new Transform3D(m)); univ.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);
Transform3D lookAt = new Transform3D(); lookAt.lookAt( new Point3d( 0.0, 0.0, 1.0 ) , new Point3d( 0.0, 0.0, 0.0 ) , new Vector3d( 0.0, 1.0, 0.0) ); lookAt.invert();
public void saveTransform(final Content c) { if (!checkSel(c)) return; final Transform3D t1 = new Transform3D(); c.getLocalTranslate().getTransform(t1); final Transform3D t2 = new Transform3D(); c.getLocalRotate().getTransform(t2); t1.mul(t2); final float[] matrix = new float[16]; t1.get(matrix); if (new TransformIO().saveAffineTransform(matrix)) record(SAVE_TRANSFORM, affine2string(matrix)); }
/** * 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); }