Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Yuck solution in Clear category for Three Points Circle by Sioul
def checkio(data):
x1, y1, x2, y2, x3, y3 = map(int,data.replace('(','').replace(')','').split(','))
x12, x13 = x1 - x2, x1 - x3
y12, y13 = y1 - y2, y1 - y3
y21, y31 = y2 - y1, y3 - y1
x21, x31 = x2 - x1, x3 - x1
sx13 = x1**2 - x3**2
sy13 = y1**2 - y3**2
sx21 = x2**2 - x1**2
sy21 = y2**2 - y1**2
y0 = - (((sx13)*(x12) + (sy13)*(x12) + (sx21)*(x13) + (sy21)*(x13)) /
(2*((y31)*(x12) - (y21)*(x13))))
x0 = - (((sx13)*(y12) + (sy13)*(y12) + (sx21)*(y13) + (sy21)*(y13)) /
(2 *((x31)*(y12) - (x21)*(y13))))
r = ((x1-x0)**2 + (y1-y0)**2)**0.5
return f"(x-{round(x0,2):g})^2+(y-{round(y0,2):g})^2={round(r,2):g}^2"
Nov. 8, 2019