fast-alphashape
A Rust backed implementation for generating 2D alpha shapes from points.
This project is still a prototype and should not be considered production-ready.
Alpha shapes are often used to generalise bounding polygons containing sets of points. The alpha parameter is defined as the value a, such that an edge of a disk of radius 1/a can be drawn between any two edge members of a set of points and still contain all the points. The convex hull, a shape resembling what you would see if you wrapped a rubber band around pegs at all the data points, is an alpha shape where the alpha parameter is equal to zero.
Installation
pip install fast-alphashape
Quick start
The package provides an alphashape function that takes a 2D array of points and an alpha value:
import numpy as np
from fast_alphashape import alphashape
points = np.array(
[
(0.0, 0.0),
(0.0, 1.0),
(1.0, 1.0),
(1.0, 0.0),
(0.5, 0.25),
(0.5, 0.75),
(0.25, 0.5),
(0.75, 0.5),
]
)
alpha_polygon = alphashape(points, alpha=2.0)
Development
Prequisites:
- Python (>=3.7) and make
- Rust toolchain
After cloning the repository, the Makefile includes helpful commands for setting up a development environment, linting, formatting, testing, and benchmarking. Get started as follows:
# setup a new virtual environment
python -m venv .venv
source .venv/bin/activate
# install the development dependencies
make install
# check other available commands
make help
Tooling:
- Cargo and Pytest are used for testing the Rust and Python code respectively (see
/tests). - Python code is linted using flake8 and formatted using Black; rust code with
cargo fmtandcargo clippy. - pre-commit is used to run these checks locally before files are pushed to git
- The Github Actions pipeline runs these checks and tests
- Semantic-release is used with conventional commits for automated releasing to PyPI
Credits
- This project is largely a Rust port of the Alpha Shape Toolbox by Ken Bellock
- Image credit: Sigbert, CC BY-SA 3.0, via Wikimedia Commons
Metadata
Release files for fast-alphashape 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fast_alphashape-0.2.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.7 | abi3 | Linux glibc 2.17+ x86-64 | Details for fast_alphashape-0.2.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
Release files / fast_alphashape-0.2.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fast_alphashape-0.2.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.7 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f3a66a588985158dcbea3c423dfd9b3a2d5e3a33e2a3bdc8d05f9aa5d08e02b4
|
|
BLAKE2b-256 checksum How to use checksums |
2c3f0ee75b6c4672f99e70e1b8ced89223e5ddc52b67fcae70c8badb0280bdae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.1
|
Security for fast-alphashape 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.