/** * Adds translational component to rotation matrix * @param rotTrans * @param rotation * @return */ private void combineWithTranslation(Matrix4d rotation) { rotation.setTranslation(centroid); rotation.mul(rotation, centroidInverse); }
/** * Adds translational component to rotation matrix * @param rotTrans * @param rotation * @return */ private void combineWithTranslation(Matrix4d rotation) { rotation.setTranslation(centroid); rotation.mul(rotation, centroidInverse); }
/** * Adds translational component to rotation matrix * @param rotation * @return */ private void combineWithTranslation(Matrix4d rotation) { rotation.setTranslation(centroid); rotation.mul(rotation, centroidInverse); }
public void translate(double x, double y, double z) { Matrix4d matrix = this.matrixStack.peek(); Matrix4d translation = new Matrix4d(); translation.setIdentity(); translation.setTranslation(new Vector3d(x, y, z)); matrix.mul(translation); }
public static Matrix4d getMatrixFromAlgebraic(String transfAlgebraic) { String[] parts = transfAlgebraic.toUpperCase().split(","); double[] xCoef = convertAlgebraicStrToCoefficients(parts[0].trim()); double[] yCoef = convertAlgebraicStrToCoefficients(parts[1].trim()); double[] zCoef = convertAlgebraicStrToCoefficients(parts[2].trim()); Matrix4d mat = new Matrix4d(); mat.setIdentity(); mat.setRotation(new Matrix3d(xCoef[0],xCoef[1],xCoef[2],yCoef[0],yCoef[1],yCoef[2],zCoef[0],zCoef[1],zCoef[2])); mat.setTranslation(new Vector3d(xCoef[3],yCoef[3],zCoef[3])); return mat; //return new Matrix4d(xCoef[0],xCoef[1],xCoef[2],xCoef[3], // yCoef[0],yCoef[1],yCoef[2],yCoef[3], // zCoef[0],zCoef[1],zCoef[2],zCoef[3], // 0,0,0,1); }
@Override public Matrix4d getGeometicCenterTransformation() { run(); Matrix4d geometricCentered = new Matrix4d(reverseTransformationMatrix); geometricCentered.setTranslation(new Vector3d(getGeometricCenter())); return geometricCentered; }
/** * Returns a transformation matrix transform polyhedra for Cn structures. * The center in this matrix is the geometric center, rather then the centroid. * In Cn structures those are usually not the same. * @return */ @Override public Matrix4d getGeometicCenterTransformation() { run(); Matrix4d geometricCentered = new Matrix4d(reverseTransformationMatrix); geometricCentered.setTranslation(new Vector3d(getGeometricCenter())); return geometricCentered; }
/** * Superposition coords2 onto coords1 -- in other words, coords2 is rotated, * coords1 is held fixed */ private void calcTransformation() { // transformation.set(rotmat,new Vector3d(0,0,0), 1); transformation.set(rotmat); // long t2 = System.nanoTime(); // System.out.println("create transformation: " + (t2-t1)); // System.out.println("m3d -> m4d"); // System.out.println(transformation); // combine with x -> origin translation Matrix4d trans = new Matrix4d(); trans.setIdentity(); trans.setTranslation(new Vector3d(xtrans)); transformation.mul(transformation, trans); // System.out.println("setting xtrans"); // System.out.println(transformation); // combine with origin -> y translation ytrans.negate(); Matrix4d transInverse = new Matrix4d(); transInverse.setIdentity(); transInverse.setTranslation(new Vector3d(ytrans)); transformation.mul(transInverse, transformation); // System.out.println("setting ytrans"); // System.out.println(transformation); }
private void calcTransformationBySymmetryAxes() { Vector3d[] axisVectors = new Vector3d[2]; axisVectors[0] = new Vector3d(principalRotationVector); axisVectors[1] = new Vector3d(referenceVector); // y,z axis centered at the centroid of the subunits Vector3d[] referenceVectors = new Vector3d[2]; referenceVectors[0] = new Vector3d(Z_AXIS); referenceVectors[1] = new Vector3d(Y_AXIS); transformationMatrix = alignAxes(axisVectors, referenceVectors); // combine with translation Matrix4d combined = new Matrix4d(); combined.setIdentity(); Vector3d trans = new Vector3d(subunits.getCentroid()); trans.negate(); combined.setTranslation(trans); transformationMatrix.mul(combined); // for cyclic geometry, set a canonical view for the Z direction if (rotationGroup.getPointGroup().startsWith("C")) { calcZDirection(); } }
for (QubbleCuboid cuboid : parentCuboids) { transform.setIdentity(); transform.setTranslation(new Vector3d(cuboid.getPositionX(), cuboid.getPositionY(), cuboid.getPositionZ())); matrix.mul(transform); transform.rotZ(cuboid.getRotationZ() / 180 * Math.PI);
cube = parentCubes.get(i); transform.setIdentity(); transform.setTranslation(new Vector3d(cube.getPosition())); mat.mul(transform);
private void calcTransformationByInertiaAxes() { Vector3d[] axisVectors = new Vector3d[2]; axisVectors[0] = new Vector3d(principalAxesOfInertia[0]); axisVectors[1] = new Vector3d(principalAxesOfInertia[1]); Vector3d[] referenceVectors = new Vector3d[2]; referenceVectors[0] = new Vector3d(Y_AXIS); referenceVectors[1] = new Vector3d(X_AXIS); // align inertia axes with y-x plane transformationMatrix = alignAxes(axisVectors, referenceVectors); // combine with translation Matrix4d translation = new Matrix4d(); translation.setIdentity(); Vector3d trans = new Vector3d(subunits.getCentroid()); trans.negate(); translation.setTranslation(trans); transformationMatrix.mul(translation); }
private void calcTransformationBySymmetryAxes() { Vector3d[] axisVectors = new Vector3d[2]; axisVectors[0] = new Vector3d(principalRotationVector); axisVectors[1] = new Vector3d(referenceVector); // y,z axis centered at the centroid of the subunits Vector3d[] referenceVectors = new Vector3d[2]; referenceVectors[0] = new Vector3d(Z_AXIS); referenceVectors[1] = new Vector3d(Y_AXIS); transformationMatrix = alignAxes(axisVectors, referenceVectors); // combine with translation Matrix4d combined = new Matrix4d(); combined.setIdentity(); Vector3d trans = new Vector3d(subunits.getCentroid()); trans.negate(); combined.setTranslation(trans); transformationMatrix.mul(combined); // for helical geometry, set a canonical view for the Z direction calcZDirection(); }
trans.setTranslation(new Vector3d(ytrans)); rotTrans.mul(rotTrans, trans); Matrix4d transInverse = new Matrix4d(); transInverse.setIdentity(); transInverse.setTranslation(new Vector3d(xtrans)); rotTrans.mul(transInverse, rotTrans);