stenews Posted October 5, 2012 Posted October 5, 2012 (edited) Hi guys, in the attached file you can see many points. What I need to do is to learn a procedure to draw a circle or an arc that best fits those points. In a different way the question can be: Where is the center and which is the ray of those points? I hope someone of you could point me in the right way. Any help will be appreciated. Stefano. arc_best_fit.dwg Edited October 5, 2012 by stenews Quote
ReMark Posted October 5, 2012 Posted October 5, 2012 I could swear we had a question very similar to this not all that long ago. Quote
stenews Posted October 5, 2012 Author Posted October 5, 2012 Hi ReMark, thanks for your reply. I just loaded a new file...the previous one was wrong Quote
ReMark Posted October 5, 2012 Posted October 5, 2012 OK...so I looked for that thread I thought I remembered but it seems to be very elusive. Maybe I "mis-remembered". LoL I also tried a general Internet search re: "curve fit routine" but did not find anything worthwhile to report back. Quote
stenews Posted October 5, 2012 Author Posted October 5, 2012 right...I tried to draw a spline though the points after that I used a flatten command on it. The last part has been to explode the flattered spline...the final result has been arcs with different rays and centers...but okay which is the right ones? P.S. I read this in a post many time ago...may be it's the one you was tried to remember isn't it? Quote
eldon Posted October 5, 2012 Posted October 5, 2012 Whilst there are probably some mathematical solutions, a useful reply would depend on exactly what you are trying to do. You may be able to approximate without working out dimensions to the squillimeter. If you have surveyed some feature, what units are you using and what is the purpose? Quote
stenews Posted October 5, 2012 Author Posted October 5, 2012 Hi eldon, would depend on exactly what you are trying to dowell...I need to be able to solve this clue:Which is the very best circle or arc that approximately mach those points? what units are you using?I'm working in cm. Quote
ReMark Posted October 5, 2012 Posted October 5, 2012 I would think that the "best" result could be rather subjective. Quote
stenews Posted October 5, 2012 Author Posted October 5, 2012 may be you're right mate! Probably the only way is to draw a 3 points circle and try to move it using its grips points, to find out a reasonable result Quote
eldon Posted October 5, 2012 Posted October 5, 2012 if you draw an arc (three points) through the first point, half way along, and the end point, then you get an arc which is within one unit of all the points. How more accurate do you need? Are you after a least squares adjustment? I don't think that AutoCAD on its own can do that. I usually go for a least effort adjustment. Quote
SLW210 Posted October 5, 2012 Posted October 5, 2012 There are add-ons for sale that will do that. DotSOFT.com Maybe some one has a LISP. Quote
stenews Posted October 6, 2012 Author Posted October 6, 2012 right...as far as I know may be the only reasonable way is the elond'way Thanks anyway to all of you guys Quote
panda-lite Posted September 5, 2016 Posted September 5, 2016 Did you ever found a solution to this problem? Quote
panda-lite Posted September 5, 2016 Posted September 5, 2016 Hope this will help, It has been so useful to me, Thanks to Julio Kovacs PHD Math. Least_Squares_Circle.pdf fitcir3.lsp Quote
jarekw90 Posted March 19, 2017 Posted March 19, 2017 Hope this will help, It has been so useful to me, Thanks to Julio Kovacs PHD Math. This lisp works very well, but only in world UCS... Second, it would be better if the center of the circle created in the average elevation of the selected points / objects. Have someone ideas to solve this 2 problems? Quote
panda-lite Posted March 25, 2017 Posted March 25, 2017 Yes, the routine only works on 2D World UCS, sorry about that. If point are in 3D space, it is possible to find the least square plane of them applying the process on the article of Jean Jacqueline at https://www.scribd.com/doc/31477970/Regressions-et-trajectoires-3D I have a lisp for this but works in combination with an excell spreadsheet. In addition, I will have to figure how to plot the circle other than the World UCS. Quote
jarekw90 Posted March 27, 2017 Posted March 27, 2017 Yes, the routine only works on 2D World UCS, sorry about that. If point are in 3D space, it is possible to find the least square plane of them applying the process on the article of Jean Jacqueline at https://www.scribd.com/doc/31477970/Regressions-et-trajectoires-3D I have a lisp for this but works in combination with an excell spreadsheet. In addition, I will have to figure how to plot the circle other than the World UCS. I have found a Lisp which do approximation of 3D points (PLANEFIT in Attachments). When You use that for selected points, in results You will have two Xlines, then take UCS on 3 points on Xlines and copy with base points on intersection of Xline and paste to World UCS. Now You can use Your lisp or BFC (in Attachemnt), then You should have the same results like 3d circular regression. Most important problem for me is a creating circle always in elavation zero, when I have a lot of circles in the same vertical. The best solution for me would be creating circle in the average Z of selected points. PLANEFIT.LSP BFC.LSP Quote
panda-lite Posted March 28, 2017 Posted March 28, 2017 Jarekw90, Thank you for the attachments. Planefit.lsp looks that works very well, I just ran it once against a previous job and it lands pretty close to what I have. I did also try BCF.lsp on the original set of coordinated points the author provides and I got a lot of residuals, 42 times larger than fitcir3.lsp. I got fitcir4.lsp that is the same as fitcir3.lsp but averages the points z-coo and place the circle there. I have not tested it enough for errors, it is still 2D. I did change the last function c:out() where you specify the variable "gap" to the desired margin of error, otherwise points will be outliers. You have to re-run "fitcir" and "out" until there are no more outlier points, that are changed to layer "dump", which needs to be created in advance. fitcir4.lsp Best-Fit-Circle.dwg Quote
jarekw90 Posted March 29, 2017 Posted March 29, 2017 I have found a Lisp which do approximation of 3D points (PLANEFIT in Attachments). When You use that for selected points, in results You will have two Xlines, then take UCS on 3 points on Xlines and copy with base points on intersection of Xline and paste to World UCS. Now You can use Your lisp or BFC (in Attachemnt), then You should have the same results like 3d circular regression. Most important problem for me is a creating circle always in elavation zero, when I have a lot of circles in the same vertical. The best solution for me would be creating circle in the average Z of selected points. Thanks a lot. It works realy well. It save a lot time. Have you maybe a lisp what from selected points will be give a average point and automaticly remove selected points? Quote
panda-lite Posted March 29, 2017 Posted March 29, 2017 Thank you. Until I integrate a function to the routine, you may delete your points using the same selection set that fitcir uses. At the command line type: erase !ss and to put a point on the center: point !pt-cen copy and paste (command ".erase" "si" ss)(command ".point" pt-cen) copy and paste this function and execute command "eras", or rename it. (defun c:eras()(command ".erase" "si" ss)(command ".point" pt-cen)(princ)) but fitcir41.lsp has this two commands before the end that should be it for now. I will keep working to plot the circle on UCS other than world. I has been on the surveying business until 2009 and looking to get back to it as soon the economy improves. If it is your need, it may be mine also. I will like to also fit points to a sphere, like the targets from a cloud points. fitcir41.lsp Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.