function transpose(matrix) {
        var resultMatrix = new Array(matrix[0].length);
        for(var i = 0; i < resultMatrix.length; ++i) {
            resultMatrix[i] = new Array(matrix.length);
        }

        for (i = 0; i < matrix.length; ++i) {
            for(var j = 0; j < matrix[0].length; ++j) {
                resultMatrix[j][i] = matrix[i][j];
            }
        }

        return resultMatrix;
    }
Tranpose a matrix, this method is for coordMatrixToPoints and
pointsToCoordMatrix, that because only transposing the matrix
you can change your representation.

@param matrix
@returns {Array}