compas-dev / compas-dev/compas

Feature Request: bestfit_line(points)

Open
#846 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
386
Forks
122
Avg merge
11d 46m
Merged PRs (30d)
1

Description

# 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.