-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
ENH: spatial: implement alpha shapes #11502
base: main
Are you sure you want to change the base?
Conversation
Cool, it may take me a bit to get around to reviewing this. I think I still need to go back to some of your previous enhancement PRs. |
@tylerjereddy this needs some more work before it is ready for review. I can now use the DisjointSet structure in |
I like this draft mode so converted to it but feel free to dismiss it |
|
||
# solve stack of linear systems of equations with `pinv` (`rcond` handles | ||
# rank-deficient simplices). | ||
Ainv = np.linalg.pinv(A, rcond=rcond) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ilayn I'm using pinv
to solve a stack of least-squares problems. Is there a better way? I would use lstsq
but it doesn't support stacks and looping is too slow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, I guess we have to live with it. pinv
uses SVD so I am surprised that loop is slower. But it is what it is I guess.
What does this implement/fix?
This implements alpha shapes in the
scipy.spatial
module.https://en.wikipedia.org/wiki/Alpha_shape
Most of the work is done by the Delaunay class. The main additions are a stable calculation of the simplex circumcenters and calculation of the alpha intervals in which a facet is on the surface. The approach I have taken is to do the hard work once (calculation of circumradii and alpha intervals) which makes it cheap to test different alpha thresholds.
I would like to add a connected component analysis, so that a suitable alpha value can be chosen automagically, but this requires a fast disjoint-set data structure. We don't appear to have one in scipy. I can't find any reference to it on the SciPy github page or on the mailing list. Does anyone know if this has been discussed previously?Edit: I have added a disjoint set data structure in cython. I might move more of the
_calculate_connectivity_thresholds
function into the cython module to get better performance.Additional information
This PR is WIP for the purpose of collecting feedback. Comments are very welcome.