Calculate the translation required to zoom in on a pivot point

155 Views Asked by At

I cannot think of a better way to explain this. I hope it makes sense.

Mathematical question:

Let the origin be $O=\left[0,0\right]$.
Let the pivot point be $P=\left[P_x,P_y\right]$.
Let the scale factor be $s$, where the scale in both $x$ and $y$ are the same.
Let the translation be $T=\left[T_x,T_y\right]$.

How does one calculate $T$ in order to simulate zooming in to or away from the pivot point?

Graphical example:

Zooming in on the top-left white square.

Before zoom:

Before zoom

After zoom:

After zoom

1

There are 1 best solutions below

0
On BEST ANSWER

I was completely overthinking this.

$T=\left[P_x\times\Delta{s},P_y\times\Delta{s}\right]$