Get the equation of a circle when given 30 points

723 Views Asked by At

A similar question has been asked before on this site but that was of getting equation of circle using 3 points.

I want my center to be more accurate So my question is how can i get the center of the circle using 30 coordinates on its circumference. Please help me to know how can i get it.

7

There are 7 best solutions below

3
On BEST ANSWER

A circle centered at $(h,k)$ of radius $r$ has equation $(x-h)^2+(y-k)^2=r^2.$ So you can expand this equation and use your thirty points along with least squares to do it.

3
On

If all of the points lie on a common circle, then take the first three points and then find the circle that intersects those three points. Since all of the points lie on the same circle, all of the points must lie on the same circle as the first three points, so the circle of the first three points is the same as the circle of the whole set.

3
On

Hint:

Pick up arbitrary two point, write down the equation of perpendicular line which passes through the midpoint of these two point. Denote the equation for the line as $E1$.

Pick up different arbitrary two point, write down the equation of perpendicular line which passes through the midpoint of these two point. Denote the equation for the line as $E2$.

Set $E1$ and $E2$ into a system of equation, solve it (i.e. find the intersection point of line $E1$ and line $E2$). The solution with respect to $x$ and $y$ is the coordinate of center of the circle.

EDIT: notice that if $E1$ and $E2$ parallel, then $E1$ and $E2$ has numerous solutions.

When use other two point, check whether line about these point is parallel to the one about first chosen points.

0
On

The problem is much more complex since it depends how you express the objective function (in other words, what kind of distances to the circle you want to consider).

Probably the simplest (method 1) would be what Noble Mushtak commented that is to say to find the best $D,E,F$ parameters in the model $$Dx_i+Ey_i+F=x_i^2+y_i^2$$ Using matrices, the solution is almost immediate.

Another simple and explicit method I remember is given here.

More rigorous (method 2) will be to minimize $$F(a,b,r)=\sum_{i=1}^n \left( (x_i-a)^2+(y_i-b)^2-r^2\right)^2$$ The partial derivatives are simple to write but they lead to a nonlinear system of equations. However, you could use the first method to get good estimates of the solution and start a Newton-Raphson procedure to polish the solution.

Still more rigorous (method 3) would be to consider $$d_i=\sqrt{(x_i-a)^2 + (y_i-b)^2} - r$$ which represents the distance from the perimeter to point $(x_i,y_i)$ and to minimize $$G(a,b,r)=\sum_{i=1}^n d_i^2$$ Same problem as before and same solution.

Since the first method gives reasonable estimates, I suppose that the final solution could be obtained using Excel solver as a black box tool.

You could also use the method published here by Jean Jacquelin (he is a MSE user). The book is in French but you will not have any problem. Have a look at pages $12-13$. It is a very simple method and example is given.

Edit

For illustration purposes, I used the following data points $$\left( \begin{array}{cc} 2.5 & 6.5 \\ 2.0 & 8.5 \\ 4.0 & 11.5 \\ 7.5 & 11.0 \\ 9.0 & 9.0 \\ 8.0 & 6.5 \end{array} \right)$$

Using method 1, we find $D=10.81773$, $E=16.84893$, $F=-88.579820$ which correspond to $a=5.40887$, $b=8.42447$, $r=3.41287$.

Using method 2, we get the same results (this is normal).

Using method 3, we obtain $a=5.39989$, $b=8.42763$, $r=3.41031$.

0
On

A circle is not made more accurate by adding more points. 3 non-colinear points fully defines the equation for a circle. Your remaining 27 points are either perfectly on this circle, adding nothing, or they are not perfectly on the circle, in which case there is no equation for a circle through all 30 points.

It strikes me that you are not looking for the equation for a circle that goes through those 30 points, but the best fit for a circle which almost goes through each point. This is a fitting process, not a simple analytic geometry problem.

For a best fit, you have to define what "best fit" means to you. Often it means minimizing the sum of the squares of the errors. Claude Leibovici's answer does a good job of going down that path.

0
On

Pixels in an image are never "accurate" so 3 are insufficient. The circle Hough Transform (CHT) is used for detecting circular objects (and other shapes). https://en.wikipedia.org/wiki/Circle_Hough_Transform It is computationally complex (slow!) and works by transforming the image into 3d "parameter space" where the axes are the possible circle centres (a, b) and the circle radii R. Other useful links are a 2005 lecture: https://www.cis.rit.edu/class/simg782/lectures/lecture_10/lec782_05_10.pdf and the openCV documentation.

0
On

Would this work? For each pair of points $P_i, P_j$ construct the bisector line $L_{ij}$; the point that minimizes the sum of squared distances from $L_{ij}$ is a candidate centre for the circle. The setup is quadratic in number of points (unless you know the sequence of the points along the circumference, in which case it's reasonable to use only N lines), but the solution is trivial, equivalent to finding the apex of an elliptic paraboloid.

I have used the method given here: http://www.dtcenter.org/met/users/docs/write_ups/circle_fit.pdf

I have not got around to reading this: http://www.spaceroots.org/documents/circle/circle-fitting.pdf

Afterthought: If the input is noisy or quantized, it's likely best not to use (only) bisectors of adjacent pairs; better to pair each point with the one most distant.