Hi I'm doing some programming challenges for fun and I am trying to work out the maths required to solve this problem. It has been 10 years since I did any maths in anger like this so i'm a bit rusty. Any help gratefully received.
I have boiled it down to the following given points p0, p1, p2, p3 and factors a and b, find pS subject to the following conditions.
i've tried a number of ways of doing this but I think the most promising is by creating 4 equations:
$$(x_S - x_0)^2 + (y_S - y_0)^2 = r_0^2 \tag 1$$ $$(x_S - x_1)^2 + (y_S - y_1)^2 = a^2r_0^2 \tag 2 $$ $$(x_S - x_2)^2 + (y_S - y_2)^2 = r_1^2 \tag 3 $$ $$(x_S - x_3)^2 + (y_S - y_3)^2 = a^2r_1^2 \tag 4 $$
this gives me 4 unknowns, xS, yS, r1 and r0
so I am trying to work through the maths to simplify an equation down so that I can solve it programatically.
I can eliminate r0 and r1 quite easily but eliminating xS or yS is where I am struggling
using equations 1 and 2 I've got to the below which is where I have got stuck.
xS^2(1 - a^2) - 2xS(x1 - a^2 * x0) + yS^2(1 - a^2) - 2yS(y1 - a^2 * y0) + a^2(x0^2 + y0^2) + x1^2 + y1^2 = 0
How can I rearrange this for yS? so that I can use it to solve equations 3 and 4?
xS^2(1 - b^2) - 2xS(x3 - b^2 * x2) + yS^2(1 - b^2) - 2yS(y3 - b^2 * y2) + b^2(x2^2 + y2^2) + x3^2 + y3^2 = 0
or am I going about this completely the wrong way?
thanks Shep
Further Progress
Thanks to Yves for the guidance on removing the square terms but I am now stuck again as I don't seem to have enough equations to eliminate all of the variables.
$$2x_S(x_0 - x_1) + 2y_S(y_0-y_1) + x_1^2 - x_0^2 + y_1^2 - y_0^2 = r_0^2(a^2-1)\tag5$$ $$2x_S(x_0 - x_2) + 2y_S(y_0-y_2) + x_2^2 - x_0^2 + y_2^2 - y_0^2 = r_1^2 - r_0^2\tag6$$ $$2x_S(x_0 - x_3) + 2y_S(y_0-y_3) + x_3^2 - x_0^2 + y_3^2 - y_0^2 = b^2r_1^2 - r_0^2\tag7$$
my next step would be to rearrange 5 for r0^2 and substitute into 6 and 7 which I've done and then to rearrange for r1^2 and substitute again however this still leaves me with only 1 equation containing x and y.