/** * Translates the view by the specified distances along the x, y and z * direction (of the vworld). * * @param v The distances in x, y and z direction, given in vworld dimensions. */ public void translate(final Vector3d v) { getTranslateTranslation(tmpV); tmpV.sub(v); translateXform.set(tmpV); translateTG.setTransform(translateXform); transformChanged(BehaviorCallback.TRANSLATE, translateXform); }
/** * Center the view at the given point. * * @param center */ public void centerAt(final Point3d center) { // set the center transformation to the translation given by // the specified point centerV.set(center.x, center.y, center.z); centerXform.set(centerV); centerTG.setTransform(centerXform); // set the global translation to identity centerXform.setIdentity(); translateTG.setTransform(centerXform); transformChanged(BehaviorCallback.TRANSLATE, centerXform); // update rotation center rotCenter.set(center); }
/** * Rotates the view around the center of view by the specified angle around * the given axis (of the image plate). * * @param axis The axis of rotation (in image plate coordinate system) * @param angle The angle (in rad) around the given axis */ public void rotate(final Vector3d axis, final double angle) { final Vector3d axisVW = new Vector3d(); getAxisVworld(axis, axisVW); aa.set(axisVW, angle); tmp.set(aa); // first apply the old transform rotationTG.getTransform(rotationXform); // rotate rotationXform.mul(tmp, rotationXform); rotationTG.setTransform(rotationXform); transformChanged(BehaviorCallback.ROTATE, rotationXform); }
/** * Moves the view back (i.e. in the z-direction of the image plate) to the * specified distance. * * @param distance */ public void zoomTo(final double distance) { zDir.set(0, 0, 1); zDir.scale(distance); zoomXform.set(zDir); zoomTG.setTransform(zoomXform); univ.getViewer().getView().setBackClipDistance(5 * distance); univ.getViewer().getView().setFrontClipDistance(5 * distance / 100); transformChanged(BehaviorCallback.TRANSLATE, zoomXform); }
/** * Rotates the view around the center of view by the specified angles around * the x and y axis (of the image plate). * * @param angleX The angle (in rad) around the x-axis * @param angleY The angle (in rad) around the y-axis */ public void rotateXY(final double angleX, final double angleY) { getXDir(xDir); aa.set(xDir, angleX); tmp.set(aa); getYDir(yDir); aa2.set(yDir, angleY); tmp2.set(aa2); // first apply the old transform rotationTG.getTransform(rotationXform); // rotate x rotationXform.mul(tmp, rotationXform); // rotate y rotationXform.mul(tmp2, rotationXform); rotationTG.setTransform(rotationXform); transformChanged(BehaviorCallback.ROTATE, rotationXform); }
univ.getViewer().getView().setBackClipDistance(5 * distance); univ.getViewer().getView().setFrontClipDistance(5 * distance / 100); transformChanged(BehaviorCallback.TRANSLATE, zoomXform);