This function transforms a vector by a matrix and returns the result as a new array.
It takes a transform matrix (as returned by the function matrix_build) and the x, y and z values of the vector to transform. It can optionally take the value of the w component.
The function returns an array of the same size as the number of components that you provide:
matrix_transform_vertex(matrix, x, y, z, [w]);
Argument | Type | Description |
---|---|---|
matrix | Matrix Array | The matrix to use |
x | Real | The x component of the vector to transform |
y | Real | The y component of the vector to transform |
z | Real | The z component of the vector to transform |
w | Real | OPTIONAL The w component of the vector to transform |
Array (3 elements (x, y and z are passed) or 4 elements (x, y, z and w are passed))
t_matrix = matrix_build(0, 0, 0, 0, 90, 0, 1, 2, 1);
new_xyz = matrix_transform_vertex(t_matrix, x, y, z);
The above code transforms the given values using the matrix stored in the variable "t_matrix" and stores them in the array new_xyz.