Jump to content

how to find a best fit arc for a set of points?


Recommended Posts

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 by stenews
Link to comment
Share on other sites

  • Replies 31
  • Created
  • Last Reply

Top Posters In This Topic

  • panda-lite

    11

  • jarekw90

    7

  • stenews

    6

  • ReMark

    3

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Hi eldon,

would depend on exactly what you are trying to do
well...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.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 years later...
  • 6 months later...
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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...