0
$\begingroup$

I'm sure this is simple, but I can't seem to find any answers on the net (maybe it's just a matter of wording - please redirect me accordingly).

Imagine a "camera" with a square viewport zooms in on a shape (say a circle) that is off-center in its "visual field". At the end of the zoom, the circle fits perfectly inside the camera's viewport.

Now, I see how this could be done by moving the viewport's center to the center of the circle at the same time as the circle's diameter is scaled to the viewport's width/height.

But let's say I can't move the viewport at all; all that is allowed is scaling and moving the circle. What, then, are the corresponding geometrical transformations that must be applied to the circle to simulate the effect of the zoom without moving the camera at all?

  • 0
    If the circle is off center, it can't fill the viewport (nor if the viewport isn't square). You can zoom, but the center point of the frame stays fixed. As you zoom in, the circle will move outwards in the frame, then leaving the frame as you zoom in. All you have to do is expand the center of the image to fill the frame.2012-08-18

2 Answers 2

2

Let the viewport be $[-a,a]^2$ and let the given circle have center $(x_0,y_0)$ and radius $r_0$. To produce a zoom effect move the center as follows: $x(t):=(1-t)x_0\ ,\quad y(t):=(1-t)y_0\qquad(0\leq t\leq 1)\ ,$ all the while increasing the radius according to $r(t):=(1-t)r_0+t\, a\qquad(0\leq t\leq 1)\ .$ At time $t=1$ the circle will be in the desired position.

0

Translate it for vector $-(p,q)$ where $(p,q)$ are coordinates of center of circle (assuming the $(0,0)$ is at the center of the viewpoint). Then increase the radius of the circle so that it touches the screen.

If the screen is square with side length $a$, and the circle has radius $r$, you want (after translation) the new radius to be $r_{\text{new}}=\frac a2$. This means you have to multiply the radius of the circle by $\frac a{2r}$.

So from $(x-p)^2+(y-q)^2=r^2$ you want to get a new circle $x^2+y^2=\left(\frac a2\right)^2$.

I hope I understood your problem and this helps you.