Message Boards Message Boards

5
|
5273 Views
|
4 Replies
|
9 Total Likes
View groups...
Share
Share this post:

Using Convex Hulls in 3D

Posted 10 years ago

A few Demonstrations using ConvexHull3D no longer work. It was an undocumented feature of previous versions, and isn't in Version 10. So, how to do the same thing in version 10?

initpts = Union[N[Flatten[{Table[{Sin[x],Cos[x],0}, {x,0,2 Pi,2 Pi/50}], 
    Table[{Sin[x],0,Cos[x]} + {2,0,0}, {x,0, 2 Pi, 2 Pi/50}]}, 1]]]; 
meshobject = ConvexHullMesh[initpts];
pts = MeshCoordinates[meshobject];
polys = MeshCells[meshobject, 2];
Graphics3D[{EdgeForm[], GraphicsComplex[pts, polys]}, Boxed -> False, 
        SphericalRegion -> True, ImageSize -> {400, 400}]

The variables pts and polys are the vital items for GraphicsComplex.

oloid

Attachments:
POSTED BY: Ed Pegg
4 Replies

You can get a GraphicsComplex with

ConvexHullMesh[initpts]["GraphicsComplex"]

or get graphics with

 ConvexHullMesh[initpts]["Graphics3D"]

(You can get many such things. See ConvexHullMesh[initpts]["Properties"].)

POSTED BY: Michael Rogers
Posted 10 years ago

Sam, yes, you can get that picture -- but you can't put Graphics3D options on it. You can't use SphericalRegion -> True, for example. I wrote up this note for people that want to extract the polygons from ConvexHullMesh.

POSTED BY: Ed Pegg

Ahh, I misunderstood. Well thanks for that code - I see now that it is very useful.

POSTED BY: Sam Carrettie

It is in the documentation on ConvexHullMesh. Applying to your case:

initpts = Union[N[Flatten[{Table[{Sin[x], Cos[x], 0}, {x, 0, 2 Pi, 2 Pi/50}], 
             Table[{Sin[x], 0, Cos[x]} + {2, 0, 0}, {x, 0, 2 Pi, 2 Pi/50}]}, 1]]];
ConvexHullMesh[initpts]

enter image description here

POSTED BY: Sam Carrettie
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract