Understanding mathematics around an arbitrary axis rotation in WebGL

I recently studied a number of matrix libraries used for WebGL to better understand the math that goes into the various transformations performed on matrices. I'm currently trying to better understand the math used for rotational transforms.

In particular, I already understand the transformations used to rotate around three axes, as well as to create these matrices (shown below).

enter image description here

However, I do not get the equations that are used to rotate around an arbitrary axis that is not an x, y- or z axis.

WebGL, JS ( e - , 4x4):

len = Math.sqrt(x*x + y*y + z*z);
if (len !== 1) {
  rlen = 1 / len;
  x *= rlen;
  y *= rlen;
  z *= rlen;
}
nc = 1 - c;
xy = x * y;
yz = y * z;
zx = z * x;
xs = x * s;
ys = y * s;
zs = z * s;

e[ 0] = x*x*nc +  c;
e[ 1] = xy *nc + zs;
e[ 2] = zx *nc - ys;
e[ 3] = 0;

e[ 4] = xy *nc - zs;
e[ 5] = y*y*nc +  c;
e[ 6] = yz *nc + xs;
e[ 7] = 0;

e[ 8] = zx *nc + ys;
e[ 9] = yz *nc - xs;
e[10] = z*z*nc +  c;
e[11] = 0;

e[12] = 0;
e[13] = 0;
e[14] = 0;
e[15] = 1;

, , 3D-, , , . , nc, xy, yz, zx, xs, ys zs? , , x*x*nc + c e[0]?

SO post, :

enter image description here

( ), JS .

? , , , , - , x, y z, , .

, , .

, , , . 4x4 T x, T y T z ?

.

+4
2

, :

http://paulbourke.net/geometry/rotate/

:

http://web.archive.org/web/20140515121518/http://inside.mines.edu:80/~gmurray/ArbitraryAxisRotation/ArbitraryAxisRotation.html

, .

, rotate-then-translate, x :

    1 0 0 t1      r11 r12 r13 0
T = 0 1 0 t2  R = r21 r22 r23 0
    0 0 1 t3      r31 r32 r33 0
    0 0 0 1       0   0   0   1

        1 0 0 t1   r11 r12 r13 0   r11 r12 r13 t1
T x R = 0 1 0 t2 x r21 r22 r23 0 = r21 r22 r23 t2
        0 0 1 t3   r31 r32 r33 0   r31 r32 r33 t3
        0 0 0 1    0   0   0   1   0   0   0   1

(.. ), "6.2 " URL- (http://web.archive.org/web/20140515121518/http://inside.mines.edu:80/~gmurray/ArbitraryAxisRotation/ArbitraryAxisRotation.html).

+1

theta, :

c = cos(theta);
nc = 1-cos(theta); // (or 1-c)
s = sin(theta);

,

x - u x

xy - u x u y

xs - u x sin & theta;

.. , , u x u z (1-cos & theta;) + u y ; zx * nc - ys

, R, , 4x4 3x3. , .

+1

Source: https://habr.com/ru/post/1534134/


All Articles