Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Symple math solution in Clear category for Three Points Circle by 1-more
def checkio(data):
((Ax,Ay), (Bx,By), (Cx,Cy)) = eval(data)
D = 2.0*(Ax*(By-Cy) + Bx*(Cy-Ay) + Cx*(Ay-By))
Ux= ((Ax**2+Ay**2)*(By-Cy)+(Bx**2+By**2)*(Cy-Ay)+(Cx**2+Cy**2)*(Ay-By))/D
Uy= ((Ax**2+Ay**2)*(Cx-Bx)+(Bx**2+By**2)*(Ax-Cx)+(Cx**2+Cy**2)*(Bx-Ax))/D
R = ((Ux-Ax)**2+(Uy-Ay)**2)**0.5
return '(x-%g)^2+(y-%g)^2=%g^2' % (round(Ux,2), round(Uy,2),round(R,2))
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio(u"(2,2),(6,2),(2,6)") == "(x-4)^2+(y-4)^2=2.83^2"
assert checkio(u"(3,7),(6,9),(9,7)") == "(x-6)^2+(y-5.75)^2=3.25^2"
Feb. 21, 2018