Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  Ross Millikan Aug 18 '12 at 4:46

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.