2
$\begingroup$

Two points P1(x1,y1) and P2(x2,y2) are known. In addition, a line slope passing through P1 is known. The aim is to construct a circle (or circular arc) that it passes through both P1 and P2 and it is tangent to the line. How can we find the center of the circle and the radius with those given information? (2 points and 1 tangent)

As it can be seen in the figure, the radius and the center (in green) are unknown and aim is to find the center point and radius (or curvature)

Circular arc

$\endgroup$
  • $\begingroup$ $$(x_1-x_0)^2+(y_1-y_0)^2=r^2\tag{1}$$ $$(x_2-x_0)^2+(y_2-y_0)^2=r^2\tag{2}$$ $$\mathrm{d}(K,p_0)=\frac{|Ax^2+Bx+C|}{\sqrt{A^2+B^2}}=r\tag{3}$$ $\endgroup$ – UserX Oct 29 '14 at 12:19
  • $\begingroup$ $$-\frac{A}{B}=m\tag{4}$$ $$P(x_1,y_1) \in K \iff Ax_1+Bx_2+C=0\tag{5}$$ These are the information I extracted. $\endgroup$ – UserX Oct 29 '14 at 12:19
  • $\begingroup$ The center is on the line perpendicular to the tangent, and it's also equidistant from the two points, which puts it on the perpendicular bisector of the line segment joining the two points. $\endgroup$ – Gerry Myerson Oct 29 '14 at 12:31
  • $\begingroup$ Thank you for the method, I also tried to apply something similar, however the problem is that this calculation is done many times in a simulation and sometimes the slope can be 0, then the slope of the perpendicular line to this slope becomes infinity and I think that creates a problem. Is it possible to find the center and radius (what I need) without using the slope of the virtual line perpendicular to m and passing through P1 and center? $\endgroup$ – birincilikteli Oct 29 '14 at 13:48
1
$\begingroup$

The line from the centre to P1 is perpendicular to the given line; and the centre is equidistant from P1 and P2. That gives you two lines that the centre must lie on.

Let the given line be $ax+by=c$. If you just have its slope $m$, you can take $a=-m$ and $b=1$. (And $c=ax_1+by_1$, but we're not going to use that.) A perpendicular line has the form $bx-ay = \text{something}$, and the something can be determined by using the fact that the line is supposed to go through P1. Thus our first line is $$ bx - ay = bx_1 - ay_1 \tag{1} $$ The line through P1 and P2 is $$ (y_1-y_2)x - (x_1-x_2)y = x_2y_1 - x_1y_2 $$ A perpendicular line has the form $$ (x_1-x_2)x + (y_1-y_2)y = \text{something} $$ and the something can be determined by the fact that we want the line to go through the midpoint of P1P2, that is, $(\frac12(x_1+x_2),\frac12(y_1+y_2))$. Thus our second line is $$ (x_1-x_2)x + (y_1-y_2)y = \tfrac12(x_1^2+y_1^2-x_2^2-y_2^2) \tag{2} $$ The equations (1) and (2) together form a linear system which can be solved by standard methods, e.g., Cramer's rule. The solution is the centre of the desired circle, and the radius, if needed, is the distance from that point to P1.

$\endgroup$
  • $\begingroup$ Indeed. But my problem is that sometimes slope m can be zero and thus its perpendicular slope becomes infinity and this slope comes a product in the calculation of center and therefore radius. Is there any other way that we can implement? I.e. polar coordinates come into my mind, but I cannot figure out how to do it. $\endgroup$ – birincilikteli Oct 29 '14 at 13:51
  • $\begingroup$ Use normal equations $ax+by=c$ instead of point-slope equations $y=mx+b$; they handle vertical lines much better. (Also, you can solve the resulting linear system explicitly via Cramer's rule, which doesn't require any assumptions about particular variables being nonzero.) $\endgroup$ – user21467 Oct 29 '14 at 14:01
  • $\begingroup$ Thank you for your feedback. However in that case I still have unknowns in the coefficients of the linear system (x0 and y0 appear as coefficients of x and y) that cannot be solved. Thus I require additional information as well, which is the relation between radius and P1 and P2 and when I calculate radius from there, I get the same point slope equations as before. $\endgroup$ – birincilikteli Oct 30 '14 at 8:57
  • $\begingroup$ Okay, added some more. $\endgroup$ – user21467 Oct 30 '14 at 14:57
  • $\begingroup$ Thank you, I will try it out but it seems quite good explained. $\endgroup$ – birincilikteli Oct 31 '14 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.