Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Three Points Circle by fed.kz
# http://delphimaster.net/view/9-1172844946
def checkio(data):
(x1, y1), (x2, y2), (x3, y3) = eval(data)
A = x2 - x1; B = y2 - y1; C = x3 - x1; D = y3 - y1;
E = A * (x1 + x2) + B * (y1 + y2); F = C * (x1 + x3) + D * (y1 + y3);
G = 2 * (A * (y3 - y2) - B * (x3 - x2))
if G == 0: return
x = (D * E - B * F) / G
y = (A * F - C * E) / G
R = round(((x1 - x)**2 + (y1 - y)**2)**0.5, 2)
x, y, R = map(lambda x: str(round(x, 2)).rstrip('.0'), (x, y, R))
return f'(x-{x})^2+(y-{y})^2={R}^2'
Oct. 2, 2018
Comments: