

So, I've had a few ideas that I've wanted to pursue, and for those, I need a few
tools to perform the tasks more rigorously than "by eye".
I looked at converting some Javascript code, but gave up on that,
https://jsxgraph.unibayreuth.de/wiki/index.php/Leastsquares_circle_fitting
then found a semiencouraging post,
https://www.codeproject.com/Questions/228108/LinearleastsquarescirclefitinCorCplusplus
and then found the original paper,
https://ir.canterbury.ac.nz/bitstream/handle/10092/11104/coope_report_no69_1992.pdf?sequence=1
which I thought I could puzzle out  the solution seemed tantalizingly close,
https://towardsdatascience.com/buildinglinearregressionleastsquareswithlinearalgebra2adf071dd5dd
https://online.stat.psu.edu/stat462/node/132/
But good ole' Coope just used too many x's and changes of variables, and
sparsely described methods of getting from point A to point B.
Luckily, I found some "good" c++ code, and I was able to successfully convert
the Taubin algebraic solution before I left for work:
https://people.cas.uab.edu/~mosya/cl/CPPcircle.html
and then got back home and worked on the geometric LevenbergMarquardt fit, only
to find that it's written with a host of ugly "goto" statements. :O :(
I somehow navigated a path to simulate that in SDL, code the few dependencies,
and fake or ignore the rest. Got stuck in an endless while loop somewhere when
I started whittling down the circle to an arc of pi*0.6, but fixed that, and...
Seems to be working well enough. So now I have a regular linear least squares
regression macro, and at least one set of (seemingly) fully functional circle
fitting macros.
Onwards we trudge....
Post a reply to this message
Attachments:
Download 'leastsquares_circle.png' (37 KB)
Preview of image 'leastsquares_circle.png'

