Note

Click here to download the full example code

Optimized Alpha ExampleΒΆ

Using the optimized alpha function for obtaining the alpha parameter.

plot optimizedalpha
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 import alphashape
 import matplotlib.pyplot as plt
 from descartes import PolygonPatch

 # Define input points
 points = [(0., 0.), (0., 1.), (1., 1.), (1., 0.),
           (0.5, 0.25), (0.5, 0.75), (0.25, 0.5), (0.75, 0.5)]

 # Determine the optimized alpha parameter
 alpha = alphashape.optimizealpha(points)

 # Generate the alpha shape
 alpha_shape = alphashape.alphashape(points, alpha)

 # Initialize plot
 fig, ax = plt.subplots()

 # Plot input points
 ax.scatter(*zip(*points))

 # Plot alpha shape
 ax.add_patch(PolygonPatch(alpha_shape, alpha=.2))

 plt.show()

Total running time of the script: ( 0 minutes 1.239 seconds)

Download Python source code: plot_optimizedalpha.py

Download Jupyter notebook: plot_optimizedalpha.ipynb

Gallery generated by Sphinx-Gallery

Alpha Shape Toolbox

Navigation

Contents:

  • Alpha Shape Toolbox
  • Installation
  • Usage
  • Gallery
    • Alpha Shape Gallery
  • API Reference
  • Contributing
  • Credits
  • History

Related Topics

  • Documentation overview
    • Gallery
      • Previous: Simple Example
      • Next: Alpha Shapes with GeoPandas GeoDataFrame

Quick search

©2019, Kenneth E. Bellock. | Powered by Sphinx 3.2.1 & Alabaster 0.7.12 | Page source