Hi,
I think the following may work:
i.e. lets say we have array of N points pt1,pt2, ... ptN and want to find an arc that approx fits as many as possible points starting from pt1
1. we take pt1,pt2 and pt3 and find the center point of arc that fits that these points, let call it c1
2. then we take pt2, pt3, pt4 and do the same -> we get c2
3. calculate avg./midpoint of center points c1 and c2 -> c_avg
3. find the line having each point equally distant from pt1 and pt2 and on that line find the point that is closest to c_avg, use that point as the actual arc center -> ca
4. check if all pt1 ... pt4 fits within tolerance to the arc defined by pt1, pt4 and ca (center)
5. if so, repeat the same from step 2 for points pt3, pt4, pt5 (we get another center c3, and new c_avg (from c1,c2,c3) and new ca, arc spanning the pt1...pt5)
repeat that steps 2-5 until we find the that some point does not fit within defined tolerance, then we add the previous (fitting ok) arc to output, remove points that fit to it and start again with the remaining points. If only two points remain add a line segment to output (the same in case when some three subsequent points are collinear).
I'll try it in the next days to see if it actually works. Also I'll see if I can use some of the math from
http://www.maths-in-industry.org/miis/6 ... 104_P7.pdf suggested by @RatonLaveur, this looks helpful, ty
BR
K.