The Problem |
Fitting an equation to a set of data is not an uncommon problem. There´s a large amount of work done in algorithms for finding the ¨best¨ fit for many different definitions of ¨best¨. The person asking me to solve this problem was under the assumption that the normal method, least squares regression, was the best way of going about solving this problem. Actually, performing least squares regression in this case doesn´t really make any sense since the theory applies to only functions. Circles are not functions and so the theory doesn´t apply.
Despite this fact, there was a desire to stick with something like least square regression. I guess it´s like a brand name that people have come to trust. There was talk of some rather complicated solutions, like breaking up the circle into two branches and performing least squares regression on each half in some way, then averaging the results. Anyway you slice it, you´re coming up with an arbitrary algorithm for finding a fit for the function. So really you might as well come up with a sensible arbitrary algorithm.
The solution for the problem is in fact incredibly easy. If you understand what least squares regression is, then you would never attempt to use it for this kind of problem, or anything really remotely close to it.
I resolved the issue with two very clear ideas that cut the Gordian Knot:
- The center of the circle is probably around the center of the points.
- The radius of the circle is probably the average distance from the center.
The Simple Solution |