# Calculate Point based on distance in 2D-Space

I have a Point P in unit circle (on or in it) with a radius of r. How can I calculate a Point Q with a fixed radius of x, which has the same angle like P

-
Do you mean the point $Q$ lies on the same ray from the origin as $P$, just with a different distance from the origin? –  Suugaku May 21 '13 at 16:31

Let $P=(x_1, y_1)$ and $Q=(x_2,y_2)$, for unknown $(x_2,y_2)$. We want the points to be in the same line connecting the origin $(0,0)$ and $P$. (Let's assumme $P$ is not the origin!) This line is given by $$x_1 y = y_1 x$$ Note that I didn't write $y=\frac{y_1}{x_1}x$ because $x_1$ may be zero.

Now let's plug $(x_2,y_2)$ in it: $$x_1 y_2 = y_1 x_2$$

The radius is the distance from the point to the origin. I'll call it $q$ instead of $x$ to avois confusion. This is given by $${x_2}^2 + {y_2}^2 = q^2$$

Now you have two equations in two unknowns. Substituting the second in the first: $${x_1}^2 (q^2-{x_2}^2) = {y_1}^2 {x_2}^2$$

which is a second degree equation in $x_2$. The corresponding $y_2$ is found with the first equation. It has two solutions, because there are two points in the same line $\bar{OP}$ at the same distance from the origin. If you want, you can discard the solution pointing in the opposite direction.

-

Suppose $P$ is at location $(a,b)$, with $a,b$ assumed positive. You want point $P$ to be at $(c,d)$, with $c^2+d^2=x$, but also you want $\frac{d}{c}=\frac{b}{a}$.

We divide both sides by $c^2$ to get $1+\left(\frac{d}{c}\right)^2=\frac{x}{c^2}$, or $$1+\left(\frac{b}{a}\right)^2=\frac{x}{c^2}$$

We can now solve for $c$ via $$c=\sqrt{\frac{x}{1+(b/a)^2}}$$

Having solved for $c$, we may solve for $d$ via $$d=\sqrt{x-c^2}$$

I leave the cases where $a$ and/or $b$ is nonpositive for you to consider as variations.

-