Skip to content

A Python package for constructing 2D alpha hulls for negative alphas.

License

Notifications You must be signed in to change notification settings

itaipelles/alphashapy

Repository files navigation

alphashapy

PyPI Docs Tests Changelog License

A Python package for constructing 2D alpha hulls for negative alphas. The algorithm is from the paper:

H. Edelsbrunner, D. Kirkpatrick and R. Seidel, "On the shape of a set of points in the plane," in IEEE Transactions on Information Theory, vol. 29, no. 4, pp. 551-559, July 1983, doi: 10.1109/TIT.1983.1056714.

And the implementation relies on Qhull's implementation of Voronoi diagrams, wrapped nicely for Python by Scipy here.

In the future I will try to add alpha shapes for negative alphas as well, today there is no python package that does that.

For alpha shapes with positive alphas, please use alphashape (which also supports higher dimensions) or alpha_shapes, both are great but do not currently (August 2024) support alpha hulls nor negative alphas.

Installation

Install this library using pip:

pip install alphashapy

Usage

import numpy as np
from alphashapy import alphahull_negative_alpha
points = np.random.rand(100,2)
alpha = -1
alphahull_negative_alpha(points, alpha)

Development

To contribute to this library, first checkout the code. Then create a new virtual environment:

cd alphashapy
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

python -m pip install -e '.[test]'

To run the tests:

python -m pytest