Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any difference between Matrix.setRotateM and Matrix.rotateM

There are two methods to rotate matrices in android.opengl.Matrix class, they are:

  1. static void rotateM (float[] m, int mOffset, float a, float x, float y, float z)
    Rotates matrix m in place by angle a (in degrees) around the axis (x, y, z)

  2. static void setRotateM(float[] rm, int rmOffset, float a, float x, float y, float z)
    Rotates matrix m by angle a (in degrees) around the axis (x, y, z)

Here is the original ducumentation

These methods act a bit different, but I don't understand the exact difference. Coul you explain this to me?

like image 472
Anton Boritskiy Avatar asked Sep 01 '25 11:09

Anton Boritskiy


1 Answers

Let's say matrix R is rotation matrix around (x,y,z) axis by angle a, then rotateM method modifies existing matrix m like this: m = R * m, but setRotateM overwrites it: m = R.

like image 62
Mārtiņš Možeiko Avatar answered Sep 03 '25 00:09

Mārtiņš Možeiko