transform - chung-leong/qb GitHub Wiki

transform - Perform linear transformation on a vector

float[n] transform_rm(float[n][n+1] $m, float[n] $v)

float[n] transform_cm(float[n+1][n] $m, float[n] $v)

transform() performs linear transformation on vector v using the transformation matrix m. An implicit 1 is added to the vector, such that the final column of m represents a constant translation.

transform_rm() uses the row-major matrix convention--i.e. the first dimension is the number of rows in the matrix, while transform_cm() uses the column-major matrix convention--i.e. the first dimension is the number of columns in the matrix. Depending on the settings of qb.column_major_matrix transform() employs one or the other.

Parameters

m - The transformation matrix. It can be 2x3, 3x4, or 4x5.

v - The vector. It can be a two, three, or four-element array or an array of such arrays.

Return Value

The new coordinates after the transformation. Multiple vectors are return if m contains multiple matrices or v contains multiple vectors.

Version

1.4 and above.