code: public Matrix4d getRepeatTransform(int x, int y){
  
  		Matrix4d transform = new Matrix4d();
  		transform.setIdentity();
  
  		int[] iCounts = getAxisCounts(x);
  		int[] jCounts = getAxisCounts(y);
  
  		int[] counts = new int[iCounts.length];
  		for (int k = 0; k < iCounts.length; k++)
  			counts[k] = iCounts[k] - jCounts[k];
  
  		for(int t = counts.length-1; t>=0; t--) {
  			if(counts[t] == 0)
  				continue;
  			if (counts[t] > 0) {
  				Matrix4d axis = new Matrix4d(axes.get(t).getOperator());
  				for(int i=0;i<counts[t];i++)
  					transform.mul(axis);
  			} else if (counts[t] < 0) {
  				Matrix4d axis = new Matrix4d(axes.get(t).getOperator());
  				axis.invert();
  				for(int i=0;i<counts[t];i++)
  					transform.mul(axis);
  			}
  		}
  		return transform;
  	}
docs: Return the transformation that needs to be applied to
  repeat x in order to superimpose onto repeat y.
  
  @param x the first repeat index (transformed)
  @param y the second repeat index (fixed)
  @return transformation matrix for the repeat x