Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

estimate_normal: Move to plane, test, and refactor #102

Closed
4 tasks
paulmelnikow opened this issue Nov 6, 2019 · 1 comment · Fixed by #136
Closed
4 tasks

estimate_normal: Move to plane, test, and refactor #102

paulmelnikow opened this issue Nov 6, 2019 · 1 comment · Fixed by #136

Comments

@paulmelnikow
Copy link
Member

  • Add tests (ref 100% test coverage #52)
  • Add documentation
  • Use vg.major_axis, avoiding use of undeclared scipy dependency
  • Use vg.shape.check
@paulmelnikow
Copy link
Member Author

This function is very similar to Plane.fit_from_points():

@classmethod
def fit_from_points(cls, points):
"""
Fits a plane whose normal is orthgonal to the first two principal axes
of variation in the data and centered on the points' centroid.
"""
vg.shape.check(locals(), "points", (-1, 3))
eigval, eigvec = np.linalg.eig(np.cov(points.T))
ordering = np.argsort(eigval)[::-1]
normal = np.cross(eigvec[:, ordering[0]], eigvec[:, ordering[1]])
return cls(points.mean(axis=0), normal)

paulmelnikow added a commit that referenced this issue Dec 2, 2019
The implementation depends on scipy and it duplicates another method `Plane.fit_from_points()`.

Closes #102
paulmelnikow added a commit that referenced this issue Dec 2, 2019
The implementation depends on scipy and it duplicates another method `Plane.fit_from_points()`.

Closes #102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant