Matrices

Function DimMatrix(m_rows, m_cols)

Returns a new matrix.


Sub DeleteMatrix(mA)

Frees a matrix from memory.


Function AddMatrix(mA, mB, mC)

Adds matrix mA to matrix mB and stores the results in mC.


Function AugmentMatrix(mA, mB, mC)

Appends the columns of matrix mB onto matrix mA and stores the result in mC.

NOTE: Must mA and mB must be the same number of rows.


Sub CopyMatrix(mA, mB)

Copies matrix mA to matrix mB.


Function InsertMatrixColumns(mA, c, num_cols)

Insert a number of empty columns into matrix mA starting at the specified column.


Function InsertMatrixRows(mA, r, num_rows)

Insert a number of empty rows into matrix mA starting at the specified row.


Function MultiplyMatrix(mA, mB, mC)

Multiply matrix mA and mB and store the result in mC.


Function CubeMatrix(mA, mB)

Returns matrix mA raised to the 3rd power.


Function DeleteMatrixColumns(mA, c, num_cols)

Removes the specified columns from a matrix.

Returns false if column are outside matrix.


Function DeleteMatrixRows(mA, r, num_rows)

Removes the specified rows from a matrix.

Returns false if rows are outside matrix.


Sub ClearMatrix(mA)

Sets all elements in a matrix to zero.


Function ClearMatrixColumns(mA, c, num_cols)

Sets all elements in the matrix columns specified to zero.


Function ClearMatrixRows(mA, r, num_rows)

Sets all elements in the matrix rows specified to zero.


Sub FillMatrix(mA, v)

Fills matrix with the given value.


Function FillMatrixColumns(mA, c, num_cols, v)

Fills matrix columns with the given value starting at the given column.


Function FillMatrixRows(mA, r, num_rows, v)

Fills matrix rows with the given value starting at the given row.


Function CopyMatrixColumns(mA, mB, c, num_cols)

Copies the specified matrix columns from matrix mA to matrix mB. Note: Matrix mB will be redimensioned to the size of the copied columns.


Function CopyMatrixRows(mA, mB, r, num_rows)

Copies the specified matrix rows from matrix mA to matrix mB.

Note: Matrix mB will be redimensioned to the size of the copied rows.


Sub SetIdentityMatrix(mA, n)

Sets matrix mA to an identity matrix of n rows and n columns.

For most transform operations (ie. translate, rotate, and scale) it is recommended to start from and identity matrix


Function SolveMatrix(mA, mB, mC)

Solve the system that has mA as coefficient and mB as the hand side of the equation. Stores the result in mC.

Returns true if it was able to be solved and false if not.


Function IsEqualMatrix(mA, mB, tolerance)

Returns true if matrix mA is within tolerance of matrix mB.


Function Determinant(mA)

Returns the determinant of matrix mA.


Function AdjointMatrix(mA, mB)

Stores the adjoint matrix of mA in mB.


Function InvertMatrix(mA, mB)

Stores the inverse matrix of mA in mB.


Sub MatrixFromBuffer(mA, r, c, ByRef buffer)

Creates a matrix from an array.

NOTE: buffer must have the same number of dimensions as the desired matrix for the structure to remain intact.


Sub BufferFromMatrix(ByRef buffer, mA)

Saves the matrix mA in an array.

NOTE: buffer must have the same number of dimensions as the desired matrix for the structure to remain intact.


Sub RandomizeMatrix(mA, vmin, vmax)

Stores random values between vmin and vmax in the matrix mA.


Function MatrixValue(mA, r, c)

Returns the value stored at the given row and column in the matrix.


Sub SetMatrixValue(mA, r, c, v)

Sets the value of a cell in a matrix.


Sub ScalarMatrix(mA, mB, s_value)

Multiplies values in matrix mA by scalar value and stores the results in mB.


Function ScalarMatrixColumns(mA, mB, c, num_cols, s_value)

Multiplies values in the specified columns of matrix mA by scalar value and stores the results in mB.


Sub ScalarMatrixRows(mA, mB, r, num_rows, s_value)

Multiplies values in the specified rows of matrix mA by scalar value and stores the results in mB.


Function SquareMatrix(mA, mB)

Stores the square of matrix mA in the matrix mB.


Sub CofactorMatrix(mA, r, c)

Sets matrix mA to a cofactor. This will change the original matrix so it is recommended to copy the matrix if you still need the original matrix.

See also

CopyMatrix()


Function SubtractMatrix(mA, mB, mC)

Stores matrix mA minus matrix mB in matrix mC.


Sub SwapMatrix(mA, mB1)

Swaps the contents of 2 matrices.


Function SwapMatrixColumn(mA, C1, C2)

Swaps the contents of 2 columns in a matrix.


Function SwapMatrixRow(mA, R1, R2)

Swaps the contents of 2 rows in a matrix


Function TransposeMatrix(mA, mB)

Stores the transpose of matrix mA in matrix mB.


Function UnAugmentMatrix(mA, mB, mC)

Splits matrix mA into coefficient mB and augment mC.


Sub ZeroMatrix(mA)

Clears a matrix.

Note: Literally does the exact same thing as ClearMatrix. Its here as a legacy call convention.

See also

ClearMatrix()


Sub GetMatrixSize(mA, ByRef r, ByRef c)

Gets the number of rows and columns in a matrix.

See also

DimMatrix()


Sub IncrementMatrixRows(mA, mB, r, num_rows, value)

Increments all the values in a specified number of rows in matrix mA, starting from row r. The result is stored in matrix mB.


Sub IncrementMatrixColumns(mA, mB, c, num_cols, value)

Increments all the values in a specified number of columns in matrix mA, starting from column c. The result is stored in matrix mB.


Sub JoinMatrixRows(mA, mB, mC)

Appends the rows in matrix mB onto the right of matrix mA.


Sub JoinMatrixColumns(mA, mB, mC)

Appends the columns in matrix mB below matrix mA.


Sub ClipMatrix(mA, r, c, num_rows, num_cols, mB)

Copies the specified portion of matrix mA into matrix mB.


Sub SetMatrixTranslation(mA, x, y, z)

Sets the translation vector of a matrix.


Sub SetMatrixRotation(mA, x, y, z)

Sets the rotation vector of a matrix.


Sub SetMatrixScale(mA, x, y, z)

Sets the scale vector of a matrix.


Sub GetMatrixTranslation(mA, ByRef x, ByRef y, ByRef z)

Get the position vector of a matrix.


Function GetMatrixRotation(mA, ByRef x, ByRef y, ByRef z)

Gets the rotation vector of a matrix.


Sub GetMatrixScale(mA, ByRef x, ByRef y, ByRef z)

Gets the scale vector of a matrix.

See also

SetMatrixScale()


Function MatrixExists(mA)

Returns TRUE if a matrix exists and FALSE if not.