mikedh / trimesh

Python library for loading and using triangular meshes.
https://trimesh.org
MIT License
3k stars 581 forks source link

QH6214 qhull input error: not enough points(3) to construct initial simplex (need 4) #1446

Open Alfajesto opened 2 years ago

Alfajesto commented 2 years ago

Hi everyone, the following input keeps generating the above error for using convex.convex_hull ... Are the points possibly not different enough?

array([[11.71025974, 8.46118505, 0.4248 ], [11.68935879, 8.47086879, 0.1475 ], [11.98477282, 7.63320084, 0.4779 ], [12.10512823, 8.33737576, 0.413 ], [12.01328663, 8.43630263, 1.0502 ], [11.56330693, 8.19610619, 0.4602 ], [11.71127942, 8.45222074, 0.5605 ], [11.48145594, 7.89063571, 0.4661 ], [11.81881492, 7.89600953, 0.6962 ], [11.78250858, 8.28021615, 1.0797 ], [12.08850164, 7.9283893 , 0.4661 ], [12.22127117, 8.16111939, 1.0384 ]])

Are the points possibly not different enough?

mikedh commented 2 years ago

Hmm looks like that example runs for me. Maybe your scipy install? I'd try a pip install --upgrade scipy

In [1]: import trimesh
import numpy as np

In [2]: import numpy as np

In [3]: a = np.array([[11.71025974, 8.46118505, 0.4248 ],
   ...: [11.68935879, 8.47086879, 0.1475 ],
   ...: [11.98477282, 7.63320084, 0.4779 ],
   ...: [12.10512823, 8.33737576, 0.413 ],
   ...: [12.01328663, 8.43630263, 1.0502 ],
   ...: [11.56330693, 8.19610619, 0.4602 ],
   ...: [11.71127942, 8.45222074, 0.5605 ],
   ...: [11.48145594, 7.89063571, 0.4661 ],
   ...: [11.81881492, 7.89600953, 0.6962 ],
   ...: [11.78250858, 8.28021615, 1.0797 ],
   ...: [12.08850164, 7.9283893 , 0.4661 ],
   ...: [12.22127117, 8.16111939, 1.0384 ]])

In [4]: trimesh.convex.convex_hull(a)
Out[4]: <trimesh.Trimesh(vertices.shape=(12, 3), faces.shape=(20, 3))>
Alfajesto commented 2 years ago

Thanks for the quick reply! I have upgraded scipy but now get the following error: While executing: | qhull i Qt QbB Pp Options selected for Qhull 2019.1.r 2019/06/21: run-id 2009977929 incidence Qtriangulate QbBound-unit-box 0.5 Pprecision-ignore _pre-merge _zero-centrum _maxoutside 0

Alfajesto commented 2 years ago

After much testing, it appears that this error only occurs under certain conditions.... Which, however, I do not quite understand. To explain: Using the Voronoi diagram, I determine the neighbors for arbitrary points in 3d space. For each point that has exactly 12 neighbors I want to calculate the convex hull. However, for a few cases I get the above error.