title: fast way to rotate a matrix about its current position
body: <p>If I have a matrix then the point O(0,0,0) will be translated to some point P(x, y, z). So rotating a matrix about its current position is effectively multiplying the matrix by a rotation matrix about P.</p>
  
  <p>So I want a function like:</p>
  
  <pre><code>mat4 rotate(mat4 matrix, vec3 axis, float angle);
  </code></pre>
  
  <p>my current idea is:</p>
  
  <pre><code>vec4 p = {0, 0, 0, 1};
  
  p = p * matrix;
  
  generate translation matrix T, from point p
  
  generate rotation matrix R, from axis and angle
  
  return matrix * T * R * -T;
  </code></pre>
  
  <p>but I feel like there should be a more efficient way to do this...</p>