public RotationMatrix rotateAroundForeignAxes(EulerAngles angles,
			RotationMatrix matrix) {

		double x = angles.getXAngle();
		double y = angles.getYAngle();
		double z = angles.getZAngle();

		RotationMatrix rotated = null;

		if (x != 0d) {

			UnitVector xvector = matrix.getXAxis();

			rotated = this.rotateAroundAxis(x, xvector);

		}

		if (y != 0d) {

			UnitVector yvector = matrix.getYAxis();

			if (rotated == null) {

				rotated = this.rotateAroundAxis(y, yvector);

			} else {

				rotated = rotated.rotateAroundAxis(y, yvector);

			}

		}

		if (z != 0d) {

			UnitVector zvector = matrix.getZAxis();

			if (rotated == null) {

				rotated = this.rotateAroundAxis(z, zvector);

			} else {

				rotated = rotated.rotateAroundAxis(z, zvector);

			}

		}

		if (rotated == null) {

			return this;

		}

		return rotated;

	}