How to determine the horizontal scaling factor for which 4 points become co-circular? (Mostly stuck on the algebra) at my university, we're doing a project with kinetic datastructures right now, and for that, I need to know at which time point 4 given points become co-circular (in a position such that they are all on one circle).
Let $p_i, p_k, p_j, p_l$ be those points, which form at least a convex quadrilateral (that is guaranteed at this point).
We determined that one way to determine co-circularity is that the sum of opposing inner angles must reach $\pi$. For the opposing angles $\angle d,a,b$ and $\angle b,c,d$.
To simplify calculations, we limit ourselves to the cosine of the angles:
So: $$\cos \angle p_i p_k p_j = 1 - \cos \angle p_i p_l p_j$$
Then, we apply the law of cosines:
$$\cos \angle p'_i p'_k p'_j = \frac{{dist}^2(p'_i,p'_k) 
        + {dist}^2(p'_i,p'_j)
                                - {dist}^2(p'_j,p'_k)}
                                {{dist}(p'_i,p'_k) \cdot {dist}(p'_i,p'_j)}$$
(The other side is similar)
Now, expanding the dist functions, we get:
$$\cos \angle p_i p_k p_j = \frac{\rho^2(x_i-x_k)^2 + (y_i-y_k)^2
        + \rho^2(x_j-x_k)^2 + (y_j-y_k)^2
                                - \rho^2(x_i-x_j)^2 - (y_i-y_j)^2}
                                {\sqrt{\rho^2(x_i-x_k)^2 + (y_i-y_k)^2} \cdot 
                                 \sqrt{\rho^2(x_j-x_k)^2 + (y_j-y_k)^2}}$$
$$\cos \angle p_i p_l p_j = \frac{\rho^2(x_i-x_l)^2 + (y_i-y_l)^2
        + \rho^2(x_j-x_l)^2 + (y_j-y_l)^2
                                - \rho^2(x_i-x_j)^2 - (y_i-y_j)^2}
                                {\sqrt{\rho^2(x_i-x_l)^2 + (y_i-y_l)^2} \cdot 
                                 \sqrt{\rho^2(x_j-x_l)^2 + (y_j-y_l)^2}}$$
$\rho$ is the scaling factor.
Replacing these in the first equation, and factoring out $\rho$ where possible:
$$\frac{\rho^2(x_i-x_k)^2 + (y_i-y_k)^2
        + \rho^2(x_j-x_k)^2 + (y_j-y_k)^2
                                - \rho^2(x_i-x_j)^2 - (y_i-y_j)^2}
                                {\sqrt{\rho^2(x_i-x_k)^2 + (y_i-y_k)^2} \cdot 
                                 \sqrt{\rho^2(x_j-x_k)^2 + (y_j-y_k)^2}} = \\
1- \frac{\rho^2(x_i-x_l)^2 + (y_i-y_l)^2
        + \rho^2(x_j-x_l)^2 + (y_j-y_l)^2
                                - \rho^2(x_i-x_j)^2 - (y_i-y_j)^2}
                                {\sqrt{\rho^2(x_i-x_l)^2 + (y_i-y_l)^2} \cdot 
                                 \sqrt{\rho^2(x_j-x_l)^2 + (y_j-y_l)^2}}$$
Aaand... that's where I got stuck. Algebra has never been one of my strong points.
All those $x_i$ and $y_i$ are known, but I need to know $\rho$.
I resolved it once, but then noticed I'd factored out the $\rho$ from the square roots, without noticing that the part with the y-coordinates did not have a $\rho$ factor. Now I'm not sure how to get it out of the square roots.
How to I determine $\rho$? (Or at the very least, I how do I get rid of those square roots?)
 A: Your approach is


*

*too complicated (too many square roots!)

*bound to be not trustworthy because coming from reasoning on angles and can switch suddenly modulo $2 \pi$...
The most classical test that is done for cocircularity is issued from the fact that there exist $a,b,c$ ($(a,b)$ are the center's coordinates, but we do not assume at all that this center is known) such that the general equation of a circle, i.e.,
$$x^2+y^2-2ax-2by+c=0$$
(coming from the expansion of $(x-a)^2+(y-b)^2=R^2$)
should be verified by the 4 points, a condition that you can put under the form:
$$\tag{1}\begin{pmatrix}(x_1^2+y_1^2) & x_1 & y_1 & 1\\ (x_2^2+y_2^2) & x_2 & y_2 & 1\\ (x_3^2+y_3^2) & x_3 & y_3 & 1\\ (x_4^4+y_4^2) & x_4 & y_4 & 1 \end{pmatrix}\begin{pmatrix}1\\-2a\\-2b\\c \end{pmatrix}=\begin{pmatrix}0\\0\\0\\0 \end{pmatrix}.$$
(1) expresses that the matrix has a non zero vector in its kernel, a condition that is equivalent to the fact that its determinant is $0.$
In conclusion, the cocircularity condition is:
$$\begin{vmatrix}(x_1^2+y_1^2) & x_1 & y_1 & 1\\ (x_2^2+y_2^2) & x_2 & y_2 & 1\\ (x_3^2+y_3^2) & x_3 & y_3 & 1\\ (x_4^4+y_4^2) & x_4 & y_4 & 1 \end{vmatrix}=0$$
As I understand your problem, you are looking for an horizontal scaling factor $r$ such that
$$\begin{vmatrix}(r^2 x_1^2+y_1^2) & r x_1 & y_1 & 1\\ (r^2 x_2^2+y_2^2) & rx_2 & y_2 & 1\\ (r^2 x_3^2+y_3^2) & r x_3 & y_3 & 1\\ (r^2 x_4^4+y_4^2) & r x_4 & y_4 & 1 \end{vmatrix}=0$$
This gives rise to a 3rd degree equation (in general) that clearly has the following roots:


*

*$r=0$ (deprived of any interest, of course).

*either two opposite real roots $r=\pm r_0$ or 2 complex conjugate roots $r=a\pm ib$ (this last case being neither usable).
