function [center,radius] = fitCircle(points)
    %https://dtcenter.org/met/users/docs/write_ups/circle_fit.pdf
    center = zeros(1,2);
    xm = mean(points(:,1));
    ym = mean(points(:,2));
    u = points(:,1) - xm;
    v = points(:,2) - ym;
    Suv = sum(u.*v);
    Suu = sum(u.^2);
    Svv = sum(v.^2);
    Suuv = sum(u .* u .* v);
    Suvv = sum(u .* v .* v);
    Suuu = sum(u.^3);
    Svvv = sum(v.^3);
    
    A = [Suu, Suv; Suv,Svv];
    B = 0.5 * [Suuu + Suvv; Svvv + Suuv];
    C = linsolve(A,B);
    center(1) = C(1) + xm;
    center(2) = C(2) + ym;
    radius = sqrt(sum(C.^2) + (Suu + Svv)/length(u));
end
