/* (non-Javadoc)
   * @see org.biojava.nbio.structure.quaternary.core.AxisAligner#getGeometicCenterTransformation()
   */
  @Override
  public Matrix4d getGeometicCenterTransformation() {
    run();

    Matrix4d geometricCentered = new Matrix4d(reverseTransformationMatrix);
    geometricCentered.setTranslation(new Vector3d(getGeometricCenter()));

    return geometricCentered;
  }
  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();
  }