I have recently run into a problem while trying to get the center of a circle from 3 points $A,B,C$ on its circumference.The equations I used for this require to know the slope values of the lines $\overline{AB},\overline{BC}.$ But one of these slope values is infinite/undefined when the $x$-coordinate of $B$ matches that of $A$ or $C$, hence I am not able to find the center. Is there a work around for finding the center purely using only formulas? I need to use them in a computer code.
-
1$\begingroup$ For Googling reference, it's worth noting that this is equivalent to finding the circumcenter of the triangle $\triangle ABC$. $\endgroup$– SemiclassicalCommented Nov 30, 2016 at 18:13
-
1$\begingroup$ @Semiclassical has strong google-fu. Follow the training wisely. $\endgroup$– John HughesCommented Nov 30, 2016 at 18:14
2 Answers
If the slope is zero, you know the $y$ coordinate of the center because two of your points have the same $x$ coordinate and the bisector is the line halfway between them. Similarly if the slope is infinite, you know the $x$ coordinate of the center. You can use this $x$ or $y$ in the line bisecting the segment between the third point and one of the two you have used.
-
$\begingroup$ omg!! how come I didn't see that , Thank-you very much. $\endgroup$– cpt.JohnCommented Nov 30, 2016 at 18:15
Suppose the points are $A=(a,b), B=(a,c),$ and $C=(d,e)$
So line $AB$ has slope $\frac{c-b}{a-a} = \frac{c-b}0 = \infty$. That's fine. The equation for the line is $x = a$. The perpendicular bisector will have a slope of $0$ and the midpoint is $(a,\frac{b+c}2)$ so the formula of the perpendicular bisector is $y = \frac{b+c}2$.
Likewise if you have to points with a slope of $0$ then the perpendicular bisector will have infinite slope and the equation will be $x = k$ (where $k$ is the $x$ value of the midpoint).