static double[][] multiplyRotations(double[][] first, double[][] second) {

		double xx1 = first[0][0];
		double xy1 = first[0][1];
		double xz1 = first[0][2];

		double yx1 = first[1][0];
		double yy1 = first[1][1];
		double yz1 = first[1][2];

		double zx1 = first[2][0];
		double zy1 = first[2][1];
		double zz1 = first[2][2];

		double xx2 = second[0][0];
		double xy2 = second[0][1];
		double xz2 = second[0][2];

		double yx2 = second[1][0];
		double yy2 = second[1][1];
		double yz2 = second[1][2];

		double zx2 = second[2][0];
		double zy2 = second[2][1];
		double zz2 = second[2][2];

		double xx = (xx1 * xx2) + (xy1 * yx2) + (xz1 * zx2);
		double xy = (xx1 * xy2) + (xy1 * yy2) + (xz1 * zy2);
		double xz = (xx1 * xz2) + (xy1 * yz2) + (xz1 * zz2);

		double yx = (yx1 * xx2) + (yy1 * yx2) + (yz1 * zx2);
		double yy = (yx1 * xy2) + (yy1 * yy2) + (yz1 * zy2);
		double yz = (yx1 * xz2) + (yy1 * yz2) + (yz1 * zz2);

		double zx = (zx1 * xx2) + (zy1 * yx2) + (zz1 * zx2);
		double zy = (zx1 * xy2) + (zy1 * yy2) + (zz1 * zy2);
		double zz = (zx1 * xz2) + (zy1 * yz2) + (zz1 * zz2);

		double[][] multiplied = new double[][] { new double[] { xx, xy, xz },
				new double[] { yx, yy, yz }, new double[] { zx, zy, zz } };

		return multiplied;

	}