Function matrixMultiply

  • This function perfors matrix multiplication on 2 compatible matrices. For 2 matrices to be compatible the columns of the first matrix must equal the rows of the second

    Remarks

    • Do not use this function to multiply two Ttuple instances, a type error will be thrown
    • If the matrix1 is an Ttuple instance (Vector/Point) and matrix2 is a matrix the multiplication will go through and a new matrix is returned
    • If matrix2 is an Ttuple instance (Vector/Point) while matrix1 is a matrix, matrix2 will be treated like a single column matrix and a tuple will be returned

    Example

    const matrix1 = new Matrix([1, 2, 3, 4,
    5, 6, 7, 8,
    9, 8, 7, 6,
    5, 4, 3, 2], 4, 4)
    const matrix2 = new Matrix([-2, 1, 2, 3,
    3, 2, 1, -1,
    4, 3, 6, 5,
    1, 2, 7, 8], 4, 4)
    matrixMultiply(matrix1, matrix2) as Matrix
    -> Matrix( [20, 22, 50, 48,
    44, 54, 114, 108,
    40, 58, 110, 102,
    16, 26, 46, 42], 4, 4)

    Parameters

    Returns Matrix | Ttuple

Generated using TypeDoc