timziebart / alpha-shapes

A minimal library for alpha shape computation.
BSD 3-Clause "New" or "Revised" License
4 stars 5 forks source link

2D point clouds? #1

Open darribas opened 6 years ago

darribas commented 6 years ago

Hello,

I first wanted to say thank you very much for this little library, it does what it's supposed to and it's very fast! Second I wanted to ask about the possibility of computing alpha shapes for two dimensional point clouds. I've noticed the library currently only accepts three dimensions. I need this functionality so I was going to have a try at modifying your code to adapt it. I know Python but not an expert in computational geometry, would you have any leads or suggestions that could help me? I'd be happy to collaborate or contribute back the resulting code if you want.

Thank you very much in advance.

timziebart commented 6 years ago

Hi, thanks a lot for your compliments and interest, I am happy you like it (: I think it would be little work to adapt it to 2d point clouds. If you are not in a hurry, I would give you some pointers next Monday. Does that sounds good to you? Cheers, Tim

darribas commented 6 years ago

Thanks very much for getting back! Yes, no rush at all. Any sort of information will be helpful. After looking at the main file, it looks like it'd be transforming tetrahedrons into triangles, reducing dimensionality then to areas rather than volumes, but there are a few bits that I could do with some help. Maybe a better approach not to waste your time is for me to have a go at it and issue a PR that you can comment on?

Thanks again,

]d[

timziebart commented 6 years ago

That sounds about right. Here is a page with an equation for the radius of the circumcircle of a triangle. Yes, maybe a PR would be a good way. I guess the basic structure would be straightforward and I could help with getting the speed via numba (: Ah, and I realized I haven't added a license yet, so I would simply go for MIT, as it's scipy compatible. I hope you agree as you contribution will be published under it, too.

darribas commented 6 years ago

Yes, a permissible scipy/pydata compatible would be fantastic. If we get around it later, we could document a bit and put up on PIP :-)

I'll issue a PR and we can discuss issues on it. Then you can either merge or we discuss how to integrate the two before merging.

timziebart commented 6 years ago

Yep, that would be great. Actually, I am rather amazed that you found and used it without at least a readme (:

looking forward to see your code

timziebart commented 6 years ago

I added the BSD-3 clause as it is the scipy license.

darribas commented 6 years ago

I have a working implementation for 2D clouds based off your 3D. Would be happy to contribute back here but not sure what the best API would be. Also, considering contributing it to PySAL as it would be covered by CI, released to a larger audience, etc. I've started a ticket (pysal#1036) to figure out what the best way to do it would be. We might also consider integrating your 3D code if you were interested. What do you think?

timziebart commented 6 years ago

Yep, I would totally agree contributing to PySAL, would be happy if the code find application. For the Code here, the best API would probably be to simple check for the dimension of the number of points when calling get_alpha_shape as it is simply this line (and the functions behind it) that would be different for 2D. The rest should be the same, right?

Concerning PySAL, I will write right in the Issue you referenced.

darribas commented 6 years ago

Excellent! Should we focus on one place rather than duplicating? My call would obviously go for PySAL as it'll probably ensure more people use it. Given the license, it can be in as many places as we want, but just thinking of what would make most sense.