Jump to content

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


Recommended Posts

  • Replies 31
  • Created
  • Last Reply

Top Posters In This Topic

  • panda-lite

    11

  • jarekw90

    7

  • stenews

    6

  • ReMark

    3

Panda-lite, thanks a lot;). It solve me all problems about best fit circle for now. One extra question for You. Have you a simple lisp what give a average coordinates from selected points? Just select, average, removed old points and put in new average point. It would be great for situation when have measurment the same points from diffrent station, without number.

Link to comment
Share on other sites

However I have one extra problem with best fit circle.;) It would be useful to add function when the radius is known, just to find the centre. Now in bad configuration of points, calculated radius have a big different from nominal.

Link to comment
Share on other sites

Jare, on regular Autocad points, and Land Desktop COGO points no problems for the routine. Civil Design type of points are still a problem for me, and to be able to read the object coordinates I read that needs to be done with API application type of code.

Run command TT from DXF3-2.lsp and compare your points to the listing on Point-type.txt.

 

If dissimilar to those, most likely is the the type of C3D.

 

I will like to see the DXF listing of yours in order to do something.

 

worst case scenario, you may snap a regular Autocad point to those entities and still get the average.

DXF3-2.LSP

Point-Type.txt

Link to comment
Share on other sites

Yes, the radius is floating. The mathematical model should have a constrain for the radius. I will have to look into that. Civil 3D has a menu of fitting lines and curves where you can fix desired points (I will have to check on the radius). You may check for a package like Survey or Express Tools with your Autocad Dealer for your Autocad Version.

I am looking into Microsurvey Software, like StarNet, at least.

MicroSurvey Releases embeddedCAD 2017 and inCAD 2017

http://helpdesk.microsurvey.com/index.php?/News/NewsItem/View/238/microsurvey-embeddedcad-2017

 

Link to comment
Share on other sites

Jare, on regular Autocad points, and Land Desktop COGO points no problems for the routine. Civil Design type of points are still a problem for me, and to be able to read the object coordinates I read that needs to be done with API application type of code.

Run command TT from DXF3-2.lsp and compare your points to the listing on Point-type.txt.

 

If dissimilar to those, most likely is the the type of C3D.

 

I will like to see the DXF listing of yours in order to do something.

 

worst case scenario, you may snap a regular Autocad point to those entities and still get the average.

 

In attachments dxf list from my motherland language and english language pack Autocad. I always paste points as a regular Autocad points. ;)

Point-Type2.txt

Link to comment
Share on other sites

Jare, that will be easy. I will look for one of my routines. Now I have to go to bed, it is 22:50 in Southern California and I have to be up tomorrow at 6:00. Must be the morning there..!!

Link to comment
Share on other sites

  • 1 month later...

I've modifided your lisp fitcircle. I've changed (setq pt-ab (getpoint "\nAprox cen: ")) for (ser pt-ab pkt2); pkt2 is just calculeted average point from selected points.

Additionaly I've changed (command "_circle" .. .. ) for function (entmake ...).

I'm still thinking about solution when the radius is knowed...

fitcir5.lsp

Link to comment
Share on other sites

Thank you Jare for the modifications and for remind me of the upgrade, sorry for the delay. The average of points ensure that you pick a point inside the circle/arc. If you activate line 46, (command ".circle" pt-ab 1.234) you can see how the routine approaches the center. On a small portion of arc, picking a point outside of it may give you an undesirable result and it is not protected against it. use c:selcirc from filters.lsp to select the circles that mark the trail. entmake is the way to go, thanks.

 

The original routine did calculate an optimal radius, on this one you give the radius. I have been trying it just today and seems to work well. Use it with caution. You may check it against known part of your drawings. I will keep checking on it, but so far seems to be working right. Attached there is a drawing where I was checking it.

I just added line 25, (setq acum-rad (getreal "\nRadius: ")) and deactivated line 30, ;(setq acum-rad 0) and line 106 ;(setq acum-rad (+ acum-rad (/ dist top)))

 

If you read the PDF items 2) and 3) radius is a multiplier, line 106 will not calculate item 1) since you are providing it.

In the future, I will like to calculate the fitted radius and the difference with the one provided, as a check.

 

I have been thinking how to do it, like in the case of raster images they use Hough Transform,

but since we have the points and the routine is very strong, instead of calc the radius, we fix it.

 

You may check your own circles by the use of commands difer, difer2 and diferat, but you will have to deactivate line 63, (command ".erase" "si" ss) because the routine uses the same selection set and needs to read the points. difer2 will give the residuals summation.

 

Please let me know of any anomaly and any feedback will be very appreciated.

Jorge.

Fitcir4-radius-1.dwg

Fitcir4-Radius.lsp

filters.lsp

Least_Squares_Circle.pdf

Edited by panda-lite
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...