Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Find the best-fit circle for a set of points
ResourceFunction["CircleFit"][pts] returns the best-fit circle for the points pts. | |
ResourceFunction["CircleFit"][w→pts] returns the best-fit circle for the points pts having the weights w. | |
ResourceFunction["CircleFit"][w→pts,"Association"] returns an association with the center, the radius, the Circle, a pure function etc. |
Find the circle through 4 points and visualize the result:
In[1]:= |
Out[1]= |
Find the best-fitting circle for a 2500 points:
In[2]:= |
Out[2]= |
Specify weights:
In[3]:= |
Out[3]= |
Return an Association with all the details:
In[4]:= |
Out[4]= |
For 2 points, the center of the circle is the midpoints of the points:
In[5]:= |
Out[5]= |
When no points are given, a Failure object is returned:
In[6]:= |
Out[6]= |
When 3 points are given and they are collinear, a Failure object is returned:
In[7]:= |
Out[7]= |
The case of multiple collinear points results in circle that is far away with a large radius:
In[8]:= |
Out[8]= |
Find the best-fitting circle for points clustered around a circular arc:
In[9]:= |
Out[9]= |
This work is licensed under a Creative Commons Attribution 4.0 International License