bellockk / alphashape

Toolbox for constructing alpha shapes.
MIT License
252 stars 28 forks source link

Examples from documentation are not working #40

Open fabiosalvati opened 1 year ago

fabiosalvati commented 1 year ago

Description

I tryied the simple example proposed in the documentation (read also 1.1.2 from the Alphashape documentation)

What I Did

The code I tried:

` import alphashape import matplotlib.pyplot as plt from descartes import PolygonPatch

points = [(0., 0.), (0., 1.), (1., 1.), (1., 0.), (0.5, 0.5)] alpha = 0.2 alpha_shape = alphashape.alphashape(points, alpha) fig, ax = plt.subplots() ax.scatter(zip(points)) ax.add_patch(PolygonPatch(alpha_shape, alpha=.2)) plt.show() `

I obtained the following: IndexError: too many indices for array: array is 0-dimensional, but 2 were indexed

Additional notes:

brockbrownwork commented 1 year ago

I also get this error from this snippet.

bfhh521 commented 1 year ago

You can check out this link, the methods inside are effective for me.

ashixu commented 8 months ago

It may be some error in descartes. But I think you can do not use it.

x, y = alpha_shape.exterior.xy
ax.plot(x, y, color='red')

I use these code to plot.