public static double[][] translateAlongForeignAxes(double[][] matrix,
			double xunits, double yunits, double zunits, double[][] foreign) {

		double[][] rotation = getRotationFromTransform(foreign);

		double[][] translated = matrix;
		boolean copy = true;

		if (xunits != 0d) {

			translated = translateAlongArbitraryAxis(translated, xunits,
					rotation[0]);
			copy = false;

		}

		if (yunits != 0d) {

			translated = translateAlongArbitraryAxis(translated, yunits,
					rotation[1]);
			copy = false;

		}

		if (zunits != 0d) {

			translated = translateAlongArbitraryAxis(translated, zunits,
					rotation[2]);
			copy = false;

		}

		if (copy) {

			// copy the specified matrix because the caller may otherwise
			// inadvertently modify the specified matrix were it returned by
			// default
			translated = copyMatrix(translated);

		}

		return translated;

	}