如何基于 CGA 欧拉角度计算 3×3 旋转矩阵 R

alpha, beta, gamma = angles in radians

R = Rx(alpha) * Ry(beta) * Rz(gamma)

sa = sin(alpha);
ca = cos(alpha);
sb = sin(beta);
cb = cos(beta);
sg = sin(gamma);
cg = cos(gamma);

R[0][0] = cb*cg;
R[0][1] = sa*sb*cg - ca*sg;
R[0][2] = sa*sg + ca*sb*cg;

R[1][0] = cb*sg;
R[1][1] = ca*cg + sa*sb*sg;
R[1][2] = ca*sb*sg - sa*cg;

R[2][0] = -sb;
R[2][1] = sa*cb;
R[2][2] = ca*cb;