bellockk / alphashape

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

ValueError in PyPi 3D Alphashape Default Example on Windows #23

Open alerigonzalez opened 3 years ago

alerigonzalez commented 3 years ago

Description

I was trying to recreate verbatim the 3D alphashape example found on https://pypi.org/project/alphashape/ (about 1/3 down the page). I copied the code into a Jupyter notebook, and it ran correctly, but a recent update (from a sub-package?) causes a ValueError described with photos below.

What I Did

import alphashape
import pandas as pd
import matplotlib.pyplot as plt

points_3d = [
    (0., 0., 0.), (0., 0., 1.), (0., 1., 0.),
    (1., 0., 0.), (1., 1., 0.), (1., 0., 1.),
    (0., 1., 1.), (1., 1., 1.), (.25, .5, .5),
    (.5, .25, .5), (.5, .5, .25), (.75, .5, .5),
    (.5, .75, .5), (.5, .5, .75)
]

df_3d = pd.DataFrame(points_3d, columns=['x', 'y', 'z'])

fig = plt.figure()
ax = plt.axes(projection='3d')
ax.scatter(df_3d['x'], df_3d['y'], df_3d['z'])
plt.show()

alpha_shape = alphashape.alphashape(points_3d, 1.1)
alpha_shape.show()

What I Expected

The same output as indicated on https://pypi.org/project/alphashape/ about 1/3 down. image

The points plot properly in 3D space, however the call to alphashape.alphashape() returns the following error: image


ValueError Traceback (most recent call last)

in 13 plt.show() 14 ---> 15 alpha_shape = alphashape.alphashape(points_3d, 1.1) 16 alpha_shape.show() ~\Anaconda3\lib\site-packages\alphashape\alphashape.py in alphashape(points, alpha) 72 73 # Loop over triangles ---> 74 for ia, ib, ic in tri.vertices: 75 pa = coords[ia] 76 pb = coords[ib] ValueError: too many values to unpack (expected 3) --------------------------------------------------------------------------- ### Acceptance Criteria Receive the same output as listed on https://pypi.org/project/alphashape/ Note1: I have tried this on a Macintosh system, and the correct output results were obtained for the same code, running from the same Jupyter Notebook. Note2: Prior to running the notebook, I performed a global update via anaconda command prompt: conda update --all