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); } }
public class Static3DWorld extends JFrame { private Transform3D rotate1 = new Transform3D(); private Transform3D rotate2 = new Transform3D(); .... private Transform3D rotateCube() { rotate1.rotX(Math.PI / 4.0d); rotate2.rotY(Math.PI / 4.0d); rotate1.mul(rotate2); return rotate1; } .... }
Transform3D rotation = new Transform3D(); Transform3D temp = new Transform3D(); rotation.rotX(Math.PI/2); temp.rotZ(Math.PI/2); rotation.mul(temp); // multiply the 2 transformation matrices together.
translation.rotX( Math.PI ); translation.setTranslation( new Vector3d( center.x + 1.5f * center.w, center.y, center.z ) ); final TransformGroup tg = new TransformGroup( translation );
translation.rotX( Math.PI ); translation.setTranslation( new Vector3d( center.x + 1.5f * center.w, center.y, center.z ) ); final TransformGroup tg = new TransformGroup( translation );
translation.rotX( Math.PI ); translation.setTranslation( new Vector3d( center.x + 1.5f * center.w, center.y, center.z ) ); final TransformGroup tg = new TransformGroup( translation );
translation.rotX( Math.PI ); translation.setTranslation( new Vector3d( center.x + 1.5f * center.w, center.y, center.z ) ); final TransformGroup tg = new TransformGroup( translation );
public void applyRotation(final int axis, final double degree) { final Transform3D t = new Transform3D(); switch (axis) { case X_AXIS: t.rotX(deg2rad(degree)); break; case Y_AXIS: t.rotY(deg2rad(degree)); break; case Z_AXIS: t.rotZ(deg2rad(degree)); break; } applyTransform(t); }
public void setRotation(final int axis, final double degree) { final Transform3D t = new Transform3D(); switch (axis) { case X_AXIS: t.rotX(deg2rad(degree)); break; case Y_AXIS: t.rotY(deg2rad(degree)); break; case Z_AXIS: t.rotZ(deg2rad(degree)); break; } setTransform(t); }
y_angle = dx * x_factor; transformX.rotX(x_angle); transformY.rotY(y_angle);
t0.setTranslation(new Vector3d(0,0,10)); Transform3D t1 = new Transform3D(); t1.rotX(Math.toRadians(-30)); viewPlatformTransform.mul(t1, t0); simpleUniverse.getViewingPlatform().
z = Math.PI * dr / 180; tx.rotX(x); tc.mul(tx);
t0.setTranslation(new Vector3d(0,0,10)); Transform3D t1 = new Transform3D(); t1.rotX(Math.toRadians(-30)); viewPlatformTransform.mul(t1, t0); simpleUniverse.getViewingPlatform().
t0.rotX(Math.toRadians(-45)); Transform3D t1 = new Transform3D(); t1.setTranslation(new Vector3d(0,0,10));
@Override public void run(String args) { int defaultNo = 1; final Image3DUniverse univ = new Image3DUniverse(512, 512); displayCube(univ); Transform3D initialRot = new Transform3D(); Transform3D tmp = new Transform3D(); initialRot.rotY(Math.PI/4); tmp.rotX(-Math.PI/4); initialRot.mul(tmp); // univ.getGlobalRotate().setTransform(initialRot); univ.show(); displayCase(univ, defaultNo); GenericDialog gd = new GenericDialog("ImageJ 3D Viewer"); gd.addSlider("case: ", 0, 255, defaultNo); final Scrollbar slider = (Scrollbar)gd.getSliders().get(0); slider.addAdjustmentListener(new AdjustmentListener() { @Override public void adjustmentValueChanged(AdjustmentEvent e) { displayCase(univ, slider.getValue()); } }); gd.setModal(false); gd.showDialog(); if(gd.wasCanceled()) return; }
latitudeTransform.rotX( latitude ); rotateTransform.mul(rotateTransform, latitudeTransform); rotateTransform.mul(rotateTransform, longditudeTransform);
private void addText(final String s, final Point3f pos, final float fontsize, final Color3f c) { final Transform3D translation = new Transform3D(); translation.rotX(Math.PI); translation.setTranslation(new Vector3f(pos)); final TransformGroup tg = new TransformGroup(translation); final OrientedShape3D textShape = new OrientedShape3D(); textShape.setAlignmentMode(OrientedShape3D.ROTATE_ABOUT_POINT); textShape.setAlignmentAxis(0.0f, 1.0f, 0.0f); textShape.setRotationPoint(new Point3f(0, 0, 0)); textShape.setConstantScaleEnable(true); final Text2D t2d = new Text2D(s, c, "Helvetica", 24, Font.PLAIN); t2d.setRectangleScaleFactor(0.03f); textShape.setGeometry(t2d.getGeometry()); textShape.setAppearance(t2d.getAppearance()); tg.addChild(textShape); addChild(tg); }
Transform3D tempRotate = new Transform3D(); rotate.rotX(Math.PI/4.0d); tempRotate.rotY(Math.PI/5.0d); rotate.mul(tempRotate);
rotate.rotX(Math.PI); transform.mul(rotate, transform);