Feature Request: bestfit_line(points)
See original GitHub issueFeature Request
As a [user], I want [to analyse some measured 3D points and fit them to a line] so that [benefit].
Details
Is your feature request related to a problem? Please describe.
I was trying to find a bestfit line function in compas.
Turns out there are the more complex bestfit_frame_numpy
, bestfit_plane
, bestfit_plane_numpy
and bestfit_sphere_numpy
, but not bestfit_line.
Describe the solution you’d like Just similar to other fitting analysis, I assume it can be a numpy implementation.
Describe alternatives you’ve considered I put together something myself using numpy copying some code I found online:
data = np.array(measured_points)
datamean = data.mean(axis=0)
uu, dd, vv = np.linalg.svd(data - datamean)
line_vector = vv[0]
Additional context Add any other context or screenshots about the feature request here.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Calculating "best fit" line feature based on three height values
Anyone knows how to create a curve of best fit between three point locations? In my case these points are z (height) values...
Read more >Creating best fit line from point data using ArcGIS for Desktop?
try: '''This Tool will take a feature class of points and it will create a best fit line based on a polynomial regression...
Read more >To Create AutoCAD Lines by Best Fit | Civil 3D 2020
To create an AutoCAD line by best fit from Autodesk Civil 3D points. If you are creating a best fit line for a...
Read more >Best Fit Line ~ AutoCAD ~ LDD - SurveyorConnect
Fit line by (Number/):. To select the points, do one of the following: Type Selection and then select the COGO point objects. You...
Read more >Other lines parallel to a Best fit line on a scatter graph?
To start the conversation again, simply ask a new question. ... graph going through to points furthest above and below the best fit...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
i can send a PR later today so you can test if that is what you are looking for
Hi, two things to add to the feature request (now I start to use my own implementation more):
It would be even nicer if there could be both
bestfit_line
andbestfit_line_segment
The line segment version would return a segment that covers the min and max closest point projected to the line.In general, it seems to make sense that these functions take unsorted points input. But it would be nicer if they will give a consistent line direction when faced with a sorted points input. This can save a lot of user code when using these functions to analyze measurement data.