How to use matrix.preScale (x, y)

How does a function work matrix.preScale(x,y)and how is it used?

Usage example:

matrix.preScale(1.0f, 1.0f);
+5
source share
1 answer

Preliminary, 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 is ​​first scaled and then rotated. In the second - on the contrary.

Preliminary functions build a matrix and multiply it on the right by existing columnar functions multiplied on the left.

+8
source

All Articles