# Given the ratios of distances from three corners of a rectangle, find the coordinates of a point with said ratios.

I think the picture can explain it better than words, but I'm wondering how to figure this out. Given three ratios of distances from corners, not lengths (in the picture I set the base, $base=1$, to be the distance from the top left corner, while the other two corners are of lengths $\alpha\cdot$$base and \beta\cdot$$base$) and given the height $H$ and width $W$ of a rectangle, what are the coordinates of a point with said ratios? I'm sure the Apollonian Theorem comes into play, but I can't quite figure it out. Thanks!

Segment $1$ and segment $\alpha$ create a circle of possibilities, with endpoints of their diameter at $\frac{W}{1+\alpha}$ and $\frac{W}{1-\alpha}$. $\beta$ and $H$ work similarly. You can then intersect these circles to find two solutions.

To find points where we can be via $\alpha$ and $W$, we can use the distance formula from the two points $(0,0)$ and $(W,0)$:

\begin{align} \alpha\sqrt{ \left(x^2 + y^2\right)} &= \sqrt{\left(x-W\right)^2 + y^2}\\ \alpha^2 \left(x^2 + y^2\right) &= \left(x-W\right)^2 + y^2\\ \alpha^2x^2 + \alpha^2y^2 &= x^2 - 2Wx + W^2 + y^2 \\ \left(\alpha^2-1\right)x^2 + \left(\alpha^2-1\right)y^2 + 2Wx &= W^2\\ x^2 + y^2 + \frac{2W}{\alpha^2-1}x &= \frac{W^2}{\alpha^2-1}\\ x^2 + y^2 + \frac{2W}{\alpha^2-1}x + \left(\frac{W^2}{\alpha^2-1}\right)^2&= \frac{W^2}{\alpha^2-1} + \left(\frac{W}{\alpha^2-1}\right)^2\\ \left(x - \frac{W}{\alpha^2-1}\right)^2 + y^2 + &= \frac{\left(\alpha^2-1\right)W^2}{\left(\alpha^2-1\right)^2} + \frac{W^2}{\left(\alpha^2-1\right)^2}\\ \left(x - \frac{W}{\alpha^2-1}\right)^2 + y^2 + &= \frac{\alpha^2W^2}{\left(\alpha^2-1\right)^2}\\ \left(x - \frac{W}{\alpha^2-1}\right)^2 + y^2 + &= \left(\frac{\alpha W}{\alpha^2-1}\right)^2\\ \end{align}

So the candidate points form a circle centered at $A = \left(\frac{W}{\alpha^2-1}, 0\right)$ with radius $a = \frac{\alpha W}{\alpha^2-1}$. We can do the same thing with $H$ and $\beta$ to get a second circle centered at $B = \left(0, \frac{H}{\beta^2-1}\right)$ with radius $b = \frac{\beta H}{\beta^2-1}$.

Now, let's find the intersections of these circles.

First, we need the distance between the centers:

$$d=\sqrt{\left(\frac{W}{\alpha^2-1}\right)^2 + \left(\frac{H}{\beta^2-1}\right)^2}$$

Now, the intersection. I'll use circle $a$ as the first circle. At this point the calculations are getting a little too nasty, and I haven't found anything nice after here, so you'll just have to do the math by plugging previous results in:

The distance from $A$ to the segment between the two solution points is $u = \frac{d^2 + a^2 - b^2}{2d}$. The distance from the line between $A$ and $B$ to the solution points is $v = \sqrt{u^2 - a^2}$. A unit vector pointing from $A$ to $B$ is $U = \frac{B-A}{d}$. Then $V$ is a unit vector perpendicular to $U$ - just switch the coordinates and flip one's sign. Finally, we can find the (up to) two solution points:

$$P = A + uU \pm vV$$

• Aren’t they hyperbolas? – amd Nov 1 '17 at 6:55
• Circles. $\alpha ^2(x^2 + y^2 )= (x-W)^2+y^2$ – Dan Uznanski Nov 1 '17 at 7:06
• Ah, yes. Sign error on my part. I believe that should be $\alpha^2$ to match the OP’s parameter, though. – amd Nov 1 '17 at 7:09
• Fortunately you caught that in time for me to fix my comment. – Dan Uznanski Nov 1 '17 at 7:11
• Thank you, very well explained. If I were to add one last ratio distance from the remaining corner; would that guarantee a one-point solution? – Alain Rochette Nov 2 '17 at 11:58