/** * Converts {@link FMatrixRMaj} into {@link FMatrix6} * * @param input Input matrix. * @param output Output matrix. If null a new matrix will be declared. * @return Converted matrix. */ public static FMatrix6 convert(FMatrixRMaj input, FMatrix6 output) { if (output == null) { output = new FMatrix6(); } if (input.getNumRows() != 1 && input.getNumCols() != 1) { throw new ArgumentException("One row or column must have a length of 1 for it to be a vector"); } int length = Math.Max(input.getNumRows(), input.getNumCols()); if (length != 6) { throw new ArgumentException("Length of input vector is not 6. It is " + length); } output.a1 = input.data[0]; output.a2 = input.data[1]; output.a3 = input.data[2]; output.a4 = input.data[3]; output.a5 = input.data[4]; output.a6 = input.data[5]; return(output); }
/** * Converts {@link FMatrixRMaj} into {@link FMatrix4x4} * * @param input Input matrix. * @param output Output matrix. If null a new matrix will be declared. * @return Converted matrix. */ public static FMatrix4x4 convert(FMatrixRMaj input, FMatrix4x4 output) { if (output == null) { output = new FMatrix4x4(); } if (input.getNumRows() != output.getNumRows()) { throw new ArgumentException("Number of rows do not match"); } if (input.getNumCols() != output.getNumCols()) { throw new ArgumentException("Number of columns do not match"); } output.a11 = input.data[0]; output.a12 = input.data[1]; output.a13 = input.data[2]; output.a14 = input.data[3]; output.a21 = input.data[4]; output.a22 = input.data[5]; output.a23 = input.data[6]; output.a24 = input.data[7]; output.a31 = input.data[8]; output.a32 = input.data[9]; output.a33 = input.data[10]; output.a34 = input.data[11]; output.a41 = input.data[12]; output.a42 = input.data[13]; output.a43 = input.data[14]; output.a44 = input.data[15]; return(output); }
/** * Converts {@link FMatrixRMaj} into {@link FMatrix6x6} * * @param input Input matrix. * @param output Output matrix. If null a new matrix will be declared. * @return Converted matrix. */ public static FMatrix6x6 convert(FMatrixRMaj input, FMatrix6x6 output) { if (output == null) { output = new FMatrix6x6(); } if (input.getNumRows() != output.getNumRows()) { throw new ArgumentException("Number of rows do not match"); } if (input.getNumCols() != output.getNumCols()) { throw new ArgumentException("Number of columns do not match"); } output.a11 = input.data[0]; output.a12 = input.data[1]; output.a13 = input.data[2]; output.a14 = input.data[3]; output.a15 = input.data[4]; output.a16 = input.data[5]; output.a21 = input.data[6]; output.a22 = input.data[7]; output.a23 = input.data[8]; output.a24 = input.data[9]; output.a25 = input.data[10]; output.a26 = input.data[11]; output.a31 = input.data[12]; output.a32 = input.data[13]; output.a33 = input.data[14]; output.a34 = input.data[15]; output.a35 = input.data[16]; output.a36 = input.data[17]; output.a41 = input.data[18]; output.a42 = input.data[19]; output.a43 = input.data[20]; output.a44 = input.data[21]; output.a45 = input.data[22]; output.a46 = input.data[23]; output.a51 = input.data[24]; output.a52 = input.data[25]; output.a53 = input.data[26]; output.a54 = input.data[27]; output.a55 = input.data[28]; output.a56 = input.data[29]; output.a61 = input.data[30]; output.a62 = input.data[31]; output.a63 = input.data[32]; output.a64 = input.data[33]; output.a65 = input.data[34]; output.a66 = input.data[35]; return(output); }
/** * Converts {@link FMatrixRMaj} into {@link FMatrix2x2} * * @param input Input matrix. * @param output Output matrix. If null a new matrix will be declared. * @return Converted matrix. */ public static FMatrix2x2 convert(FMatrixRMaj input, FMatrix2x2 output) { if (output == null) { output = new FMatrix2x2(); } if (input.getNumRows() != output.getNumRows()) { throw new ArgumentException("Number of rows do not match"); } if (input.getNumCols() != output.getNumCols()) { throw new ArgumentException("Number of columns do not match"); } output.a11 = input.data[0]; output.a12 = input.data[1]; output.a21 = input.data[2]; output.a22 = input.data[3]; return(output); }