# Calculate distance after rotation?

I'll start off by saying that I suck at math.

I'm trying to calculate the distance between a circle and the center of the screen after rotating an image that contains that circle by $45^\circ$ in $3D$,

(The $y$ distance of the object changes as the image rotates)

-
have you tried something? Just try to describe the situation. – V-X Mar 3 '13 at 13:04

Let's suppose that the projection point is on the line perpendicular to the middle of the screen (at a distance $z$) then the vertical tangent at the view point will change from $\displaystyle\frac yz$ to $\displaystyle\frac {y\,\cos(\alpha)}{z+y\,\sin(\alpha)}$ after a vertical rotation of angle $\alpha$.

This implies that $\,y\,$ will become $\ \displaystyle h(\alpha):=\frac {y\,z\,\cos(\alpha)}{z+y\,\sin(\alpha)}$.

For $\,\alpha=\frac{\pi}4\,$ you should get : $$y':=h\left(\frac{\pi}4\right)=\frac {y\,z}{y+\sqrt{2}z}$$

After rotation of $(oy)$ of an angle $\alpha$ we get following picture (from the side) :

Now observe the triangle obtained and notice that : $$\frac{y\,\cos(\alpha)}{z+y\,\sin(\alpha)}=\frac{y'}z$$

-
Wow, I must say that I've never been as confused before. lol I suppose I'll need someone to simplify this answer for me D: – Don Mar 3 '13 at 13:22
I'll add a drawing in my answer to clarify a little... – Raymond Manzoni Mar 3 '13 at 13:30
That'll be great! :D – Don Mar 3 '13 at 13:34
@Don: I updated my answer. Is this clearer? – Raymond Manzoni Mar 3 '13 at 13:42
@RaymondManzoni It is a lot clearer, what I am a bit confused about is how to implement this in code ( i needed this for a game I'm programming ) - even my Z is at 0 at the moment, does it mean I'll have to determine what Z is first? – Don Mar 3 '13 at 13:58

I thought of a more naiive way of doing this calculation that I hope illustrates how images are really taken of things, and how that means you have to manipulate the camera to manipulate the image.

In step 1, the perspective point F and either of the other points (the centers of the planes) can be chosen arbitrarily.

Something to think about: images in our vision are really upside-down, but our brains correct them.

-