public static double[][] rotateAroundArbitraryAxis(double[][] matrix,
			double angle, double[] vector) {

		double x = vector[0];
		double y = vector[1];
		double z = vector[2];

		double s = Math.sin(Math.toRadians(angle));
		double c = Math.cos(Math.toRadians(angle));
		double m = 1 - c;

		double sx = s * x;
		double sy = s * y;
		double sz = s * z;
		double mxx = m * x * x;
		double myy = m * y * y;
		double mzz = m * z * z;
		double mxy = m * x * y;
		double mxz = m * x * z;
		double myz = m * y * z;

		double xx = mxx + c;
		double xy = mxy + sz;
		double xz = mxz - sy;

		double yx = mxy - sz;
		double yy = myy + c;
		double yz = myz + sx;

		double zx = mxz + sy;
		double zy = myz - sx;
		double zz = mzz + c;

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

		double[][] first = getRotationFromTransform(matrix);

		double[][] rotation = multiplyRotations(first, second);

		double[] translation = getTranslationFromTransform(matrix);

		double[][] transform = createTransformForRotationAndTranslation(
				rotation, translation);

		return transform;

	}