You can reduce the problem to finding the "widest" axis of your cloud of points. This will be a diameter of your smallest circle. Any smaller circle couldn't possibly enclose the extremal points that define this diameter.
An inefficient algorithm to accomplish this begins by looping over angles ɵ from 0 to 45 degrees. For each angle ɵ, transform the coordinates of every point by rotating the coordinate system by ɵ. Then simply find max(x)-min(x)
and max(y)-min(y)
to find the maximum extent for this rotation. Continue to find the maximum extent for all rotations.
Here is a C program which implements this simple algorithm, returning the length of the minimum diameter:
To adapt this code to your particular problem, add this code at the end:
/* parameters of smallest circle enclosing the points */
double center_x = (x[max_i]+x[min_i])/2;
double center_y = (y[max_i]+y[min_i])/2;
double radius = sqrt( (x[max_i]-x[min_i])*(x[max_i]-x[min_i]) +
(y[max_i]-y[min_i])*(y[max_i]-y[min_i])))/2;
There is doubtlessly a more efficient approach (for instance: first find the convex hull, and then consider only those points defining the hull), but this might suffice if the number of points is not astronomical.