e2 docs matrix - wiremod/wire GitHub Wiki
Matrix
= matrix2()
Creates a 2x2 zero matrix (1 ops)
= matrix2(
Rv1,
Rv2)
Creates a matrix with vectors by columns (5 ops)
= rowMatrix2(
Rv1,
Rv2)
Creates a 2x2 matrix with 2D vectors by rows (5 ops)
= matrix2(
Rv1,
Rv2,
Rv3,
Rv4)
Creates a matrix with values in order (i.j) of: (1,1), (1,2), (2,1), (2,2) (5 ops)
= matrix2(
Rv1)
Converts a 3x3 matrix into a 2x2 matrix - all (i,3) and (3,j) are omitted (5 ops)
= identity2()
Creates a 2x2 identity matrix (5 ops)
=
:row(
Rv2)
Returns the row as a 2D vector (5 ops)
=
:column(
Rv2)
Returns the column as a 2D vector (5 ops)
=
:setRow(
Rv2,
Rv3,
Rv4)
Sets the values of a row. The first argument given specifies the row(j), the following arguments are the values 1j, 2j (5 ops)
=
:setRow(
Rv2,
Rv3)
Sets the values of a row. The first argument given specifies the row, the vector contains the values to set (5 ops)
=
:setColumn(
Rv2,
Rv3,
Rv4)
Sets the values of a column. The first argument given specifies the column(i), the following arguments are the values i1, i2 (5 ops)
=
:setColumn(
Rv2,
Rv3)
Sets the values of a column. The first argument given specifies the column, the vector contains the values to set (5 ops)
=
:swapRows()
Swaps rows (5 ops)
=
:swapColumns()
Swaps columns (5 ops)
=
:element(
Rv2,
Rv3)
Returns the element with indices (i,j) (5 ops)
=
:setElement(
Rv2,
Rv3,
Rv4)
Sets an element's value. The first two arguments specify the indices (i,j), the third argument is the value to set it to (5 ops)
=
:swapElements(
Rv2,
Rv3,
Rv4,
Rv5)
Swaps two elements, specified by indices ( i1, j1, i2, j2 ) (5 ops)
= diagonal(
Rv1)
Returns a 2D vector comprising the elements along the leading diagonal (5 ops)
= trace(
Rv1)
Returns the trace of a matrix (5 ops)
= det(
Rv1)
Returns the determinant of a matrix (Does not work for 4x4 matrices) (5 ops)
= transpose(
Rv1)
Returns the transpose of a matrix (5 ops)
= adj(
Rv1)
Returns the adjugate of a matrix (Does not work for 4x4 matrices) (5 ops)
= matrix()
Creates a 3x3 zero matrix (1 ops)
= matrix(
Rv1,
Rv2,
Rv3)
Creates a matrix with vectors by columns (5 ops)
= rowMatrix(
Rv1,
Rv2,
Rv3)
Creates a 3x3 matrix with vectors by rows (5 ops)
= matrix(
Rv1,
Rv2,
Rv3,
Rv4,
Rv5,
Rv6,
Rv7,
Rv8,
Rv9)
Creates a matrix with 9 values in the following order (i.j): (1,1), (1,2), (1,3), (2,1) etc (5 ops)
= matrix(
Rv1)
Converts a 2x2 matrix into a 3x3 matrix - all (i,3) and (3,j) are filled with 0's (5 ops)
= identity()
Creates a 3x3 identity matrix (5 ops)
=
:row(
Rv2)
Returns the row as a vector (5 ops)
=
:column(
Rv2)
Returns the column as a vector (5 ops)
=
:setRow(
Rv2,
Rv3,
Rv4,
Rv5)
Sets the values of a row. The first argument given specifies the row(j), the following arguments are the values 1j, 2j, 3j (5 ops)
=
:setRow(
Rv2,
Rv3)
Sets the values of a row. The first argument given specifies the row, the vector contains the values to set (5 ops)
=
:setColumn(
Rv2,
Rv3,
Rv4,
Rv5)
Sets the values of a column. The first argument given specifies the column(i), the following arguments are the values i1, i2, i3 (5 ops)
=
:setColumn(
Rv2,
Rv3)
Sets the values of a column. The first argument given specifies the column, the vector contains the values to set (5 ops)
=
:swapColumns(
Rv2,
Rv3)
Swaps the two columns specified (5 ops)
=
:element(
Rv2,
Rv3)
Returns the element with indices (i,j) (5 ops)
=
:setElement(
Rv2,
Rv3,
Rv4)
Sets an element's value. The first two arguments specify the indices (i,j), the third argument is the value to set it to (5 ops)
=
:swapElements(
Rv2,
Rv3,
Rv4,
Rv5)
Swaps two elements, specified by indices ( i1, j1, i2, j2 ) (5 ops)
=
:setDiagonal(
Rv2)
Sets the elements of the leading diagonal from the components of a vector (5 ops)
=
:setDiagonal(
Rv2,
Rv3,
Rv4)
Sets the elements of the leading diagonal (5 ops)
= diagonal(
Rv1)
Returns a vector comprising the elements along the leading diagonal (5 ops)
= trace(
Rv1)
Returns the trace of a matrix (5 ops)
= det(
Rv1)
Returns the determinant of a matrix (Does not work for 4x4 matrices) (5 ops)
= transpose(
Rv1)
Returns the transpose of a matrix (5 ops)
= adj(
Rv1)
Returns the adjugate of a matrix (Does not work for 4x4 matrices) (5 ops)
= matrix(
Rv1)
Creates a reference frame matrix from an entity's local direction vectors by columns in the order ( x, y, z ) (5 ops)
=
:x()
Returns the local x direction vector from a 3x3 coordinate reference frame matrix ( same as M:column(1) ) (5 ops)
=
:y()
Returns the local y direction vector from a 3x3 coordinate reference frame matrix ( same as M:column(2) ) (5 ops)
=
:z()
Returns the local z direction vector from a 3x3 coordinate reference frame matrix ( same as M:column(3) ) (5 ops)
= matrix(
Ang)
Returns a 3x3 reference frame matrix as described by the angle A. Multiplying by this matrix will be the same as rotating by the given angle (5 ops)
=
:toAngle()
Returns an angle derived from a 3x3 rotation matrix (5 ops)
= mRotation(
Rv1,
Rv2)
Creates a 3x3 rotation matrix, where the vector is the axis of rotation, and the number is the angle (anti-clockwise) in degrees. Example*: to rotate a vector (7,8,9) by 50 degrees about the axis (1,1,0), you would write V = mRotation(vec(1,1,0), 50) * vec(7,8,9) (5 ops)
= matrix4()
Creates a 4x4 zero matrix (1 ops)
= matrix4(
Rv1,
Rv2,
Rv3,
Rv4)
Creates a matrix with vectors by columns (5 ops)
= rowMatrix4(
Rv1,
Rv2,
Rv3,
Rv4)
Creates a 4x4 matrix with 4D vectors by rows (5 ops)
= matrix4(
Rv1,
Rv2,
Rv3,
Rv4,
Rv5,
Rv6,
Rv7,
Rv8,
Rv9,
Rv10,
Rv11,
Rv12,
Rv13,
Rv14,
Rv15,
Rv16)
Creates a matrix with 16 values in the following order (i.j): (1,1), (1,2), (1,3), (1,4), (2,1) etc (5 ops)
= matrix4(
Rv1)
Converts a 2x2 matrix into a 4x4 matrix - all (i,3), (i,4), (3,j) and (4,j) are filled with 0's (5 ops)
= matrix4(
Rv1,
Rv2,
Rv3,
Rv4)
Constructs a 4x4 matrix from four 2x2 matrices (5 ops)
= matrix4(
Rv1)
Converts a 3x3 matrix into a 4x4 matrix - all (i,4) and (4,j) are filled with 0's (5 ops)
= identity4()
Creates a 4x4 identity matrix (5 ops)
=
:row(
Rv2)
Returns the row as a 4D vector (5 ops)
=
:column(
Rv2)
Returns the column as a 4D vector (5 ops)
=
:setRow(
Rv2,
Rv3,
Rv4,
Rv5,
Rv6)
Sets the values of a row. The first argument given specifies the row(j), the following arguments are the values 1j, 2j, 3j, 4j (5 ops)
=
:setRow(
Rv2,
Rv3)
Sets the values of a row. The first argument given specifies the row, the vector contains the values to set (5 ops)
=
:setColumn(
Rv2,
Rv3,
Rv4,
Rv5,
Rv6)
Sets the values of a column. The first argument given specifies the column(i), the following arguments are the values i1, i2, i3, i4 (5 ops)
=
:setColumn(
Rv2,
Rv3)
Sets the values of a column. The first argument given specifies the column, the vector contains the values to set (5 ops)
=
:swapRows(
Rv2,
Rv3)
Swaps the two rows specified (5 ops)
=
:swapColumns(
Rv2,
Rv3)
Swaps the two columns specified (5 ops)
=
:element(
Rv2,
Rv3)
Returns the element with indices (i,j) (5 ops)
=
:setElement(
Rv2,
Rv3,
Rv4)
Sets an element's value. The first two arguments specify the indices (i,j), the third argument is the value to set it to (5 ops)
=
:swapElements(
Rv2,
Rv3,
Rv4,
Rv5)
Swaps two elements, specified by indices ( i1, j1, i2, j2 ) (5 ops)
=
:setDiagonal(
Rv2)
Sets the elements of the leading diagonal from the components of a vector (5 ops)
=
:setDiagonal(
Rv2,
Rv3,
Rv4,
Rv5)
Sets the elements of the leading diagonal (5 ops)
= diagonal(
Rv1)
Returns a 4D vector comprising the elements along the leading diagonal (5 ops)
= trace(
Rv1)
Returns the trace of a matrix (5 ops)
= transpose(
Rv1)
Returns the transpose of a matrix (5 ops)
= inverseA(
Rv1)
Finds the matrix inverse of a standard 4x4 affine transformation matrix ( the type created by matrix4(E) ). This should only be used on matrices with a particular format, where the top left 3x3 specifies rotation, the rightmost 3-column specifies translation, and the bottom row is (0,0,0,1) (5 ops)
= matrix4(
Rv1)
Creates a 4x4 reference frame matrix from an entity's local direction vectors by columns in the order (x, y, z, pos), with the bottom row (0,0,0,1) (5 ops)
=
:x()
Returns the local x direction vector from a 4x4 coordinate reference frame matrix (5 ops)
=
:y()
Returns the local y direction vector from a 4x4 coordinate reference frame matrix (5 ops)
=
:z()
Returns the local z direction vector from a 4x4 coordinate reference frame matrix (5 ops)
=
:pos()
Returns the position vector from a 4x4 coordinate reference frame matrix (5 ops)
= matrix4(
Ang)
Returns a 4x4 reference frame matrix as described by the angle A. Multiplying by this matrix will be the same as rotating by the given angle (5 ops)
= matrix4(
Ang,
Pos)
Returns a 4x4 reference frame matrix as described by the angle A and the position V. Multiplying by this matrix will be the same as rotating by the given angle and offsetting by the given vector (5 ops)