Given --
1) the coordinates of 2 points on a circle (X1,Y1) and (X2,Y2)
2) a line that is tangent to the circle -- y = mx + b where m is the slope and b is the y-intercept. (The point of tangency isn't known and generally wouldn't be one of the above two points on the circle.)
Find -- the center of the circle (X0,Y0)
Note that the radius of the circle isn't known in advance.
The problem is shown here (
https://www.emathzone.com/tutorials/geometry/equation-of-a-circle-given-two-points-and-tangent-line.html).
The solution requires solving a set of nonlinear simultaneous equations. I might be able to do this but the math is tedious and would be error prone. Therefore, I'm looking for a pre-packaged procedure for this.
Thanks for any suggestions,
Don C.
Edit #1 --
Designate the circle center as (X0,Y0). Designate the tangency point as (X3,Y3). The circle radius will be R. These 5 parameters are initially unknown.
Equations to be solved --
1) Y3 = m*X3 + b // equation of tangent line evaluated at (X3,Y3)
2) R^2 = (X1 - X0)^2 + (Y1 - Y0)^2 // square of dist from (X1,Y1) to (X0,Y0)
3) R^2 = (X2 - X0)^2 + (Y2 - Y0)^2 // square of dist from (X2,Y2) to (X0,Y0)
4) R^2 = (X3 - X0)^2 + (Y3 - Y0)^2 // square of dist from (X3,Y3) to (X0,Y0)
5) Y0 + (1/m)*X0 = Y3 + (1/m)*X3 // requires some manipulation to achieve
From the above there are 5 equations in 5 unknowns -- theoretically solvable. However, some of the equations involve squared terms which makes the solution difficult.
Simple (easy) example --
(X1,Y1) = (-2,1)
(X2,Y2) = (+2,1)
m = 0 // horizontal tangent line
b = 0 // tangent line intersects the Y axis at Y=0
From the last 2 criteria the tangent line must be coincident with the X axis.
The first 2 criteria are symmetric about the Y axis so that the circle center must lie on the Y axis.
The result of these conditions is that the tangent point must lie on the intersection of the X and Y axes -- i.e., (X3,Y3) = (0,0). The original problem now reduces to one with 3 known points on the circle. The results are --
R = 2.5
(X0,Y0) = (0,2.5)
See --
https://www.mathportal.org/calculators/analytic-geometry/circle-through-three-points.phphttp://www.ambrsoft.com/TrigoCalc/Circle3D.htmThe above example was easy because m = 0 and b = 0. The problem is significantly more difficult if other conditions for the tangent line are used; hence, my original request.