question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: bestfit_line(points)

See original GitHub issue

Feature 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:open
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
brgcodecommented, Jun 9, 2021

i can send a PR later today so you can test if that is what you are looking for

0reactions
yck011522commented, Jun 9, 2021

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 and bestfit_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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found