4

I have a set of points in the 3D space and I want to draw the bounding convex polyhedron of those points. A very naïve solution would be to draw a triangle between every three points:

Graphics3D[
    {EdgeForm[None], Polygon[Part[pts, #] & /@ Subsets[Range[Length@pts], {3}]]}, 
    Axes -> True]

However, this method is very inefficient. It takes a few seconds to be drawn on my laptop and whenever I want to rotate it using the mouse, it doesn't move smoothly. I know what the issue is: I am drawing too many triangles, many of them are not even visible (since they are placed inside the polyhedron). But how can I fix it?

Here is an example and the set of the points:

Polyhedron

pts={{0., 0., 0.}, {0., 0., 1.79176}, {0., 1.79176, 0.}, {1.79176, 0., 
  0.}, {0., 1.79176, 0.}, {0., 0., 1.79176}, {1.79176, 0., 0.}, {0., 
  1.79176, 0.606136}, {0., 0.606136, 1.79176}, {0., 1.79176, 
  0.606136}, {0., 0.606136, 1.79176}, {1.79176, 0., 
  0.606136}, {0.606136, 0., 1.79176}, {1.79176, 0.606136, 
  0.}, {0.606136, 1.79176, 0.}, {1.79176, 0., 0.606136}, {0.606136, 
  0., 1.79176}, {1.79176, 0.606136, 0.}, {0.606136, 1.79176, 
  0.}, {1.79176, 0., 0.}, {0., 1.79176, 0.}, {0., 0., 
  1.79176}, {1.79176, 0., 0.606136}, {0.606136, 0., 
  1.79176}, {1.79176, 0.606136, 0.}, {0.606136, 1.79176, 0.}, {0., 
  1.79176, 0.606136}, {0., 0.606136, 1.79176}, {0., 1.79176, 
  0.606136}, {0., 0.606136, 1.79176}, {1.79176, 0.606136, 
  0.}, {0.606136, 1.79176, 0.}, {1.79176, 0., 0.606136}, {0.606136, 
  0., 1.79176}, {1.79176, 0.606136, 0.}, {0.606136, 1.79176, 
  0.}, {1.79176, 0., 0.606136}, {0.606136, 0., 1.79176}, {1.79176, 
  0.606136, 0.}, {0.606136, 1.79176, 0.}, {1.79176, 0., 
  0.606136}, {0.606136, 0., 1.79176}, {0., 1.79176, 0.606136}, {0., 
  0.606136, 1.79176}, {0., 1.79176, 0.606136}, {0., 0.606136, 
  1.79176}, {1.79176, 0.606136, 0.374693}, {1.79176, 0.374693, 
  0.606136}, {0.606136, 1.79176, 0.374693}, {0.374693, 1.79176, 
  0.606136}, {0.606136, 0.374693, 1.79176}, {0.374693, 0.606136, 
  1.79176}, {1.79176, 0.606136, 0.374693}, {1.79176, 0.374693, 
  0.606136}, {0.606136, 1.79176, 0.374693}, {0.374693, 1.79176, 
  0.606136}, {0.606136, 0.374693, 1.79176}, {0.374693, 0.606136, 
  1.79176}, {1.79176, 0.606136, 0.374693}, {1.79176, 0.374693, 
  0.606136}, {0.606136, 1.79176, 0.374693}, {0.374693, 1.79176, 
  0.606136}, {0.606136, 0.374693, 1.79176}, {0.374693, 0.606136, 
  1.79176}, {1.79176, 0.606136, 0.374693}, {1.79176, 0.374693, 
  0.606136}, {0.606136, 1.79176, 0.374693}, {0.374693, 1.79176, 
  0.606136}, {0.606136, 0.374693, 1.79176}, {0.374693, 0.606136, 
  1.79176}, {1.79176, 0.606136, 0.374693}, {1.79176, 0.374693, 
  0.606136}, {0.606136, 1.79176, 0.374693}, {0.374693, 1.79176, 
  0.606136}, {0.606136, 0.374693, 1.79176}, {0.374693, 0.606136, 
  1.79176}, {1.79176, 0.606136, 0.374693}, {1.79176, 0.374693, 
  0.606136}, {0.606136, 1.79176, 0.374693}, {0.374693, 1.79176, 
  0.606136}, {0.606136, 0.374693, 1.79176}, {0.374693, 0.606136, 
  1.79176}}
Helium
  • 4,059
  • 24
  • 41

2 Answers2

7

The documented (!) TetGenConvexHull can compute the convex hull. Then using a GraphicsComplex will be efficient:

<< TetGenLink`
{coords, incidences} = TetGenConvexHull[pts];
Graphics3D[{EdgeForm[], GraphicsComplex[coords, Polygon[incidences]]}]

enter image description here

6

The (undocumented!) function ComputationalGeometry`Methods`ConvexHull3D[] is up to the task for this particular case:

ComputationalGeometry`Methods`ConvexHull3D[pts, Axes -> None,
                                           Graphics`Mesh`FlatFaces -> False]

some convex polyhedron

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574