/** * Applies a rotation to a given transform object. * @param t3d the transform object to rotate * @param rot the rotation as axis-angle (x,y,z,angle) * */ public static void rotate(Transform3D t3d, AxisAngle4d rot) { Transform3D rotT3d = new Transform3D(); rotT3d.setRotation(rot); t3d.mul(rotT3d); }
/** * Applies a translation to a given transform object. * @param t3d the transform object to translate * @param transVec the vector that describes the translation */ public static void translate(Transform3D t3d, Vector3d transVec) { Transform3D translationT3d = new Transform3D(); translationT3d.setTranslation(transVec); t3d.mul(translationT3d); }
private Transform3D applyMatrixTransformGroup( Transform3D transformation, TransformGroup tg ) { Transform3D tmpTrans = new Transform3D(); tg.getTransform( tmpTrans ); if ( tmpTrans.getBestType() != Transform3D.IDENTITY && tmpTrans.getBestType() != Transform3D.ZERO ) { LOG.debug( "A transform group with transform:\n" + tmpTrans ); // Matrix3d mat = new Matrix3d(); // tmpTrans.getRotationScale( mat ); // transformation.set( mat ); transformation.mul( tmpTrans ); LOG.debug( "Resulting transform:\n" + transformation ); } return tmpTrans; }
private void rotateQuat (Quat4d quat) { Transform3D t = getTransform(); Transform3D t1 = new Transform3D(); t1.setRotation(quat); t.mul(t1); setTransform(t); }
private void rotateQuat (Quat4d quat) { Transform3D t = getTransform(); Transform3D t1 = new Transform3D(); t1.setRotation(quat); t.mul(t1); setTransform(t); }
public void rotateAxis (Vector3D axis, double angle) { if(angle == 0) return; Transform3D t = getTransform(); Vector3D aRel = absToRel(axis); AxisAngle4d aa = new AxisAngle4d(aRel.x, aRel.y, aRel.z, Math.toRadians(angle)); Transform3D t1 = new Transform3D(); t1.setRotation(aa); t.mul(t1); setTransform(t); }
public void rotateRelative (Vector3D angles) { Transform3D t = getTransform(); Transform3D tX = new Transform3D(); Transform3D tY = new Transform3D(); Transform3D tZ = new Transform3D(); Vector3D radians = angles.times(Math.PI / 180.); tX.setRotation(new AxisAngle4d(1, 0, 0, radians.x)); tY.setRotation(new AxisAngle4d(0, 1, 0, radians.y)); tZ.setRotation(new AxisAngle4d(0, 0, 1, radians.z)); t.mul(tX); t.mul(tY); t.mul(tZ); setTransform(t); }
public void rotateAxis (Vector3D axis, double angle) { if(angle == 0) return; Transform3D t = getTransform(); Vector3D aRel = absToRel(axis); AxisAngle4d aa = new AxisAngle4d(aRel.x, aRel.y, aRel.z, Math.toRadians(angle)); Transform3D t1 = new Transform3D(); t1.setRotation(aa); t.mul(t1); setTransform(t); }
public void rotate (Vector3D angles) { Transform3D t = getTransform(); Transform3D tX = new Transform3D(); Transform3D tY = new Transform3D(); Transform3D tZ = new Transform3D(); Vector3D xR = absToRel(xAxis); Vector3D yR = absToRel(yAxis); Vector3D zR = absToRel(zAxis); Vector3D radians = angles.times(Math.PI / 180.); tX.setRotation(new AxisAngle4d(xR.x, xR.y, xR.z, radians.x)); tY.setRotation(new AxisAngle4d(yR.x, yR.y, yR.z, radians.y)); tZ.setRotation(new AxisAngle4d(zR.x, zR.y, zR.z, radians.z)); t.mul(tX); t.mul(tY); t.mul(tZ); setTransform(t); }
public void setRotationX(final float _echelle) { final Transform3D t3d = new Transform3D(); final Transform3D t3d2 = new Transform3D(); tg_.getTransform(t3d); t3d2.rotX(_echelle * Math.PI / 180); t3d2.mul(t3d); tg_.setTransform(t3d2); calculeBBox(); }
public void setRotationZ(final float _echelle) { final Transform3D t3d = new Transform3D(); final Transform3D t3d2 = new Transform3D(); tg_.getTransform(t3d); t3d2.rotZ(_echelle * Math.PI / 180); t3d2.mul(t3d); tg_.setTransform(t3d2); calculeBBox(); }
public void setRotationY(final float _echelle) { final Transform3D t3d = new Transform3D(); final Transform3D t3d2 = new Transform3D(); tg_.getTransform(t3d); t3d2.rotY(_echelle * Math.PI / 180); t3d2.mul(t3d); tg_.setTransform(t3d2); calculeBBox(); }
public void setEchelleY(final float _echelle) { final Transform3D t3d = new Transform3D(); tg_.getTransform(t3d); final Transform3D t3d2 = new Transform3D(); final Vector3d v = new Vector3d(1, _echelle, 1); t3d2.setScale(v); t3d2.mul(t3d); tg_.setTransform(t3d2); calculeBBox(); }
public void setEchelleX(final float _echelle) { final Transform3D t3d = new Transform3D(); tg_.getTransform(t3d); final Transform3D t3d2 = new Transform3D(); final Vector3d v = new Vector3d(_echelle, 1, 1); t3d2.setScale(v); t3d2.mul(t3d); tg_.setTransform(t3d2); calculeBBox(); }
public void setTranslationX(final float _echelle) { final Transform3D t3d = new Transform3D(); final Transform3D t3d2 = new Transform3D(); tg_.getTransform(t3d); final Vector3d v = new Vector3d(_echelle /* / ParametresVolumes.ECHELLE */, 0, 0); t3d2.setTranslation(v); t3d2.mul(t3d); tg_.setTransform(t3d2); calculeBBox(); }
public void setTranslationY(final float _echelle) { final Transform3D t3d2 = new Transform3D(); final Transform3D t3d = new Transform3D(); tg_.getTransform(t3d); final Vector3d v = new Vector3d(0, _echelle /* / ParametresVolumes.ECHELLE */, 0); t3d2.setTranslation(v); t3d2.mul(t3d); tg_.setTransform(t3d2); calculeBBox(); }
public void setEchelleZ(final float _echelle) { final Transform3D t3d = new Transform3D(); tg_.getTransform(t3d); final Transform3D t3d2 = new Transform3D(); final Vector3d v = new Vector3d(1, 1, _echelle); t3d2.setScale(v); t3d2.mul(t3d); tg_.setTransform(t3d2); calculeBBox(); }
public void setTranslationZ(final float _echelle) { final Transform3D t3d = new Transform3D(); final Transform3D t3d2 = new Transform3D(); tg_.getTransform(t3d); final Vector3d v = new Vector3d(0, 0, _echelle /* / ParametresVolumes.ECHELLE */); t3d2.setTranslation(v); t3d2.mul(t3d); tg_.setTransform(t3d2); calculeBBox(); }
private void calculateCenters() { localCenter = new Point3d(boxVector); localCenter.scale(0.5); rootCenter = new Point3d(localCenter); forwardTransform.transform(rootCenter); forwardCenterTransform = new Transform3D(forwardTransform); forwardCenterTransform.mul(toTransform(new Vector3d(localCenter))); reverseCenterTransform = new Transform3D(forwardCenterTransform); reverseCenterTransform.invert(); }
public BoundingBox(Transform3D fromUnitCoordinateToRootCoordinateTransform, AxisAlignedBoundingBox3DFloat box) { setDimensions(box.getWidth(), box.getDepth(), box.getHeight()); Transform3D lfb = toTransform(toVector(box.getLeftFrontBottom())); forwardTransform = new Transform3D(fromUnitCoordinateToRootCoordinateTransform); forwardTransform.mul(lfb); setForwardTransform(forwardTransform); calculateCenters(); }