public void getLocalRotate(final Transform3D t) { localRotate.getTransform(t); }
public void getLocalTranslate(final Transform3D t) { localTranslate.getTransform(t); }
/** * Retrieves the manual translation vector of the view. * * @param v */ public void getTranslateTranslation(final Vector3d v) { translateTG.getTransform(tmp); tmp.get(v); }
/** * Retrieves the translation vector which is responsible for centering the * view. * * @param v */ public void getCenterTranslation(final Vector3d v) { centerTG.getTransform(tmp); tmp.get(v); }
/** * Retrieves the translation vector which is responsible for the current * zooming and stores it in the given Vector3d. * * @param v */ public void getZoomTranslation(final Vector3d v) { zoomTG.getTransform(tmp); tmp.get(v); }
/** * Gets the scale from physical units to view platform units. */ protected double getPhysicalToViewPlatformScale() { double vpToVirtualScale ; targetTG.getTransform(t3dTmp) ; t3dTmp.get(m16Tmp) ; vpToVirtualScale = Math.sqrt(m16Tmp[0]*m16Tmp[0] + m16Tmp[1]*m16Tmp[1] + m16Tmp[2]*m16Tmp[2]) ; return getPhysicalToVirtualScale() / vpToVirtualScale ; }
void saveView(final PrintWriter out, final Image3DUniverse univ) throws IOException { out.println("BeginView"); final Transform3D t3d = new Transform3D(); univ.getCenterTG().getTransform(t3d); out.println("center = " + toString(t3d)); univ.getTranslateTG().getTransform(t3d); out.println("translate = " + toString(t3d)); univ.getRotationTG().getTransform(t3d); out.println("rotate = " + toString(t3d)); univ.getZoomTG().getTransform(t3d); out.println("zoom = " + toString(t3d)); univ.getAnimationTG().getTransform(t3d); out.println("animate = " + toString(t3d)); out.println("EndView"); }
@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] ); }
/** * Copy the inverse vworld to camera transformation, which transforms any * point from the observer coordinate system to vworld coordinate system to * the */ public void getVworldToCameraInverse(final Transform3D transform) { final Transform3D tmp = new Transform3D(); getCenterTG().getTransform(transform); getTranslateTG().getTransform(tmp); transform.mul(tmp); getRotationTG().getTransform(tmp); transform.mul(tmp); getZoomTG().getTransform(tmp); transform.mul(tmp); }
/** * After animation was stopped, the transformation of the animation * TransformGroup is incorporated in the rotation TransformGroup and the * animation TransformGroup is set to identity. This is necessary, because * otherwise a following rotation by the mouse would not take place around the * expected axis. */ private void incorporateAnimationInRotation() { rotationTG.getTransform(rotationXform); animationTG.getTransform(animationXform); rotationXform.mul(rotationXform, animationXform); animationXform.setIdentity(); animationTG.setTransform(animationXform); rotationTG.setTransform(rotationXform); }
public void applyTransform(final Transform3D transform) { final Transform3D t1 = new Transform3D(); localTranslate.getTransform(t1); final Transform3D t2 = new Transform3D(); localRotate.getTransform(t2); t1.mul(t2); t1.mul(transform, t1); setTransform(t1); }
/** * Copy the whole transformation, which transforms any point from the vworld * coordinate system to the observer coordinate system. */ public void getVworldToCamera(final Transform3D transform) { final Transform3D tmp = new Transform3D(); getCenterTG().getTransform(transform); getTranslateTG().getTransform(tmp); transform.mul(tmp); getRotationTG().getTransform(tmp); transform.mul(tmp); getZoomTG().getTransform(tmp); transform.mul(tmp); transform.invert(); }
for(j=0; j<group.numChildren(); j++) { Node ni=group.getChild(j); if(ni instanceof TransformGroup) { Transform3D tdi=new Transform3D(); TransformGroup tgi=(TransformGroup)group.getChild(j); tgi.getTransform(tdi); Transform3D rotation = new Transform3D(); rotation.rotX(Math.toRadians(0.001*i)); tdi.mul(rotation); tgi.setTransform(tdi); } }
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); } });
/** * Starts animating the universe. */ public void startAnimation() { animationTG.getTransform(animationXform); updateRotationAxisAndCenter(); rotpol.setTransformAxis(centerXform); rotpol.setEnable(true); animation.resume(); fireTransformationStarted(); }
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)); }
/** * Obtain a copy of all the Transform3D that describe the view such as zoom, * pan, and rotation. */ public void getGlobalTransform(final GlobalTransform transform) { final MultiTransformGroup group = getViewingPlatform().getMultiTransformGroup(); final int num = group.getNumTransforms(); if (transform.transforms == null || transform.transforms.length != num) { transform.transforms = new Transform3D[num]; for (int i = 0; i < num; i++) transform.transforms[i] = new Transform3D(); } for (int i = 0; i < num; i++) group.getTransformGroup(i).getTransform(transform.transforms[i]); }
public void updateFrontBackClip() { zoomTG.getTransform(zoomXform); zoomXform.get(zDir); final double d = zDir.length(); univ.getViewer().getView().setBackClipDistance(5 * d); univ.getViewer().getView().setFrontClipDistance(5 * d / 100); }
void translate(final int xNew, final int yNew) { if (content == null || content.isLocked()) return; final int dx = xNew - xLast; final int dy = yNew - yLast; translateTG.getTransform(translateOld); v1.scale(dx, translationPerDx); v2.scale(-dy, translationPerDy); translation.add(v1, v2); translateNew.set(translation); translateNew.mul(translateOld); translateTG.setTransform(translateNew); transformChanged(BehaviorCallback.TRANSLATE, translateNew); xLast = xNew; yLast = yNew; }
public void writeObject( DataOutput out ) throws IOException { MultiTransformGroup mtg = universe.getViewingPlatform().getMultiTransformGroup(); int mtgSize = mtg.getNumTransforms(); out.writeInt( mtgSize ); // Store the matrix from each MTG transform Transform3D trans = new Transform3D(); Matrix4d matrix = new Matrix4d(); for(int i=0; i<mtgSize; i++) { TransformGroup tg = mtg.getTransformGroup( i ); tg.getTransform( trans ); trans.get( matrix ); control.writeMatrix4d( out, matrix ); } control.writeObject( out, control.createState( universe.getViewingPlatform().getPlatformGeometry() )); control.writeObject( out, control.createState( universe.getViewer().getAvatar() )); writeLocales( out ); }