bµg<p>A short story about rotation in <a href="https://fosstodon.org/tags/GLSL" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>GLSL</span></a>.</p><p>float c=cos(a),s=sin(a); mat2 M=mat2(c,-s,s,c).<br>M is a 2D CW rotation matrix.<br>If we do p=M*p, we rotate the *space* p lies in clockwise. So p is rotated CCW. But if we do p*=M we rotate the space by the transposed M (which is also its inverse bc M is orthogonal), which means a CCW space rotation, and so a CW rotation of the point.</p><p>So: p*=M is not a CW rotation of the point, but an inverse CW rotation of the space... which is the same, but shorter to write</p>