title: How to zoom in on a point (the math behind it)
body: <p>I'm working on a fractal graphic. I need to be able to zoom in on a specific point.</p>
  
  <p>Here's what I've got so far. If you keep the mouse in the same position for the whole zoom, it works. But if you zoom part of the way then move the mouse to a new position and try to zoom some more from there, it starts jumping all over.</p>
  
  <pre><code>scale_change = zoom * ((button == SCROLL_DOWN) ? ZOOM_INC : -ZOOM_INC);
  zoom += scale_change;
  center-&gt;x -= (mouse-&gt;x - (IMG_SIZE / 2)) * scale_change;
  center-&gt;y -= (mouse-&gt;y - (IMG_SIZE / 2)) * scale_change;
  </code></pre>
  
  <p>I assume some part of it is over-simplistic? There's some variable I'm not accounting for? It <em>does</em> work if you don't move the mouse, though.</p>