Skip to main content

A Python library for Alpha Shapes in Euclidean and Spherical Geometries.

Project description

AlphaShape

AlphaShape Logo

PyAlphaShape is a Python library for constructing alpha shapes in both
Euclidean and spherical geometries. It supports flexible alpha filtering,
connectivity pruning, and robust geometric computation via scipy.spatial.

  • The Euclidean implementation supports n-dimensional data.
  • The spherical implementation directly supports latitude–longitude data or any set of unit vectors on the sphere.

Alpha shapes are filtered subsets of the complete Delaunay triangulation, where simplices are retained based on the radius of their circumscribing spheres. The spherical implementation exploits the geometric equivalence between the 3D convex hull of unit vectors and the Delaunay triangulation on the surface of the sphere.


Installation

pip install pyalphashape

Ensure you have Python 3.9 or newer installed.

Example Usage

Euclidean Alpha Shape

from pyalphashape import AlphaShape
import numpy as np

# Generate 2D sample data
points = np.random.rand(100, 2)

# Construct alpha shape with given alpha radius
alpha_shape = AlphaShape(points, alpha=0.1)

# Get edges or simplices of the shape
edges = alpha_shape.perimeter_edges()
triangles = alpha_shape.triangle_faces() 

Spherical Alpha Shape

from pyalphashape import SphericalAlphaShape
import numpy as np

# Define latitude and longitude in degrees
# Format: [latitude, longitude]
latlon_points = np.array([
    [34.05, -118.25],  # Los Angeles
    [40.71, -74.01],   # New York
    [51.51, -0.13],    # London
    [35.68, 139.69]    # Tokyo
])

# Create alpha shape directly from lat/lon
spherical_shape = SphericalAlphaShape(latlon_points, alpha=0.5)

# Extract perimeter points and edges
perimeter_points = spherical_shape.perimeter_points
perimeter_edges = spherical_shape.perimeter_edges

License

PyAlphaShape is open source and available under the MIT license. See the LICENSE file for more info.

Citing this Repository

If you use this project in your research, please cite it as:

Melton, N. (2025). PyAlphaShape (Version 0.1.0)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyalphashape-0.1.0.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyalphashape-0.1.0-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file pyalphashape-0.1.0.tar.gz.

File metadata

  • Download URL: pyalphashape-0.1.0.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for pyalphashape-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ba81b2e6c9cd3b8d3653306b9f9f57db8b64cb60c975d45895518af06bdf2bcf
MD5 39bd536d8f497fb39de9d54769862005
BLAKE2b-256 a8d6e6adcd7633072236645c03caaee9530bff26813ea376fefa81f30a1f71a4

See more details on using hashes here.

File details

Details for the file pyalphashape-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyalphashape-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for pyalphashape-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e6ec1ed258a07107ccd9419ddfab509f3b60220dc9cf0c548441879a441eb0f
MD5 867bc8982a346f768330783607ad4067
BLAKE2b-256 464f8c9e41bd8233970faafef11c64c15c49737983f58cdcf07eda478d924ca7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page