public void multiply(Matrix4d matrix) { this.matrixStack.peek().mul(matrix); }
public void multiply(Matrix matrix) { this.matrixStack.peek().mul(matrix.matrixStack.peek()); }
/** * 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 scale(double x, double y, double z) { Matrix4d matrix = this.matrixStack.peek(); Matrix4d scale = new Matrix4d(); scale.m00 = x; scale.m11 = y; scale.m22 = z; scale.m33 = 1; matrix.mul(scale); }
public void multiply(Matrix4f matrix) { this.matrixStack.peek().mul(new Matrix4d(matrix)); }
public void rotate(Quat4f qaut) { Matrix4d matrix = this.matrixStack.peek(); Matrix4d rotation = new Matrix4d(); rotation.set(qaut); matrix.mul(rotation); }
public void rotate(Quat4d quat) { Matrix4d matrix = this.matrixStack.peek(); Matrix4d rotation = new Matrix4d(); rotation.set(quat); matrix.mul(rotation); }
private void calcZDirection() { calcBoundaries(); // if the longer part of the structure faces towards the back (-z direction), // rotate around y-axis so the longer part faces the viewer (+z direction) if (Math.abs(minBoundary.z) > Math.abs(maxBoundary.z)) { Matrix4d rot = flipY(); rot.mul(transformationMatrix); transformationMatrix.set(rot); } }
private void calcZDirection() { calcBoundaries(); // if the longer part of the structure faces towards the back (-z direction), // rotate around y-axis so the longer part faces the viewer (+z direction) if (Math.abs(minBoundary.z) > Math.abs(maxBoundary.z)) { Matrix4d rot = flipY(); rot.mul(transformationMatrix); transformationMatrix.set(rot); } }
/** * Returns true if the given CrystalTransform is equivalent to this one. * Two crystal transforms are equivalent if one is the inverse of the other, i.e. * their transformation matrices multiplication is equal to the identity. * @param other * @return */ public boolean isEquivalent(CrystalTransform other) { Matrix4d mul = new Matrix4d(); mul.mul(this.matTransform,other.matTransform); if (mul.epsilonEquals(IDENTITY, 0.0001)) { return true; } return false; }
@Override public ResultSample doMultTest(final int count, final int maxCount, final long timeOutMS) { final Matrix4d m1 = vecMatrixRandom(); final Matrix4d m2 = vecMatrixRandom(); final long start = System.currentTimeMillis(); int loopCount = 0; while (System.currentTimeMillis() - start < timeOutMS && loopCount != maxCount) { ++loopCount; for (int i = 0; i < count; ++i) { m1.mul(m1, m2); } } return populateResult(System.currentTimeMillis() - start, loopCount, toArray(m1)); }
/** * Returns the combination (product) of two biological assembly transformations. * @param matrix1 * @param matrix2 * @return combined transformation */ public static BiologicalAssemblyTransformation combine(BiologicalAssemblyTransformation matrix1, BiologicalAssemblyTransformation matrix2) { Matrix4d transformation = new Matrix4d(matrix1.transformation); transformation.mul(matrix2.transformation); BiologicalAssemblyTransformation combined = new BiologicalAssemblyTransformation(); combined.setTransformationMatrix(transformation); return combined; }
public void rotate(double angle, double x, double y, double z) { Matrix4d matrix = this.matrixStack.peek(); Matrix4d rotation = new Matrix4d(); rotation.setIdentity(); rotation.setRotation(new AxisAngle4d(x, y, z, angle * (Math.PI / 180))); matrix.mul(rotation); }
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); }
private Matrix4d reorientHelix(int index) { Matrix4d matrix = new Matrix4d(); matrix.setIdentity(); matrix.setRotation(new AxisAngle4d(1,0,0,Math.PI/2*(index+1))); matrix.mul(transformationMatrix); return matrix; }
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(); } }
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(); }