/** * Initialize this ViewPlatformTransformer. * * @param univ * @param callback */ public ViewPlatformTransformer(final DefaultUniverse univ, final BehaviorCallback callback) { this.univ = univ; this.canvas = (ImageCanvas3D) univ.getCanvas(); this.callback = callback; this.centerTG = univ.getCenterTG(); this.rotationTG = univ.getRotationTG(); this.zoomTG = univ.getZoomTG(); this.translateTG = univ.getTranslateTG(); ((Image3DUniverse) univ).getGlobalCenterPoint(rotCenter); }
/** * 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); }
/** * 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(); }