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!
1 Answers
Segment $1$ and segment $\alpha$ create a circle of possibilities called the Circle of Apollonius, with endpoints of its 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 + \frac{2W}{\alpha^2-1}x + \left(\frac{W^2}{\alpha^2-1}\right)^2 + y^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}{1-\alpha^2}\right)^2 + y^2 &= \frac{\alpha^2W^2}{\left(\alpha^2-1\right)^2}\\ \left(x - \frac{W}{1-\alpha^2}\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}{1-\alpha^2}, 0\right)$ with radius $a = \pm\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}{1-\beta^2}\right)$ with radius $b = \pm\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}{1-\alpha^2}\right)^2 + \left(\frac{H}{1-\beta^2}\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$$

- 11,025
-
Aren’t they hyperbolas? – amd Nov 01 '17 at 06:55
-
Circles. $\alpha ^2(x^2 + y^2 )= (x-W)^2+y^2$ – Dan Uznanski Nov 01 '17 at 07:06
-
1Ah, yes. Sign error on my part. I believe that should be $\alpha^2$ to match the OP’s parameter, though. – amd Nov 01 '17 at 07:09
-
Fortunately you caught that in time for me to fix my comment. – Dan Uznanski Nov 01 '17 at 07: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 02 '17 at 11:58
-
It would not; it is possible, for instance, to end up with the three centers as collinear, which would make both answers still valid. In addition, it is often the case that numerical instability will cause the three circles to not quite intersect at a single point. And of course the third ratio has only binary freedom instead of a full degree. – Dan Uznanski Nov 02 '17 at 12:02
-
When you gather terms in $x$ on the 7th line, shouldn't the bracketed term be $\left(x + \dfrac{W}{\alpha^2 - 1}\right)^2$, as we have $x^2 + 2\dfrac{W}{\alpha^2 - 1} x + \left(\dfrac{W}{\alpha^2 - 1}\right)^2$? – Dai Sep 29 '20 at 14:24
-
you are correct! -- oh, I see what went wrong. I eventually wanted to get to $\left(\frac{W}{1-\alpha^2}\right)$ and forgot to actually do that step. I actually currently dislike this answer and should probably do some significant cleanup. – Dan Uznanski Sep 29 '20 at 14:55