public static double[][] toHomogeneousCoordinates(double[][] m) {
		int mRows = m.length;
		int mColumns = m[0].length;
		double res[][] = new double[mRows + 1][mColumns + 1];
		for (int i = 0; i < mRows; i++) {
			for (int j = 0; j < mColumns; j++) {
				res[i][j] = m[i][j];
			}
			res[i][mColumns] = 0;
		}
		for (int j = 0; j < mColumns; j++) {
			res[mRows][j] = 0;
		}
		res[mRows][mColumns] = 1;
		return res;
	}