How does the function matrix.preScale(x,y)
work and how is it used?
Example usage:
matrix.preScale(1.0f, 1.0f);
The pre-, post- functions are used for pre- and post-multiplication respectively.
For example, call the following functions:
reset(); //reset to identity matrix
setRotate(90); //set the matrix to be a 90 degree rotation
preScale(2.0f,2.0f); //scale uniformly with factor 2
or
reset(); //reset to identity matrix
setRotate(90); //set the matrix to be a 90 degree rotation
postScale(2.0f,2.0f); //scale uniformly with factor 2
Now, what's the difference?
In the first version, the final matrix first scales and then rotates. In the second, it's vice versa.
Pre functions construct a matrix and multiply it from right to the existing matrix post functions multiply from left.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With