Mat4:mul

Edit

Multiplies this matrix by another value. Multiplying by a matrix combines their two transforms together. Multiplying by a vector applies the transformation from the matrix to the vector and returns a new transformed vector.




Arguments

NameTypeDescription
nMat4 The matrix.

Returns

NameTypeDescription
selfMat4 The modified matrix.

Arguments

NameTypeDefaultDescription
xnumber The x component of the vector.
ynumber The y component of the vector.
znumber The z component of the vector.
wnumber1 The w component of the vector.

Returns

NameTypeDescription
xnumber The x component of the transformed vector.
ynumber The y component of the transformed vector.
znumber The z component of the transformed vector.
wnumber The w component of the transformed vector.

Arguments

NameTypeDescription
vvector A vector.

Returns

NameTypeDescription
vvector The transformed vector.

Notes

When multiplying with a table, the returned table will try to match the input: it will have the same metatable as the input, and it will either use numeric keys for the components or x/y/z keys, based on the table length of the input.

There are some differences between this function and the * operator. * always assumes that the w component of the input vector is 1, and performs a w divide at the end. This function allows specifying the w as the last argument, and does not perform a w divide at the end.

See also